Ensure index is green in SimpleClusterStateIT.testIndicesOptions() (#44893)

SimpleClusterStateIT testIndicesOptions failed in #44817 because it tries to close 
an index at the beginning of the test. With random index settings, it is possible that 
the index has a high number of shards (10) and replicas (1), which means that on 
CI this index can take time to be fully allocated.

The close index request can fail in the case where replicas are still recovering operations. 
Thiscommit adds a simple ensureGreen() at the beginning of the test to be sure that all 
replicas are started before trying to close the index.

closes #44817
This commit is contained in:
Tanguy Leroux 2019-07-26 16:58:39 +02:00
parent 1340ff19bc
commit e1b626b947
1 changed files with 1 additions and 0 deletions

View File

@ -257,6 +257,7 @@ public class SimpleClusterStateIT extends ESIntegTestCase {
ClusterStateResponse clusterStateResponse = client().admin().cluster().prepareState().clear().setMetaData(true).setIndices("f*") ClusterStateResponse clusterStateResponse = client().admin().cluster().prepareState().clear().setMetaData(true).setIndices("f*")
.get(); .get();
assertThat(clusterStateResponse.getState().metaData().indices().size(), is(2)); assertThat(clusterStateResponse.getState().metaData().indices().size(), is(2));
ensureGreen("fuu");
// close one index // close one index
client().admin().indices().close(Requests.closeIndexRequest("fuu")).get(); client().admin().indices().close(Requests.closeIndexRequest("fuu")).get();