25
25
import org .elasticsearch .common .xcontent .XContentType ;
26
26
import org .elasticsearch .common .xcontent .json .JsonXContent ;
27
27
import org .elasticsearch .index .IndexSettings ;
28
+ import org .elasticsearch .test .junit .annotations .TestIssueLogging ;
28
29
import org .elasticsearch .test .rest .ESRestTestCase ;
29
30
import org .elasticsearch .xpack .core .ilm .AllocateAction ;
30
31
import org .elasticsearch .xpack .core .ilm .DeleteAction ;
@@ -1383,7 +1384,7 @@ public void testHistoryIsWrittenWithSuccess() throws Exception {
1383
1384
assertBusy (() -> assertHistoryIsPresent (policy , index + "-000002" , true , "check-rollover-ready" ), 30 , TimeUnit .SECONDS );
1384
1385
}
1385
1386
1386
- @ AwaitsFix ( bugUrl = "https://github.com/elastic/elasticsearch/issues/50353" )
1387
+ @ TestIssueLogging ( value = "org.elasticsearch.xpack.ilm.history:TRACE" , issueUrl = "https://github.com/elastic/elasticsearch/issues/50353" )
1387
1388
public void testHistoryIsWrittenWithFailure () throws Exception {
1388
1389
String index = "failure-index" ;
1389
1390
@@ -1573,9 +1574,10 @@ private void assertHistoryIsPresent(String policyName, String indexName, boolean
1573
1574
// This method should be called inside an assertBusy, it has no retry logic of its own
1574
1575
private void assertHistoryIsPresent (String policyName , String indexName , boolean success ,
1575
1576
@ Nullable String phase , @ Nullable String action , String stepName ) throws IOException {
1577
+ assertOK (client ().performRequest (new Request ("POST" , indexName + "/_refresh" )));
1576
1578
logger .info ("--> checking for history item [{}], [{}], success: [{}], phase: [{}], action: [{}], step: [{}]" ,
1577
1579
policyName , indexName , success , phase , action , stepName );
1578
- final Request historySearchRequest = new Request ("GET" , "ilm-history*/_search" );
1580
+ final Request historySearchRequest = new Request ("GET" , "ilm-history*/_search?expand_wildcards=all " );
1579
1581
historySearchRequest .setJsonEntity ("{\n " +
1580
1582
" \" query\" : {\n " +
1581
1583
" \" bool\" : {\n " +
@@ -1642,7 +1644,7 @@ private void assertHistoryIsPresent(String policyName, String indexName, boolean
1642
1644
try (InputStream is = allResultsResp .getEntity ().getContent ()) {
1643
1645
allResultsMap = XContentHelper .convertToMap (XContentType .JSON .xContent (), is , true );
1644
1646
}
1645
- logger .info ("--> expected at least 1 hit, got 0. All history for index [{}]: {}" , index , allResultsMap );
1647
+ logger .info ("--> expected at least 1 hit, got 0. All history for index [{}]: {}" , indexName , allResultsMap );
1646
1648
}
1647
1649
assertThat (hits , greaterThanOrEqualTo (1 ));
1648
1650
} catch (ResponseException e ) {
@@ -1652,7 +1654,7 @@ private void assertHistoryIsPresent(String policyName, String indexName, boolean
1652
1654
}
1653
1655
1654
1656
// Finally, check that the history index is in a good state
1655
- Step .StepKey stepKey = getStepKeyForIndex ("ilm-history-1 -000001" );
1657
+ Step .StepKey stepKey = getStepKeyForIndex ("ilm-history-2 -000001" );
1656
1658
assertEquals ("hot" , stepKey .getPhase ());
1657
1659
assertEquals (RolloverAction .NAME , stepKey .getAction ());
1658
1660
assertEquals (WaitForRolloverReadyStep .NAME , stepKey .getName ());
0 commit comments