[7.x] Fix TimeSeriesLifecycleActionsIT.testExplainFilters (#48… (#48776)
This test used an index without an alias to simulate a failure in the `check-rollover-ready` step. However, with #48256 that step automatically retries, meaning that the index may not always be in the ERROR step. This commit changes the test to use a shrink action with an invalid number of shards so that it stays in the ERROR step. Resolves #48767
This commit is contained in:
parent
99aedc844d
commit
d0ead688c3
|
@ -844,6 +844,23 @@ public class TimeSeriesLifecycleActionsIT extends ESRestTestCase {
|
|||
|
||||
createFullPolicy(TimeValue.ZERO);
|
||||
|
||||
{
|
||||
// Create a "shrink-only-policy"
|
||||
Map<String, LifecycleAction> warmActions = new HashMap<>();
|
||||
warmActions.put(ShrinkAction.NAME, new ShrinkAction(17));
|
||||
Map<String, Phase> phases = new HashMap<>();
|
||||
phases.put("warm", new Phase("warm", TimeValue.ZERO, warmActions));
|
||||
LifecyclePolicy lifecyclePolicy = new LifecyclePolicy("shrink-only-policy", phases);
|
||||
// PUT policy
|
||||
XContentBuilder builder = jsonBuilder();
|
||||
lifecyclePolicy.toXContent(builder, null);
|
||||
final StringEntity entity = new StringEntity(
|
||||
"{ \"policy\":" + Strings.toString(builder) + "}", ContentType.APPLICATION_JSON);
|
||||
Request request = new Request("PUT", "_ilm/policy/shrink-only-policy");
|
||||
request.setEntity(entity);
|
||||
assertOK(client().performRequest(request));
|
||||
}
|
||||
|
||||
createIndexWithSettings(goodIndex, Settings.builder()
|
||||
.put(RolloverAction.LIFECYCLE_ROLLOVER_ALIAS, "alias")
|
||||
.put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
|
@ -851,7 +868,7 @@ public class TimeSeriesLifecycleActionsIT extends ESRestTestCase {
|
|||
);
|
||||
createIndexWithSettingsNoAlias(errorIndex, Settings.builder()
|
||||
.put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
.put(LifecycleSettings.LIFECYCLE_NAME, policy)
|
||||
.put(LifecycleSettings.LIFECYCLE_NAME, "shrink-only-policy")
|
||||
);
|
||||
createIndexWithSettingsNoAlias(nonexistantPolicyIndex, Settings.builder()
|
||||
.put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
|
|
Loading…
Reference in New Issue