Skip to content

Commit

Permalink
Simplify even further
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-vieira committed Jan 10, 2024
1 parent 4c0697c commit 0fad6f9
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
public class RestTestBasePlugin implements Plugin<Project> {

private static final String TESTS_MAX_PARALLEL_FORKS_SYSPROP = "tests.max.parallel.forks";
private static final String TESTS_RUNTIME_JAVA_SYSPROP = "tests.runtime.java";
private static final String DEFAULT_DISTRIBUTION_SYSPROP = "tests.default.distribution";
private static final String INTEG_TEST_DISTRIBUTION_SYSPROP = "tests.integ-test.distribution";
private static final String BWC_SNAPSHOT_DISTRIBUTION_SYSPROP_PREFIX = "tests.snapshot.distribution.";
Expand Down Expand Up @@ -190,12 +189,6 @@ public void apply(Project project) {
FileCollection extracted = integTestDistro.getExtracted();
nonInputSystemProperties.systemProperty(INTEG_TEST_DISTRIBUTION_SYSPROP, () -> extracted.getSingleFile().getPath());

// Pass the current test task runtime java home to test framework via system property
nonInputSystemProperties.systemProperty(
TESTS_RUNTIME_JAVA_SYSPROP,
task.getJavaLauncher().map(l -> l.getMetadata().getInstallationPath().getAsFile().getPath())
);

// Add `usesDefaultDistribution()` extension method to test tasks to indicate they require the default distro
task.getExtensions().getExtraProperties().set("usesDefaultDistribution", new Closure<Void>(task) {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public void testDieWithDignity() throws Exception {
}

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,14 @@
public class DefaultEnvironmentProvider implements EnvironmentProvider {
private static final String HOSTNAME_OVERRIDE = "LinuxDarwinHostname";
private static final String COMPUTERNAME_OVERRIDE = "WindowsComputername";
private static final String TESTS_RUNTIME_JAVA_SYSPROP = "tests.runtime.java";

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

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

// Override the system hostname variables for testing
Expand Down

0 comments on commit 0fad6f9

Please sign in to comment.