Skip to content

Commit

Permalink
Fix archive tests to not create elasticsearch home (#47239)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
rjernst authored and alpar-t committed Sep 30, 2019
1 parent 3648481 commit 33ebf5f
Showing 1 changed file with 3 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -202,17 +202,11 @@ public void test53JavaHomeWithSpecialCharacters() throws Exception {

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
Expand Down

0 comments on commit 33ebf5f

Please sign in to comment.