Skip to content

Commit c0169b8

Browse files
committed
Use assertBusy for waiting on file settings watching in readiness test (elastic#136131)
The readiness check depends on file settings being applied. The readiness tests need to wait on the file settings service watching for changes. This commit updates the readiness tests to spin on the file settings not yet watching. closes elastic#108613
1 parent d55329f commit c0169b8

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

server/src/internalClusterTest/java/org/elasticsearch/readiness/ReadinessClusterIT.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ protected Collection<Class<? extends Plugin>> getMockPlugins() {
109109
plugins.add(MockReadinessService.TestPlugin.class);
110110
return Collections.unmodifiableList(plugins);
111111
}
112-
112+
113113
private void assertMasterNode(Client client, String node) {
114114
assertThat(
115115
client.admin().cluster().prepareState(TEST_REQUEST_TIMEOUT).get().getState().nodes().getMasterNode().getName(),
@@ -124,7 +124,6 @@ private void expectMasterNotFound() {
124124
);
125125
}
126126

127-
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/108613")
128127
public void testReadinessDuringRestarts() throws Exception {
129128
internalCluster().setBootstrapMasterNodeIndex(0);
130129
writeFileSettings(testJSON);
@@ -276,7 +275,7 @@ public void testNotReadyOnBadFileSettings() throws Exception {
276275

277276
FileSettingsService masterFileSettingsService = internalCluster().getInstance(FileSettingsService.class, masterNode);
278277

279-
assertTrue(masterFileSettingsService.watching());
278+
assertBusy(() -> assertTrue(masterFileSettingsService.watching()));
280279
assertFalse(dataFileSettingsService.watching());
281280

282281
boolean awaitSuccessful = savedClusterState.await(20, TimeUnit.SECONDS);
@@ -333,7 +332,7 @@ public void testReadyWhenMissingFileSettings() throws Exception {
333332

334333
FileSettingsService masterFileSettingsService = internalCluster().getInstance(FileSettingsService.class, masterNode);
335334

336-
assertTrue(masterFileSettingsService.watching());
335+
assertBusy(() -> assertTrue(masterFileSettingsService.watching()));
337336

338337
boolean awaitSuccessful = savedClusterState.v1().await(20, TimeUnit.SECONDS);
339338
assertTrue(awaitSuccessful);
@@ -387,7 +386,7 @@ public void testReadyAfterCorrectFileSettings() throws Exception {
387386

388387
FileSettingsService masterFileSettingsService = internalCluster().getInstance(FileSettingsService.class, masterNode);
389388

390-
assertTrue(masterFileSettingsService.watching());
389+
assertBusy(() -> assertTrue(masterFileSettingsService.watching()));
391390
assertFalse(dataFileSettingsService.watching());
392391

393392
boolean awaitSuccessful = savedClusterState.v1().await(20, TimeUnit.SECONDS);

0 commit comments

Comments
 (0)