Skip to content

Commit 1665f70

Browse files
authored
Simplify handling of runtime java for tests clusters (#104232) (#104236)
1 parent 5a9a863 commit 1665f70

File tree

4 files changed

+2
-14
lines changed

4 files changed

+2
-14
lines changed

build-tools-internal/src/main/groovy/elasticsearch.runtime-jdk-provision.gradle

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,6 @@ configure(allprojects) {
4747
}
4848
}
4949
}
50-
51-
project.plugins.withType(RestTestBasePlugin) {
52-
tasks.withType(StandaloneRestIntegTestTask).configureEach {
53-
if (BuildParams.getIsRuntimeJavaHomeSet() == false) {
54-
nonInputProperties.systemProperty("tests.runtime.java", "${-> launcher.map { it.metadata.installationPath.asFile.path }.get()}")
55-
}
56-
}
57-
}
58-
5950
project.plugins.withType(ThirdPartyAuditPrecommitPlugin) {
6051
project.getTasks().withType(ThirdPartyAuditTask.class).configureEach {
6152
if (BuildParams.getIsRuntimeJavaHomeSet() == false) {

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/test/rest/RestTestBasePlugin.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@
6363
public class RestTestBasePlugin implements Plugin<Project> {
6464

6565
private static final String TESTS_MAX_PARALLEL_FORKS_SYSPROP = "tests.max.parallel.forks";
66-
private static final String TESTS_RUNTIME_JAVA_SYSPROP = "tests.runtime.java";
6766
private static final String DEFAULT_DISTRIBUTION_SYSPROP = "tests.default.distribution";
6867
private static final String INTEG_TEST_DISTRIBUTION_SYSPROP = "tests.integ-test.distribution";
6968
private static final String BWC_SNAPSHOT_DISTRIBUTION_SYSPROP_PREFIX = "tests.snapshot.distribution.";
@@ -189,7 +188,6 @@ public void apply(Project project) {
189188
// Wire up integ-test distribution by default for all test tasks
190189
FileCollection extracted = integTestDistro.getExtracted();
191190
nonInputSystemProperties.systemProperty(INTEG_TEST_DISTRIBUTION_SYSPROP, () -> extracted.getSingleFile().getPath());
192-
nonInputSystemProperties.systemProperty(TESTS_RUNTIME_JAVA_SYSPROP, BuildParams.getRuntimeJavaHome());
193191

194192
// Add `usesDefaultDistribution()` extension method to test tasks to indicate they require the default distro
195193
task.getExtensions().getExtraProperties().set("usesDefaultDistribution", new Closure<Void>(task) {

test/external-modules/die-with-dignity/src/javaRestTest/java/org/elasticsearch/qa/die_with_dignity/DieWithDignityIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public void testDieWithDignity() throws Exception {
7777
}
7878

7979
private Process startJcmd(long pid) throws IOException {
80-
final String jcmdPath = PathUtils.get(System.getProperty("tests.runtime.java"), "bin/jcmd").toString();
80+
final String jcmdPath = PathUtils.get(System.getProperty("java.home"), "bin/jcmd").toString();
8181
return new ProcessBuilder().command(jcmdPath, Long.toString(pid), "VM.command_line").redirectErrorStream(true).start();
8282
}
8383

test/test-clusters/src/main/java/org/elasticsearch/test/cluster/local/DefaultEnvironmentProvider.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,14 @@
2020
public class DefaultEnvironmentProvider implements EnvironmentProvider {
2121
private static final String HOSTNAME_OVERRIDE = "LinuxDarwinHostname";
2222
private static final String COMPUTERNAME_OVERRIDE = "WindowsComputername";
23-
private static final String TESTS_RUNTIME_JAVA_SYSPROP = "tests.runtime.java";
2423

2524
@Override
2625
public Map<String, String> get(LocalNodeSpec nodeSpec) {
2726
Map<String, String> environment = new HashMap<>();
2827

2928
// If we are testing the current version of Elasticsearch, use the configured runtime Java, otherwise use the bundled JDK
3029
if (nodeSpec.getDistributionType() == DistributionType.INTEG_TEST || nodeSpec.getVersion().equals(Version.CURRENT)) {
31-
environment.put("ES_JAVA_HOME", System.getProperty(TESTS_RUNTIME_JAVA_SYSPROP));
30+
environment.put("ES_JAVA_HOME", System.getProperty("java.home"));
3231
}
3332

3433
// Override the system hostname variables for testing

0 commit comments

Comments
 (0)