Skip to content

Commit

Permalink
Make docker packaging test more resilient (#111205)
Browse files Browse the repository at this point in the history
Wrap check for container shutdown log message in an `assertBusy()` to
deal with race conditions.

Closes #111132
  • Loading branch information
mark-vieira authored Jul 23, 2024
1 parent 61cb0a2 commit ce3bc5d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
3 changes: 0 additions & 3 deletions muted-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,6 @@ tests:
- class: org.elasticsearch.packaging.test.DockerTests
method: test021InstallPlugin
issue: https://github.com/elastic/elasticsearch/issues/110343
- class: org.elasticsearch.packaging.test.DockerTests
method: test600Interrupt
issue: https://github.com/elastic/elasticsearch/issues/111132
- class: org.elasticsearch.xpack.security.authc.oidc.OpenIdConnectAuthIT
method: testAuthenticateWithImplicitFlow
issue: https://github.com/elastic/elasticsearch/issues/111191
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1231,7 +1231,7 @@ public void test500Readiness() throws Exception {
assertBusy(() -> assertTrue(readinessProbe(9399)));
}

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

Expand All @@ -1241,10 +1241,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 ce3bc5d

Please sign in to comment.