Skip to content

Commit

Permalink
Use Awaitility
Browse files Browse the repository at this point in the history
Signed-off-by: Craig Perkins <[email protected]>
  • Loading branch information
cwperks committed Dec 19, 2023
1 parent 4b99681 commit 65875b5
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -300,18 +300,20 @@ public void testInvalidDefaultConfig() throws Exception {
);
final Settings settings = Settings.builder().put(ConfigConstants.SECURITY_ALLOW_DEFAULT_INIT_SECURITYINDEX, true).build();
setup(Settings.EMPTY, null, settings, false);
RestHelper rh = nonSslRestHelper();
Thread.sleep(10000);
Assert.assertEquals(
HttpStatus.SC_SERVICE_UNAVAILABLE,
rh.executeGetRequest("", encodeBasicHeader("admin", "admin")).getStatusCode()
nonSslRestHelper().executeGetRequest("", encodeBasicHeader("admin", "admin")).getStatusCode()
);

ClusterHelper.updateDefaultDirectory(defaultInitDirectory);
restart(Settings.EMPTY, null, settings, false);
rh = nonSslRestHelper();
Thread.sleep(10000);
Assert.assertEquals(HttpStatus.SC_OK, rh.executeGetRequest("", encodeBasicHeader("admin", "admin")).getStatusCode());
Awaitility.await()
.alias("Load default configuration")
.until(
() -> nonSslRestHelper().executeGetRequest("", encodeBasicHeader("admin", "admin")).getStatusCode(),
equalTo(HttpStatus.SC_OK)
);
} finally {
ClusterHelper.resetSystemProperties();
}
Expand Down

0 comments on commit 65875b5

Please sign in to comment.