Skip to content

Commit d0ead68

Browse files
authored
[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
1 parent 99aedc8 commit d0ead68

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

x-pack/plugin/ilm/qa/multi-node/src/test/java/org/elasticsearch/xpack/ilm/TimeSeriesLifecycleActionsIT.java

+18-1
Original file line numberDiff line numberDiff line change
@@ -844,14 +844,31 @@ public void testExplainFilters() throws Exception {
844844

845845
createFullPolicy(TimeValue.ZERO);
846846

847+
{
848+
// Create a "shrink-only-policy"
849+
Map<String, LifecycleAction> warmActions = new HashMap<>();
850+
warmActions.put(ShrinkAction.NAME, new ShrinkAction(17));
851+
Map<String, Phase> phases = new HashMap<>();
852+
phases.put("warm", new Phase("warm", TimeValue.ZERO, warmActions));
853+
LifecyclePolicy lifecyclePolicy = new LifecyclePolicy("shrink-only-policy", phases);
854+
// PUT policy
855+
XContentBuilder builder = jsonBuilder();
856+
lifecyclePolicy.toXContent(builder, null);
857+
final StringEntity entity = new StringEntity(
858+
"{ \"policy\":" + Strings.toString(builder) + "}", ContentType.APPLICATION_JSON);
859+
Request request = new Request("PUT", "_ilm/policy/shrink-only-policy");
860+
request.setEntity(entity);
861+
assertOK(client().performRequest(request));
862+
}
863+
847864
createIndexWithSettings(goodIndex, Settings.builder()
848865
.put(RolloverAction.LIFECYCLE_ROLLOVER_ALIAS, "alias")
849866
.put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0)
850867
.put(LifecycleSettings.LIFECYCLE_NAME, policy)
851868
);
852869
createIndexWithSettingsNoAlias(errorIndex, Settings.builder()
853870
.put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0)
854-
.put(LifecycleSettings.LIFECYCLE_NAME, policy)
871+
.put(LifecycleSettings.LIFECYCLE_NAME, "shrink-only-policy")
855872
);
856873
createIndexWithSettingsNoAlias(nonexistantPolicyIndex, Settings.builder()
857874
.put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0)

0 commit comments

Comments
 (0)