diff --git a/core/src/test/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsIT.java b/core/src/test/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsIT.java index 532b680acbb..55b0ba86aca 100644 --- a/core/src/test/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsIT.java +++ b/core/src/test/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsIT.java @@ -171,7 +171,7 @@ public class ClusterStatsIT extends ESIntegTestCase { assertThat(response.getNodesStats().getOs().getAllocatedProcessors(), equalTo(7)); } - public void testClusterStatus() throws Exception { + public void testClusterStatusWhenStateNotRecovered() throws Exception { // stop all other nodes internalCluster().ensureAtMostNumDataNodes(0); @@ -180,6 +180,8 @@ public class ClusterStatsIT extends ESIntegTestCase { assertThat(response.getStatus(), equalTo(ClusterHealthStatus.RED)); internalCluster().ensureAtLeastNumDataNodes(3); + // wait for the cluster status to settle + ensureGreen(); response = client().admin().cluster().prepareClusterStats().get(); assertThat(response.getStatus(), equalTo(ClusterHealthStatus.GREEN)); }