From 4396e6b48eb05e93b3041c7e392a9d5e8bd4e8ee Mon Sep 17 00:00:00 2001 From: Boaz Leskes Date: Tue, 4 Nov 2014 12:38:16 +0100 Subject: [PATCH] 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. --- .../java/org/elasticsearch/cluster/ClusterServiceTests.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/org/elasticsearch/cluster/ClusterServiceTests.java b/src/test/java/org/elasticsearch/cluster/ClusterServiceTests.java index 4958ef166ee..ab069d88f35 100644 --- a/src/test/java/org/elasticsearch/cluster/ClusterServiceTests.java +++ b/src/test/java/org/elasticsearch/cluster/ClusterServiceTests.java @@ -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() { 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));