Skip to content

Commit

Permalink
Make docker packaging test more resilient (elastic#111205) (elastic#1…
Browse files Browse the repository at this point in the history
…11208)

Wrap check for container shutdown log message in an `assertBusy()` to
deal with race conditions.

Closes elastic#111132
# Conflicts:
#	muted-tests.yml
  • Loading branch information
mark-vieira authored Jul 23, 2024
1 parent 1a207c4 commit ba48e33
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1223,7 +1223,7 @@ public void test500Readiness() throws Exception {
assertTrue(readinessProbe(9399));
}

public void test600Interrupt() {
public void test600Interrupt() throws Exception {
waitForElasticsearch(installation, "elastic", PASSWORD);
final Result containerLogs = getContainerLogs();

Expand All @@ -1233,10 +1233,12 @@ public void test600Interrupt() {
final int maxPid = infos.stream().map(i -> i.pid()).max(Integer::compareTo).get();

sh.run("bash -c 'kill -int " + maxPid + "'"); // send ctrl+c to all java processes
final Result containerLogsAfter = getContainerLogs();

assertThat("Container logs should contain stopping ...", containerLogsAfter.stdout(), containsString("stopping ..."));
assertThat("No errors stdout", containerLogsAfter.stdout(), not(containsString("java.security.AccessControlException:")));
assertThat("No errors stderr", containerLogsAfter.stderr(), not(containsString("java.security.AccessControlException:")));
assertBusy(() -> {
final Result containerLogsAfter = getContainerLogs();
assertThat("Container logs should contain stopping ...", containerLogsAfter.stdout(), containsString("stopping ..."));
assertThat("No errors stdout", containerLogsAfter.stdout(), not(containsString("java.security.AccessControlException:")));
assertThat("No errors stderr", containerLogsAfter.stderr(), not(containsString("java.security.AccessControlException:")));
});
}
}

0 comments on commit ba48e33

Please sign in to comment.