From beaec5cca9db6c50bd5c8b1a54106023e321bd54 Mon Sep 17 00:00:00 2001 From: Przemko Robakowski Date: Mon, 9 Mar 2020 20:59:44 +0100 Subject: [PATCH 1/2] Change assertion in TimeSeriesLifecycleActionsIT#testHistoryIsWrittenWithFailure This change modifies `testHistoryIsWrittenWithFailure` to check if there was retry of failed step (through checking `failed_step_retry_count`) instead of looking for `ERROR` step itself. As ILM oscillates between `ERROR` and retried step it's possible we never hit `ERROR` itself, especially with backoff in `assertBusy`. `failed_step_retry_count` is monotonically increasing so assertion will eventually pass. --- .../elasticsearch/xpack/ilm/TimeSeriesLifecycleActionsIT.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/plugin/ilm/qa/multi-node/src/test/java/org/elasticsearch/xpack/ilm/TimeSeriesLifecycleActionsIT.java b/x-pack/plugin/ilm/qa/multi-node/src/test/java/org/elasticsearch/xpack/ilm/TimeSeriesLifecycleActionsIT.java index 00414b20679e3..3ae8ef94c3a18 100644 --- a/x-pack/plugin/ilm/qa/multi-node/src/test/java/org/elasticsearch/xpack/ilm/TimeSeriesLifecycleActionsIT.java +++ b/x-pack/plugin/ilm/qa/multi-node/src/test/java/org/elasticsearch/xpack/ilm/TimeSeriesLifecycleActionsIT.java @@ -29,7 +29,6 @@ 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.ErrorStep; import org.elasticsearch.xpack.core.ilm.ForceMergeAction; import org.elasticsearch.xpack.core.ilm.FreezeAction; import org.elasticsearch.xpack.core.ilm.FreezeStep; @@ -1406,7 +1405,8 @@ public void testHistoryIsWrittenWithFailure() throws Exception { Request refreshIndex = new Request("POST", "/" + index + "-1/_refresh"); client().performRequest(refreshIndex); - assertBusy(() -> assertThat(getStepKeyForIndex(index + "-1").getName(), equalTo(ErrorStep.NAME)), 30, TimeUnit.SECONDS); + // Check that we've had error and auto retry + assertBusy(() -> assertThat((Integer) explainIndex(index + "-1").get("failed_step_retry_count"), greaterThanOrEqualTo(1))); assertBusy(() -> assertHistoryIsPresent(policy, index + "-1", false, "ERROR"), 30, TimeUnit.SECONDS); } From 499506c83c842d135cf5a43382dbf643faecbd52 Mon Sep 17 00:00:00 2001 From: Przemko Robakowski Date: Mon, 9 Mar 2020 21:11:38 +0100 Subject: [PATCH 2/2] spelling fix --- .../elasticsearch/xpack/ilm/TimeSeriesLifecycleActionsIT.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugin/ilm/qa/multi-node/src/test/java/org/elasticsearch/xpack/ilm/TimeSeriesLifecycleActionsIT.java b/x-pack/plugin/ilm/qa/multi-node/src/test/java/org/elasticsearch/xpack/ilm/TimeSeriesLifecycleActionsIT.java index 3ae8ef94c3a18..bbdd1a797c38b 100644 --- a/x-pack/plugin/ilm/qa/multi-node/src/test/java/org/elasticsearch/xpack/ilm/TimeSeriesLifecycleActionsIT.java +++ b/x-pack/plugin/ilm/qa/multi-node/src/test/java/org/elasticsearch/xpack/ilm/TimeSeriesLifecycleActionsIT.java @@ -1405,7 +1405,7 @@ public void testHistoryIsWrittenWithFailure() throws Exception { Request refreshIndex = new Request("POST", "/" + index + "-1/_refresh"); client().performRequest(refreshIndex); - // Check that we've had error and auto retry + // Check that we've had error and auto retried assertBusy(() -> assertThat((Integer) explainIndex(index + "-1").get("failed_step_retry_count"), greaterThanOrEqualTo(1))); assertBusy(() -> assertHistoryIsPresent(policy, index + "-1", false, "ERROR"), 30, TimeUnit.SECONDS);