Fix race in ClusterStatsIT
ClusterStatsIT#testClusterStatus() contained a race where the test cluster might still be initializing while test already checks for a green health status. With this commit the test waits until the cluster status changed and checks health afterwards. Checked with @bleskes.
This commit is contained in:
parent
1201843d72
commit
2522645123
|
@ -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));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue