Make windows JAVA_HOME handling consistent with linux (#55261) (#55362)

In bash, checking for whether an env variable exists uses the -z test,
against a stringified env var, so that the test is actually whether the
env var is empty, but not necessarily undefined. We use this to test
whether JAVA_HOME is set, to determine whether the bundled jdk should be
used. In windows, this test is an actual "undefined" check. This commit
brings the behavior on two systems in sync, opting to allow for an empty
JAVA_HOME in windows to indicate the bundled jdk should be used.

closes #55134
This commit is contained in:
Ryan Ernst 2020-04-16 16:17:41 -07:00 committed by GitHub
parent 9a9c1a721c
commit 742b69a7dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View File

@ -243,6 +243,18 @@ public class ArchiveTests extends PackagingTestCase {
});
}
public void test54ForceBundledJdkEmptyJavaHome() throws Exception {
assumeThat(distribution().hasJdk, is(true));
// cleanup from previous test
rm(installation.config("elasticsearch.keystore"));
sh.getEnv().put("JAVA_HOME", "");
startElasticsearch();
ServerUtils.runElasticsearchTests();
stopElasticsearch();
}
public void test70CustomPathConfAndJvmOptions() throws Exception {
final Path tempConf = getTempDir().resolve("esconf-alternate");