Skip to content

Commit 125cd8b

Browse files
committed
Fix TimeSeriesLifecycleActionsIT.testExplainFilters
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
1 parent 9b73169 commit 125cd8b

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
@@ -835,14 +835,31 @@ public void testExplainFilters() throws Exception {
835835

836836
createFullPolicy(TimeValue.ZERO);
837837

838+
{
839+
// Create a "shrink-only-policy"
840+
Map<String, LifecycleAction> warmActions = new HashMap<>();
841+
warmActions.put(ShrinkAction.NAME, new ShrinkAction(17));
842+
Map<String, Phase> phases = new HashMap<>();
843+
phases.put("warm", new Phase("warm", TimeValue.ZERO, warmActions));
844+
LifecyclePolicy lifecyclePolicy = new LifecyclePolicy("shrink-only-policy", phases);
845+
// PUT policy
846+
XContentBuilder builder = jsonBuilder();
847+
lifecyclePolicy.toXContent(builder, null);
848+
final StringEntity entity = new StringEntity(
849+
"{ \"policy\":" + Strings.toString(builder) + "}", ContentType.APPLICATION_JSON);
850+
Request request = new Request("PUT", "_ilm/policy/shrink-only-policy");
851+
request.setEntity(entity);
852+
assertOK(client().performRequest(request));
853+
}
854+
838855
createIndexWithSettings(goodIndex, Settings.builder()
839856
.put(RolloverAction.LIFECYCLE_ROLLOVER_ALIAS, "alias")
840857
.put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0)
841858
.put(LifecycleSettings.LIFECYCLE_NAME, policy)
842859
);
843860
createIndexWithSettingsNoAlias(errorIndex, Settings.builder()
844861
.put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0)
845-
.put(LifecycleSettings.LIFECYCLE_NAME, policy)
862+
.put(LifecycleSettings.LIFECYCLE_NAME, "shrink-only-policy")
846863
);
847864
createIndexWithSettingsNoAlias(nonexistantPolicyIndex, Settings.builder()
848865
.put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0)

0 commit comments

Comments
 (0)