|
@@ -30,6 +30,7 @@ import org.elasticsearch.gradle.ReaperService;
|
|
|
import org.elasticsearch.gradle.Version;
|
|
|
import org.elasticsearch.gradle.VersionProperties;
|
|
|
import org.elasticsearch.gradle.http.WaitForHttpResource;
|
|
|
+import org.elasticsearch.gradle.info.BuildParams;
|
|
|
import org.gradle.api.Action;
|
|
|
import org.gradle.api.Named;
|
|
|
import org.gradle.api.NamedDomainObjectContainer;
|
|
@@ -145,7 +146,6 @@ public class ElasticsearchNode implements TestClusterConfiguration {
|
|
|
private int currentDistro = 0;
|
|
|
private TestDistribution testDistribution;
|
|
|
private List<ElasticsearchDistribution> distributions = new ArrayList<>();
|
|
|
- private File javaHome;
|
|
|
private volatile Process esProcess;
|
|
|
private Function<String, String> nameCustomization = Function.identity();
|
|
|
private boolean isWorkingDirConfigured = false;
|
|
@@ -373,21 +373,6 @@ public class ElasticsearchNode implements TestClusterConfiguration {
|
|
|
configurationFrozen.set(true);
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public void setJavaHome(File javaHome) {
|
|
|
- requireNonNull(javaHome, "null javaHome passed when configuring test cluster `" + this + "`");
|
|
|
- checkFrozen();
|
|
|
- if (javaHome.exists() == false) {
|
|
|
- throw new TestClustersException("java home for `" + this + "` does not exists: `" + javaHome + "`");
|
|
|
- }
|
|
|
- this.javaHome = javaHome;
|
|
|
- }
|
|
|
-
|
|
|
- @Internal
|
|
|
- public File getJavaHome() {
|
|
|
- return javaHome;
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* Returns a stream of lines in the generated logs similar to Files.lines
|
|
|
*
|
|
@@ -665,8 +650,9 @@ public class ElasticsearchNode implements TestClusterConfiguration {
|
|
|
|
|
|
private Map<String, String> getESEnvironment() {
|
|
|
Map<String, String> defaultEnv = new HashMap<>();
|
|
|
- if (getJavaHome() != null) {
|
|
|
- defaultEnv.put("JAVA_HOME", getJavaHome().getAbsolutePath());
|
|
|
+ // If we are testing the current version of Elasticsearch, use the configured runtime Java, otherwise use the bundled JDK
|
|
|
+ if (getTestDistribution() == TestDistribution.INTEG_TEST || getVersion().toString().equals(VersionProperties.getElasticsearch())) {
|
|
|
+ defaultEnv.put("JAVA_HOME", BuildParams.getRuntimeJavaHome().getAbsolutePath());
|
|
|
}
|
|
|
defaultEnv.put("ES_PATH_CONF", configFile.getParent().toString());
|
|
|
String systemPropertiesString = "";
|