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 ;
@@ -1403,7 +1404,7 @@ public void testHistoryIsWrittenWithSuccess() throws Exception {
1403
1404
assertBusy (() -> assertHistoryIsPresent (policy , index + "-000002" , true , "check-rollover-ready" ), 30 , TimeUnit .SECONDS );
1404
1405
}
1405
1406
1406
- @ AwaitsFix ( bugUrl = "https://github.com/elastic/elasticsearch/issues/50353" )
1407
+ @ TestIssueLogging ( value = "org.elasticsearch.xpack.ilm.history:TRACE" , issueUrl = "https://github.com/elastic/elasticsearch/issues/50353" )
1407
1408
public void testHistoryIsWrittenWithFailure () throws Exception {
1408
1409
String index = "failure-index" ;
1409
1410
@@ -1593,9 +1594,10 @@ private void assertHistoryIsPresent(String policyName, String indexName, boolean
1593
1594
// This method should be called inside an assertBusy, it has no retry logic of its own
1594
1595
private void assertHistoryIsPresent (String policyName , String indexName , boolean success ,
1595
1596
@ Nullable String phase , @ Nullable String action , String stepName ) throws IOException {
1597
+ assertOK (client ().performRequest (new Request ("POST" , indexName + "/_refresh" )));
1596
1598
logger .info ("--> checking for history item [{}], [{}], success: [{}], phase: [{}], action: [{}], step: [{}]" ,
1597
1599
policyName , indexName , success , phase , action , stepName );
1598
- final Request historySearchRequest = new Request ("GET" , "ilm-history*/_search" );
1600
+ final Request historySearchRequest = new Request ("GET" , "ilm-history*/_search?expand_wildcards=all " );
1599
1601
historySearchRequest .setJsonEntity ("{\n " +
1600
1602
" \" query\" : {\n " +
1601
1603
" \" bool\" : {\n " +
@@ -1662,7 +1664,7 @@ private void assertHistoryIsPresent(String policyName, String indexName, boolean
1662
1664
try (InputStream is = allResultsResp .getEntity ().getContent ()) {
1663
1665
allResultsMap = XContentHelper .convertToMap (XContentType .JSON .xContent (), is , true );
1664
1666
}
1665
- logger .info ("--> expected at least 1 hit, got 0. All history for index [{}]: {}" , index , allResultsMap );
1667
+ logger .info ("--> expected at least 1 hit, got 0. All history for index [{}]: {}" , indexName , allResultsMap );
1666
1668
}
1667
1669
assertThat (hits , greaterThanOrEqualTo (1 ));
1668
1670
} catch (ResponseException e ) {
@@ -1672,7 +1674,7 @@ private void assertHistoryIsPresent(String policyName, String indexName, boolean
1672
1674
}
1673
1675
1674
1676
// Finally, check that the history index is in a good state
1675
- Step .StepKey stepKey = getStepKeyForIndex ("ilm-history-1 -000001" );
1677
+ Step .StepKey stepKey = getStepKeyForIndex ("ilm-history-2 -000001" );
1676
1678
assertEquals ("hot" , stepKey .getPhase ());
1677
1679
assertEquals (RolloverAction .NAME , stepKey .getAction ());
1678
1680
assertEquals (WaitForRolloverReadyStep .NAME , stepKey .getName ());
0 commit comments