@@ -1367,10 +1367,7 @@ public void testWaitForActiveShardsStep() throws Exception {
1367
1367
assertBusy (() -> assertThat (getStepKeyForIndex (originalIndex ), equalTo (PhaseCompleteStep .finalStep ("hot" ).getKey ())));
1368
1368
}
1369
1369
1370
- @ AwaitsFix (bugUrl = "https://github.com/elastic/elasticsearch/issues/50353" )
1371
1370
public void testHistoryIsWrittenWithSuccess () throws Exception {
1372
- String index = "success-index" ;
1373
-
1374
1371
createNewSingletonPolicy ("hot" , new RolloverAction (null , null , 1L ));
1375
1372
Request createIndexTemplate = new Request ("PUT" , "_template/rolling_indexes" );
1376
1373
createIndexTemplate .setJsonEntity ("{" +
@@ -1384,10 +1381,7 @@ public void testHistoryIsWrittenWithSuccess() throws Exception {
1384
1381
"}" );
1385
1382
client ().performRequest (createIndexTemplate );
1386
1383
1387
- createIndexWithSettings (index + "-1" ,
1388
- Settings .builder ().put (IndexMetaData .SETTING_NUMBER_OF_SHARDS , 1 )
1389
- .put (IndexMetaData .SETTING_NUMBER_OF_REPLICAS , 0 ),
1390
- true );
1384
+ createIndexWithSettings (index + "-1" , Settings .builder (), true );
1391
1385
1392
1386
// Index a document
1393
1387
index (client (), index + "-1" , "1" , "foo" , "bar" );
@@ -1405,69 +1399,34 @@ public void testHistoryIsWrittenWithSuccess() throws Exception {
1405
1399
assertBusy (() -> assertHistoryIsPresent (policy , index + "-1" , true , "wait-for-yellow-step" ), 30 , TimeUnit .SECONDS );
1406
1400
assertBusy (() -> assertHistoryIsPresent (policy , index + "-1" , true , "check-rollover-ready" ), 30 , TimeUnit .SECONDS );
1407
1401
assertBusy (() -> assertHistoryIsPresent (policy , index + "-1" , true , "attempt-rollover" ), 30 , TimeUnit .SECONDS );
1408
- assertBusy (() -> assertHistoryIsPresent (policy , index + "-1" , true , "update-rollover-lifecycle-date" ), 30 , TimeUnit .SECONDS );
1409
1402
assertBusy (() -> assertHistoryIsPresent (policy , index + "-1" , true , "set-indexing-complete" ), 30 , TimeUnit .SECONDS );
1410
- assertBusy (() -> assertHistoryIsPresent (policy , index + "-1" , true , "completed " ), 30 , TimeUnit .SECONDS );
1403
+ assertBusy (() -> assertHistoryIsPresent (policy , index + "-1" , true , "complete " ), 30 , TimeUnit .SECONDS );
1411
1404
1412
1405
assertBusy (() -> assertHistoryIsPresent (policy , index + "-000002" , true , "check-rollover-ready" ), 30 , TimeUnit .SECONDS );
1413
1406
}
1414
1407
1415
- @ AwaitsFix (bugUrl = "https://github.com/elastic/elasticsearch/issues/50353" )
1416
1408
public void testHistoryIsWrittenWithFailure () throws Exception {
1417
- String index = "failure-index" ;
1418
-
1409
+ createIndexWithSettings (index + "-1" , Settings .builder (), false );
1419
1410
createNewSingletonPolicy ("hot" , new RolloverAction (null , null , 1L ));
1420
- Request createIndexTemplate = new Request ("PUT" , "_template/rolling_indexes" );
1421
- createIndexTemplate .setJsonEntity ("{" +
1422
- "\" index_patterns\" : [\" " + index + "-*\" ], \n " +
1423
- " \" settings\" : {\n " +
1424
- " \" number_of_shards\" : 1,\n " +
1425
- " \" number_of_replicas\" : 0,\n " +
1426
- " \" index.lifecycle.name\" : \" " + policy + "\" \n " +
1427
- " }\n " +
1428
- "}" );
1429
- client ().performRequest (createIndexTemplate );
1430
-
1431
- createIndexWithSettings (index + "-1" ,
1432
- Settings .builder ().put (IndexMetaData .SETTING_NUMBER_OF_SHARDS , 1 )
1433
- .put (IndexMetaData .SETTING_NUMBER_OF_REPLICAS , 0 ),
1434
- false );
1411
+ updatePolicy (index + "-1" , policy );
1435
1412
1436
1413
// Index a document
1437
1414
index (client (), index + "-1" , "1" , "foo" , "bar" );
1438
1415
Request refreshIndex = new Request ("POST" , "/" + index + "-1/_refresh" );
1439
1416
client ().performRequest (refreshIndex );
1440
1417
1441
- assertBusy (() -> assertThat (getStepKeyForIndex (index + "-1" ).getName (), equalTo (ErrorStep .NAME )));
1418
+ assertBusy (() -> assertThat (getStepKeyForIndex (index + "-1" ).getName (), equalTo (ErrorStep .NAME )), 30 , TimeUnit . SECONDS );
1442
1419
1443
1420
assertBusy (() -> assertHistoryIsPresent (policy , index + "-1" , false , "ERROR" ), 30 , TimeUnit .SECONDS );
1444
1421
}
1445
1422
1446
- @ AwaitsFix (bugUrl = "https://github.com/elastic/elasticsearch/issues/50353" )
1447
1423
public void testHistoryIsWrittenWithDeletion () throws Exception {
1448
- String index = "delete-index" ;
1449
-
1450
- createNewSingletonPolicy ("delete" , new DeleteAction ());
1451
- Request createIndexTemplate = new Request ("PUT" , "_template/delete_indexes" );
1452
- createIndexTemplate .setJsonEntity ("{" +
1453
- "\" index_patterns\" : [\" " + index + "\" ], \n " +
1454
- " \" settings\" : {\n " +
1455
- " \" number_of_shards\" : 1,\n " +
1456
- " \" number_of_replicas\" : 0,\n " +
1457
- " \" index.lifecycle.name\" : \" " + policy + "\" \n " +
1458
- " }\n " +
1459
- "}" );
1460
- client ().performRequest (createIndexTemplate );
1461
-
1462
1424
// Index should be created and then deleted by ILM
1463
1425
createIndexWithSettings (index , Settings .builder (), false );
1426
+ createNewSingletonPolicy ("delete" , new DeleteAction ());
1427
+ updatePolicy (index , policy );
1464
1428
1465
- assertBusy (() -> {
1466
- logger .info ("--> checking for index deletion..." );
1467
- Request existCheck = new Request ("HEAD" , "/" + index );
1468
- Response resp = client ().performRequest (existCheck );
1469
- assertThat (resp .getStatusLine ().getStatusCode (), equalTo (404 ));
1470
- });
1429
+ assertBusy (() -> assertFalse (indexExists (index )));
1471
1430
1472
1431
assertBusy (() -> {
1473
1432
assertHistoryIsPresent (policy , index , true , "delete" , "delete" , "wait-for-shard-history-leases" );
0 commit comments