@@ -1358,10 +1358,7 @@ public void testWaitForActiveShardsStep() throws Exception {
1358
1358
assertBusy (() -> assertThat (getStepKeyForIndex (originalIndex ), equalTo (PhaseCompleteStep .finalStep ("hot" ).getKey ())));
1359
1359
}
1360
1360
1361
- @ AwaitsFix (bugUrl = "https://github.com/elastic/elasticsearch/issues/50353" )
1362
1361
public void testHistoryIsWrittenWithSuccess () throws Exception {
1363
- String index = "success-index" ;
1364
-
1365
1362
createNewSingletonPolicy ("hot" , new RolloverAction (null , null , 1L ));
1366
1363
Request createIndexTemplate = new Request ("PUT" , "_template/rolling_indexes" );
1367
1364
createIndexTemplate .setJsonEntity ("{" +
@@ -1375,10 +1372,7 @@ public void testHistoryIsWrittenWithSuccess() throws Exception {
1375
1372
"}" );
1376
1373
client ().performRequest (createIndexTemplate );
1377
1374
1378
- createIndexWithSettings (index + "-1" ,
1379
- Settings .builder ().put (IndexMetaData .SETTING_NUMBER_OF_SHARDS , 1 )
1380
- .put (IndexMetaData .SETTING_NUMBER_OF_REPLICAS , 0 ),
1381
- true );
1375
+ createIndexWithSettings (index + "-1" , Settings .builder (), true );
1382
1376
1383
1377
// Index a document
1384
1378
index (client (), index + "-1" , "1" , "foo" , "bar" );
@@ -1396,69 +1390,34 @@ public void testHistoryIsWrittenWithSuccess() throws Exception {
1396
1390
assertBusy (() -> assertHistoryIsPresent (policy , index + "-1" , true , "wait-for-yellow-step" ), 30 , TimeUnit .SECONDS );
1397
1391
assertBusy (() -> assertHistoryIsPresent (policy , index + "-1" , true , "check-rollover-ready" ), 30 , TimeUnit .SECONDS );
1398
1392
assertBusy (() -> assertHistoryIsPresent (policy , index + "-1" , true , "attempt-rollover" ), 30 , TimeUnit .SECONDS );
1399
- assertBusy (() -> assertHistoryIsPresent (policy , index + "-1" , true , "update-rollover-lifecycle-date" ), 30 , TimeUnit .SECONDS );
1400
1393
assertBusy (() -> assertHistoryIsPresent (policy , index + "-1" , true , "set-indexing-complete" ), 30 , TimeUnit .SECONDS );
1401
- assertBusy (() -> assertHistoryIsPresent (policy , index + "-1" , true , "completed " ), 30 , TimeUnit .SECONDS );
1394
+ assertBusy (() -> assertHistoryIsPresent (policy , index + "-1" , true , "complete " ), 30 , TimeUnit .SECONDS );
1402
1395
1403
1396
assertBusy (() -> assertHistoryIsPresent (policy , index + "-000002" , true , "check-rollover-ready" ), 30 , TimeUnit .SECONDS );
1404
1397
}
1405
1398
1406
- @ AwaitsFix (bugUrl = "https://github.com/elastic/elasticsearch/issues/50353" )
1407
1399
public void testHistoryIsWrittenWithFailure () throws Exception {
1408
- String index = "failure-index" ;
1409
-
1400
+ createIndexWithSettings (index + "-1" , Settings .builder (), false );
1410
1401
createNewSingletonPolicy ("hot" , new RolloverAction (null , null , 1L ));
1411
- Request createIndexTemplate = new Request ("PUT" , "_template/rolling_indexes" );
1412
- createIndexTemplate .setJsonEntity ("{" +
1413
- "\" index_patterns\" : [\" " + index + "-*\" ], \n " +
1414
- " \" settings\" : {\n " +
1415
- " \" number_of_shards\" : 1,\n " +
1416
- " \" number_of_replicas\" : 0,\n " +
1417
- " \" index.lifecycle.name\" : \" " + policy + "\" \n " +
1418
- " }\n " +
1419
- "}" );
1420
- client ().performRequest (createIndexTemplate );
1421
-
1422
- createIndexWithSettings (index + "-1" ,
1423
- Settings .builder ().put (IndexMetaData .SETTING_NUMBER_OF_SHARDS , 1 )
1424
- .put (IndexMetaData .SETTING_NUMBER_OF_REPLICAS , 0 ),
1425
- false );
1402
+ updatePolicy (index + "-1" , policy );
1426
1403
1427
1404
// Index a document
1428
1405
index (client (), index + "-1" , "1" , "foo" , "bar" );
1429
1406
Request refreshIndex = new Request ("POST" , "/" + index + "-1/_refresh" );
1430
1407
client ().performRequest (refreshIndex );
1431
1408
1432
- assertBusy (() -> assertThat (getStepKeyForIndex (index + "-1" ).getName (), equalTo (ErrorStep .NAME )));
1409
+ assertBusy (() -> assertThat (getStepKeyForIndex (index + "-1" ).getName (), equalTo (ErrorStep .NAME )), 30 , TimeUnit . SECONDS );
1433
1410
1434
1411
assertBusy (() -> assertHistoryIsPresent (policy , index + "-1" , false , "ERROR" ), 30 , TimeUnit .SECONDS );
1435
1412
}
1436
1413
1437
- @ AwaitsFix (bugUrl = "https://github.com/elastic/elasticsearch/issues/50353" )
1438
1414
public void testHistoryIsWrittenWithDeletion () throws Exception {
1439
- String index = "delete-index" ;
1440
-
1441
- createNewSingletonPolicy ("delete" , new DeleteAction ());
1442
- Request createIndexTemplate = new Request ("PUT" , "_template/delete_indexes" );
1443
- createIndexTemplate .setJsonEntity ("{" +
1444
- "\" index_patterns\" : [\" " + index + "\" ], \n " +
1445
- " \" settings\" : {\n " +
1446
- " \" number_of_shards\" : 1,\n " +
1447
- " \" number_of_replicas\" : 0,\n " +
1448
- " \" index.lifecycle.name\" : \" " + policy + "\" \n " +
1449
- " }\n " +
1450
- "}" );
1451
- client ().performRequest (createIndexTemplate );
1452
-
1453
1415
// Index should be created and then deleted by ILM
1454
1416
createIndexWithSettings (index , Settings .builder (), false );
1417
+ createNewSingletonPolicy ("delete" , new DeleteAction ());
1418
+ updatePolicy (index , policy );
1455
1419
1456
- assertBusy (() -> {
1457
- logger .info ("--> checking for index deletion..." );
1458
- Request existCheck = new Request ("HEAD" , "/" + index );
1459
- Response resp = client ().performRequest (existCheck );
1460
- assertThat (resp .getStatusLine ().getStatusCode (), equalTo (404 ));
1461
- });
1420
+ assertBusy (() -> assertFalse (indexExists (index )));
1462
1421
1463
1422
assertBusy (() -> {
1464
1423
assertHistoryIsPresent (policy , index , true , "delete" , "delete" , "wait-for-shard-history-leases" );
@@ -1593,7 +1552,6 @@ private void assertHistoryIsPresent(String policyName, String indexName, boolean
1593
1552
// This method should be called inside an assertBusy, it has no retry logic of its own
1594
1553
private void assertHistoryIsPresent (String policyName , String indexName , boolean success ,
1595
1554
@ Nullable String phase , @ Nullable String action , String stepName ) throws IOException {
1596
- assertOK (client ().performRequest (new Request ("POST" , indexName + "/_refresh" )));
1597
1555
logger .info ("--> checking for history item [{}], [{}], success: [{}], phase: [{}], action: [{}], step: [{}]" ,
1598
1556
policyName , indexName , success , phase , action , stepName );
1599
1557
final Request historySearchRequest = new Request ("GET" , "ilm-history*/_search?expand_wildcards=all" );
0 commit comments