Test: ClusterServiceTetsts.testLocalNodeMasterListenerCallbacks should verify cluster state is applied

The test verifies the correct behavior of a listener but we only call the listener after publishing a new cluster state. Only checking on the publishing of the state introduces a racing condition.
This commit is contained in:
Boaz Leskes 2014-11-04 12:38:16 +01:00
parent 1c66317443
commit 4396e6b48e
1 changed files with 1 additions and 1 deletions

View File

@ -654,7 +654,7 @@ public class ClusterServiceTests extends ElasticsearchIntegrationTest {
// there should not be any master as the minimum number of required eligible masters is not met
awaitBusy(new Predicate<Object>() {
public boolean apply(Object obj) {
return clusterService1.state().nodes().masterNode() == null;
return clusterService1.state().nodes().masterNode() == null && clusterService1.state().status() == ClusterState.ClusterStateStatus.APPLIED;
}
});
assertThat(testService1.master(), is(false));