1414import org .elasticsearch .cluster .metadata .IndexMetadata ;
1515import org .elasticsearch .cluster .metadata .Template ;
1616import org .elasticsearch .common .xcontent .XContentHelper ;
17+ import org .elasticsearch .core .TimeValue ;
1718import org .elasticsearch .index .engine .EngineConfig ;
1819import org .elasticsearch .test .rest .ESRestTestCase ;
1920import org .elasticsearch .xcontent .XContentType ;
@@ -153,7 +154,7 @@ public void testShrinkActionInPolicyWithoutHotPhase() throws Exception {
153154 );
154155
155156 String shrunkenIndex = waitAndGetShrinkIndexName (client (), backingIndexName );
156- assertBusy (() -> assertTrue ( indexExists ( shrunkenIndex )), 30 , TimeUnit . SECONDS );
157+ awaitIndexExists ( shrunkenIndex , TimeValue . timeValueSeconds ( 30 ) );
157158 assertBusy (() -> assertThat (getStepKeyForIndex (client (), shrunkenIndex ), equalTo (PhaseCompleteStep .finalStep ("warm" ).getKey ())));
158159 assertBusy (() -> assertThat ("the original index must've been deleted" , indexExists (backingIndexName ), is (false )));
159160 }
@@ -182,8 +183,8 @@ public void testSearchableSnapshotAction() throws Exception {
182183 // Manual rollover the original index such that it's not the write index in the data stream anymore
183184 rolloverMaxOneDocCondition (client (), dataStream );
184185
185- assertBusy (() -> assertThat ( indexExists ( restoredIndexName ), is ( true )) );
186- assertBusy (() -> assertFalse ( indexExists ( backingIndexName )), 60 , TimeUnit . SECONDS );
186+ awaitIndexExists ( restoredIndexName );
187+ awaitIndexDoesNotExist ( backingIndexName , TimeValue . timeValueSeconds ( 60 ) );
187188 assertBusy (
188189 () -> assertThat (explainIndex (client (), restoredIndexName ).get ("step" ), is (PhaseCompleteStep .NAME )),
189190 30 ,
@@ -211,15 +212,13 @@ public void testReadOnlyAction() throws Exception {
211212 // Manual rollover the original index such that it's not the write index in the data stream anymore
212213 rolloverMaxOneDocCondition (client (), dataStream );
213214
214- assertBusy (
215- () -> assertThat (explainIndex (client (), backingIndexName ).get ("step" ), is (PhaseCompleteStep .NAME )),
216- 30 ,
217- TimeUnit .SECONDS
218- );
219- assertThat (
220- getOnlyIndexSettings (client (), backingIndexName ).get (IndexMetadata .INDEX_BLOCKS_WRITE_SETTING .getKey ()),
221- equalTo ("true" )
222- );
215+ assertBusy (() -> {
216+ assertThat (explainIndex (client (), backingIndexName ).get ("step" ), is (PhaseCompleteStep .NAME ));
217+ assertThat (
218+ getOnlyIndexSettings (client (), backingIndexName ).get (IndexMetadata .INDEX_BLOCKS_WRITE_SETTING .getKey ()),
219+ equalTo ("true" )
220+ );
221+ }, 30 , TimeUnit .SECONDS );
223222 }
224223
225224 public void testFreezeAction () throws Exception {
@@ -243,10 +242,10 @@ public void testFreezeAction() throws Exception {
243242 containsString ("The freeze action in ILM is deprecated and will be removed in a future version" )
244243 );
245244 }
245+ Map <String , Object > settings = getOnlyIndexSettings (client (), backingIndexName );
246+ assertNull (settings .get ("index.frozen" ));
246247 }, 30 , TimeUnit .SECONDS );
247248
248- Map <String , Object > settings = getOnlyIndexSettings (client (), backingIndexName );
249- assertNull (settings .get ("index.frozen" ));
250249 }
251250
252251 public void checkForceMergeAction (String codec ) throws Exception {
0 commit comments