Skip to content

Commit b1c15a0

Browse files
rjernstalpar-t
authored andcommitted
Wait for elasticsearch exit in packaging tests (#47242)
The archives stopElasticsearch utility method sends SIGTERM to the elasticsearch process, but does not wait for it to exit. That can cause subsequent tests to sometimes file. This commit adds wait logic to both linux and windows for the stopElasticsearch method. closes #44501
1 parent 4aab59e commit b1c15a0

File tree

1 file changed

+2
-2
lines changed
  • qa/os/src/test/java/org/elasticsearch/packaging/util

1 file changed

+2
-2
lines changed

qa/os/src/test/java/org/elasticsearch/packaging/util/Archives.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,8 @@ public static void stopElasticsearch(Installation installation) throws Exception
315315
assertThat(pid, not(isEmptyOrNullString()));
316316

317317
final Shell sh = new Shell();
318-
Platforms.onLinux(() -> sh.run("kill -SIGTERM " + pid));
319-
Platforms.onWindows(() -> sh.run("Get-Process -Id " + pid + " | Stop-Process -Force"));
318+
Platforms.onLinux(() -> sh.run("kill -SIGTERM " + pid + "; tail --pid=" + pid + " -f /dev/null"));
319+
Platforms.onWindows(() -> sh.run("Get-Process -Id " + pid + " | Stop-Process -Force; Wait-Process -Id " + pid));
320320
}
321321

322322
}

0 commit comments

Comments
 (0)