[TEST] Fix testOpenWaitingForActiveShardsFailed

This test periodically fails if the nodes that apply the cluster state fail to ack the change within 100ms. This commit changes the checks on the test so that
it still checks that the open command has taken effect, but that the wait for active shards has actually failed.
This commit is contained in:
Yannick Welsch 2017-12-07 10:23:36 +01:00
parent 5b3230cbae
commit 0b102f6372
1 changed files with 4 additions and 2 deletions

View File

@ -298,7 +298,7 @@ public class OpenCloseIndexIT extends ESIntegTestCase {
assertIndexIsOpened("test1", "test2");
}
public void testOpenWaitingForActiveShardsFailed() {
public void testOpenWaitingForActiveShardsFailed() throws Exception {
Client client = client();
Settings settings = Settings.builder()
.put(IndexMetaData.INDEX_NUMBER_OF_SHARDS_SETTING.getKey(), 1)
@ -308,8 +308,10 @@ public class OpenCloseIndexIT extends ESIntegTestCase {
assertAcked(client.admin().indices().prepareClose("test").get());
OpenIndexResponse response = client.admin().indices().prepareOpen("test").setTimeout("100ms").setWaitForActiveShards(2).get();
assertAcked(response);
assertThat(response.isShardsAcknowledged(), equalTo(false));
assertBusy(() -> assertThat(client.admin().cluster().prepareState().get().getState().metaData().index("test").getState(),
equalTo(IndexMetaData.State.OPEN)));
ensureGreen("test");
}
private void assertIndexIsOpened(String... indices) {