[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:
Lee Hinman 2019-10-31 15:25:12 -06:00 committed by GitHub
parent 99aedc844d
commit d0ead688c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 1 deletions

View File

@ -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)