Skip to content

Commit 99a6d57

Browse files
authored
ILM fix retry delete action test (#54809)
Asserting on the failed_step field from the explainAPI can produce flakiness because the ILM state is moved back and forth between the (failing) step and the ERROR step (as the workflow is retry, fail then move to ERROR step, move back to the (failing) step, retry, fail, etc) and the failed_step information is only available whilst in the ERROR state. Unmute other tests as they were collateral failures A read-only index could not be deleted in the wipeCluster phase and caused these failures
1 parent f3f1b69 commit 99a6d57

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

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

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,8 @@
3030
import org.elasticsearch.test.rest.ESRestTestCase;
3131
import org.elasticsearch.xpack.core.ilm.AllocateAction;
3232
import org.elasticsearch.xpack.core.ilm.DeleteAction;
33-
import org.elasticsearch.xpack.core.ilm.DeleteStep;
3433
import org.elasticsearch.xpack.core.ilm.ForceMergeAction;
3534
import org.elasticsearch.xpack.core.ilm.FreezeAction;
36-
import org.elasticsearch.xpack.core.ilm.FreezeStep;
3735
import org.elasticsearch.xpack.core.ilm.InitializePolicyContextStep;
3836
import org.elasticsearch.xpack.core.ilm.LifecycleAction;
3937
import org.elasticsearch.xpack.core.ilm.LifecyclePolicy;
@@ -211,22 +209,19 @@ public void testMoveToRolloverStep() throws Exception {
211209
assertBusy(() -> assertFalse(indexExists(shrunkenOriginalIndex)));
212210
}
213211

214-
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/53738")
215212
public void testRetryFailedDeleteAction() throws Exception {
213+
createNewSingletonPolicy("delete", new DeleteAction());
216214
createIndexWithSettings(index, Settings.builder()
217215
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
218216
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
219-
.put(IndexMetadata.SETTING_READ_ONLY_ALLOW_DELETE, false));
220-
221-
createNewSingletonPolicy("delete", new DeleteAction());
222-
223-
Request request = new Request("PUT", index + "/_settings");
224-
request.setJsonEntity("{\"index.blocks.read_only\": true, \"index.lifecycle.name\": \"" + policy + "\"}");
225-
assertOK(client().performRequest(request));
217+
.put(IndexMetadata.SETTING_READ_ONLY, true)
218+
.put("index.lifecycle.name", policy));
226219

227-
assertBusy(() -> assertThat(getFailedStepForIndex(index), equalTo(DeleteStep.NAME)));
220+
assertBusy(() -> assertThat((Integer) explainIndex(index).get(FAILED_STEP_RETRY_COUNT_FIELD), greaterThanOrEqualTo(1)), 30,
221+
TimeUnit.SECONDS);
228222
assertTrue(indexExists(index));
229223

224+
Request request = new Request("PUT", index + "/_settings");
230225
request.setJsonEntity("{\"index.blocks.read_only\":false}");
231226
assertOK(client().performRequest(request));
232227

@@ -242,7 +237,8 @@ public void testRetryFreezeDeleteAction() throws Exception {
242237
.put(IndexMetadata.SETTING_READ_ONLY, true)
243238
.put("index.lifecycle.name", policy));
244239

245-
assertBusy(() -> assertThat(getFailedStepForIndex(index), equalTo(FreezeStep.NAME)));
240+
assertBusy(() -> assertThat((Integer) explainIndex(index).get(FAILED_STEP_RETRY_COUNT_FIELD), greaterThanOrEqualTo(1)), 30,
241+
TimeUnit.SECONDS);
246242
assertFalse(getOnlyIndexSettings(index).containsKey("index.frozen"));
247243

248244
Request request = new Request("PUT", index + "/_settings");
@@ -287,7 +283,6 @@ public void testRetryFailedShrinkAction() throws Exception {
287283
expectThrows(ResponseException.class, this::indexDocument);
288284
}
289285

290-
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/53738")
291286
public void testRolloverAction() throws Exception {
292287
String originalIndex = index + "-000001";
293288
String secondIndex = index + "-000002";
@@ -306,7 +301,6 @@ public void testRolloverAction() throws Exception {
306301
assertBusy(() -> assertEquals("true", getOnlyIndexSettings(originalIndex).get(LifecycleSettings.LIFECYCLE_INDEXING_COMPLETE)));
307302
}
308303

309-
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/53738")
310304
public void testRolloverActionWithIndexingComplete() throws Exception {
311305
String originalIndex = index + "-000001";
312306
String secondIndex = index + "-000002";
@@ -759,7 +753,6 @@ public void testFreezeDuringSnapshot() throws Exception {
759753
assertOK(client().performRequest(new Request("DELETE", "/_snapshot/repo/snapshot")));
760754
}
761755

762-
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/53738")
763756
public void testSetPriority() throws Exception {
764757
createIndexWithSettings(index, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
765758
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0).put(IndexMetadata.INDEX_PRIORITY_SETTING.getKey(), 100));
@@ -1912,6 +1905,7 @@ private static StepKey getStepKey(Map<String, Object> explainIndexResponse) {
19121905
return new StepKey(phase, action, step);
19131906
}
19141907

1908+
@Nullable
19151909
private String getFailedStepForIndex(String indexName) throws IOException {
19161910
Map<String, Object> indexResponse = explainIndex(indexName);
19171911
if (indexResponse == null) {

0 commit comments

Comments
 (0)