From 33ebf5f5dc800f19334a09adb295354a0f8a3682 Mon Sep 17 00:00:00 2001 From: Ryan Ernst Date: Mon, 30 Sep 2019 02:05:29 -0700 Subject: [PATCH] Fix archive tests to not create elasticsearch home (#47239) The test for java home with special characters on linux would create a temporary java home under /home/elasticsearch. But our packaging assertions expect that to not exist. Unfortunately this would fail much later when the checks were actually done in bats tests. This commit fixes the linux test to match the behavior of windows, which links the entire java directory, and now does it into a /tmp dir. closes #45903 --- .../elasticsearch/packaging/test/ArchiveTests.java | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/qa/os/src/test/java/org/elasticsearch/packaging/test/ArchiveTests.java b/qa/os/src/test/java/org/elasticsearch/packaging/test/ArchiveTests.java index 7b531ba0e19..32162717ac0 100644 --- a/qa/os/src/test/java/org/elasticsearch/packaging/test/ArchiveTests.java +++ b/qa/os/src/test/java/org/elasticsearch/packaging/test/ArchiveTests.java @@ -202,17 +202,11 @@ public class ArchiveTests extends PackagingTestCase { Platforms.onLinux(() -> { final Shell sh = new Shell(); - // Create temporary directory with a space and link to java binary. - // Use it as java_home - String testJavaHome = FileUtils.mkdir(Paths.get("/home", ARCHIVE_OWNER, "java home")).toAbsolutePath().toString(); + // Create temporary directory with a space and link to real java home + String testJavaHome = Paths.get("/tmp", "java home").toString(); try { final String systemJavaHome = sh.run("echo $SYSTEM_JAVA_HOME").stdout.trim(); - final String java = systemJavaHome + "/bin/java"; - - sh.run("mkdir -p \"" + testJavaHome + "/bin\""); - sh.run("ln -s \"" + java + "\" \"" + testJavaHome + "/bin/java\""); - sh.run("chown -R " + ARCHIVE_OWNER + ":" + ARCHIVE_OWNER + " \"" + testJavaHome + "\""); - + sh.run("ln -s \"" + systemJavaHome + "\" \"" + testJavaHome + "\""); sh.getEnv().put("JAVA_HOME", testJavaHome); //verify ES can start, stop and run plugin list