ILM fix retry delete action test (#54809) (#54895)

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

(cherry picked from commit 99a6d57aeb3cf11abc38b514f38a96bb1612e357)
Signed-off-by: Andrei Dan <andrei.dan@elastic.co>
This commit is contained in:
Andrei Dan 2020-04-07 15:55:56 +01:00 committed by GitHub
parent 72f8457f52
commit bbc57828c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 15 deletions

View File

@ -30,10 +30,8 @@ import org.elasticsearch.snapshots.SnapshotState;
import org.elasticsearch.test.rest.ESRestTestCase;
import org.elasticsearch.xpack.core.ilm.AllocateAction;
import org.elasticsearch.xpack.core.ilm.DeleteAction;
import org.elasticsearch.xpack.core.ilm.DeleteStep;
import org.elasticsearch.xpack.core.ilm.ForceMergeAction;
import org.elasticsearch.xpack.core.ilm.FreezeAction;
import org.elasticsearch.xpack.core.ilm.FreezeStep;
import org.elasticsearch.xpack.core.ilm.InitializePolicyContextStep;
import org.elasticsearch.xpack.core.ilm.LifecycleAction;
import org.elasticsearch.xpack.core.ilm.LifecyclePolicy;
@ -211,22 +209,19 @@ public class TimeSeriesLifecycleActionsIT extends ESRestTestCase {
assertBusy(() -> assertFalse(indexExists(shrunkenOriginalIndex)));
}
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/53738")
public void testRetryFailedDeleteAction() throws Exception {
createNewSingletonPolicy("delete", new DeleteAction());
createIndexWithSettings(index, Settings.builder()
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
.put(IndexMetadata.SETTING_READ_ONLY_ALLOW_DELETE, false));
.put(IndexMetadata.SETTING_READ_ONLY, true)
.put("index.lifecycle.name", policy));
createNewSingletonPolicy("delete", new DeleteAction());
Request request = new Request("PUT", index + "/_settings");
request.setJsonEntity("{\"index.blocks.read_only\": true, \"index.lifecycle.name\": \"" + policy + "\"}");
assertOK(client().performRequest(request));
assertBusy(() -> assertThat(getFailedStepForIndex(index), equalTo(DeleteStep.NAME)));
assertBusy(() -> assertThat((Integer) explainIndex(index).get(FAILED_STEP_RETRY_COUNT_FIELD), greaterThanOrEqualTo(1)), 30,
TimeUnit.SECONDS);
assertTrue(indexExists(index));
Request request = new Request("PUT", index + "/_settings");
request.setJsonEntity("{\"index.blocks.read_only\":false}");
assertOK(client().performRequest(request));
@ -242,7 +237,8 @@ public class TimeSeriesLifecycleActionsIT extends ESRestTestCase {
.put(IndexMetadata.SETTING_READ_ONLY, true)
.put("index.lifecycle.name", policy));
assertBusy(() -> assertThat(getFailedStepForIndex(index), equalTo(FreezeStep.NAME)));
assertBusy(() -> assertThat((Integer) explainIndex(index).get(FAILED_STEP_RETRY_COUNT_FIELD), greaterThanOrEqualTo(1)), 30,
TimeUnit.SECONDS);
assertFalse(getOnlyIndexSettings(index).containsKey("index.frozen"));
Request request = new Request("PUT", index + "/_settings");
@ -287,7 +283,6 @@ public class TimeSeriesLifecycleActionsIT extends ESRestTestCase {
expectThrows(ResponseException.class, this::indexDocument);
}
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/53738")
public void testRolloverAction() throws Exception {
String originalIndex = index + "-000001";
String secondIndex = index + "-000002";
@ -306,7 +301,6 @@ public class TimeSeriesLifecycleActionsIT extends ESRestTestCase {
assertBusy(() -> assertEquals("true", getOnlyIndexSettings(originalIndex).get(LifecycleSettings.LIFECYCLE_INDEXING_COMPLETE)));
}
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/53738")
public void testRolloverActionWithIndexingComplete() throws Exception {
String originalIndex = index + "-000001";
String secondIndex = index + "-000002";
@ -768,7 +762,6 @@ public class TimeSeriesLifecycleActionsIT extends ESRestTestCase {
assertThat(e.getResponse().getStatusLine().getStatusCode(), equalTo(404));
}
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/53738")
public void testSetPriority() throws Exception {
createIndexWithSettings(index, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0).put(IndexMetadata.INDEX_PRIORITY_SETTING.getKey(), 100));
@ -1917,6 +1910,7 @@ public class TimeSeriesLifecycleActionsIT extends ESRestTestCase {
return new StepKey(phase, action, step);
}
@Nullable
private String getFailedStepForIndex(String indexName) throws IOException {
Map<String, Object> indexResponse = explainIndex(indexName);
if (indexResponse == null) {