Skip to content

Commit

Permalink
Fix TimeSeriesLifecycleActionsIT.testExplainFilters
Browse files Browse the repository at this point in the history
This test used an index without an alias to simulate a failure in the
`check-rollover-ready` step. However, with elastic#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 elastic#48767
  • Loading branch information
dakrone committed Oct 31, 2019
1 parent 9b73169 commit 125cd8b
Showing 1 changed file with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -835,14 +835,31 @@ public void testExplainFilters() throws Exception {

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)
.put(LifecycleSettings.LIFECYCLE_NAME, policy)
);
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)
Expand Down

0 comments on commit 125cd8b

Please sign in to comment.