@@ -54,14 +54,14 @@ public class CloseIndexIT extends ESIntegTestCase {
5454
5555 public void testCloseMissingIndex () {
5656 IndexNotFoundException e = expectThrows (IndexNotFoundException .class , () -> client ().admin ().indices ().prepareClose ("test" ).get ());
57- assertThat (e .getMessage (), is ("no such index [test] " ));
57+ assertThat (e .getMessage (), is ("no such index" ));
5858 }
5959
6060 public void testCloseOneMissingIndex () {
6161 createIndex ("test1" );
6262 final IndexNotFoundException e = expectThrows (IndexNotFoundException .class ,
6363 () -> client ().admin ().indices ().prepareClose ("test1" , "test2" ).get ());
64- assertThat (e .getMessage (), is ("no such index [test2] " ));
64+ assertThat (e .getMessage (), is ("no such index" ));
6565 }
6666
6767 public void testCloseOneMissingIndexIgnoreMissing () {
@@ -93,7 +93,7 @@ public void testCloseIndex() throws Exception {
9393 assertAcked (client ().admin ().indices ().prepareClose (indexName ));
9494 assertIndexIsClosed (indexName );
9595
96- assertAcked (client ().admin ().indices ().prepareOpen (indexName ));
96+ assertAcked (client ().admin ().indices ().prepareOpen (indexName ). setWaitForActiveShards ( ActiveShardCount . DEFAULT ) );
9797 assertHitCount (client ().prepareSearch (indexName ).setSize (0 ).get (), nbDocs );
9898 }
9999
@@ -185,7 +185,7 @@ public void testCloseWhileIndexingDocuments() throws Exception {
185185 }
186186
187187 assertIndexIsClosed (indexName );
188- assertAcked (client ().admin ().indices ().prepareOpen (indexName ));
188+ assertAcked (client ().admin ().indices ().prepareOpen (indexName ). setWaitForActiveShards ( ActiveShardCount . DEFAULT ) );
189189 assertHitCount (client ().prepareSearch (indexName ).setSize (0 ).get (), nbDocs );
190190 }
191191
@@ -274,7 +274,7 @@ public void testConcurrentClosesAndOpens() throws Exception {
274274 threads .add (new Thread (() -> {
275275 try {
276276 waitForLatch .run ();
277- assertAcked (client ().admin ().indices ().prepareOpen (indexName ).get ());
277+ assertAcked (client ().admin ().indices ().prepareOpen (indexName ).setWaitForActiveShards ( ActiveShardCount . DEFAULT ). get ());
278278 } catch (final Exception e ) {
279279 throw new AssertionError (e );
280280 }
@@ -295,7 +295,7 @@ public void testConcurrentClosesAndOpens() throws Exception {
295295 final ClusterState clusterState = client ().admin ().cluster ().prepareState ().get ().getState ();
296296 if (clusterState .metaData ().indices ().get (indexName ).getState () == IndexMetaData .State .CLOSE ) {
297297 assertIndexIsClosed (indexName );
298- assertAcked (client ().admin ().indices ().prepareOpen (indexName ));
298+ assertAcked (client ().admin ().indices ().prepareOpen (indexName ). setWaitForActiveShards ( ActiveShardCount . DEFAULT ) );
299299 }
300300 refresh (indexName );
301301 assertIndexIsOpened (indexName );
0 commit comments