From 4a3dae62e30b8b721d4733d262b45d059ead3707 Mon Sep 17 00:00:00 2001 From: Tal Levy Date: Tue, 30 Oct 2018 21:12:44 -0700 Subject: [PATCH 1/6] update IT poll interval to 1s --- x-pack/plugin/ilm/qa/multi-node/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugin/ilm/qa/multi-node/build.gradle b/x-pack/plugin/ilm/qa/multi-node/build.gradle index d8dbb2f130fe5..edd7f3aad472e 100644 --- a/x-pack/plugin/ilm/qa/multi-node/build.gradle +++ b/x-pack/plugin/ilm/qa/multi-node/build.gradle @@ -15,6 +15,6 @@ integTestCluster { setting 'xpack.monitoring.enabled', 'false' setting 'xpack.ml.enabled', 'false' setting 'xpack.license.self_generated.type', 'trial' - setting 'indices.lifecycle.poll_interval', '2500ms' + setting 'indices.lifecycle.poll_interval', '1000ms' } From d67c3e86d6ad27f016628b5d97a4dbbdec15524d Mon Sep 17 00:00:00 2001 From: Tal Levy Date: Tue, 30 Oct 2018 21:25:34 -0700 Subject: [PATCH 2/6] add logging --- .../indexlifecycle/TimeSeriesLifecycleActionsIT.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/x-pack/plugin/ilm/qa/multi-node/src/test/java/org/elasticsearch/xpack/indexlifecycle/TimeSeriesLifecycleActionsIT.java b/x-pack/plugin/ilm/qa/multi-node/src/test/java/org/elasticsearch/xpack/indexlifecycle/TimeSeriesLifecycleActionsIT.java index c06b30cf575e4..87b7b713d836d 100644 --- a/x-pack/plugin/ilm/qa/multi-node/src/test/java/org/elasticsearch/xpack/indexlifecycle/TimeSeriesLifecycleActionsIT.java +++ b/x-pack/plugin/ilm/qa/multi-node/src/test/java/org/elasticsearch/xpack/indexlifecycle/TimeSeriesLifecycleActionsIT.java @@ -84,7 +84,14 @@ public void testFullPolicy() throws Exception { index(client(), originalIndex, "_id", "foo", "bar"); assertBusy(() -> assertTrue(indexExists(secondIndex))); assertBusy(() -> assertFalse(indexExists(shrunkenOriginalIndex))); - assertBusy(() -> assertFalse(indexExists(originalIndex))); + assertBusy(() -> { + try { + StepKey key = getStepKeyForIndex(originalIndex); + logger.error("TRACE: ILM key [" + key + "]"); + } catch (Exception e) { + } + assertFalse(indexExists(originalIndex)); + }); } public void testMoveToAllocateStep() throws Exception { From 2278a166174c7b5ea3ba59e6c65010331b801aec Mon Sep 17 00:00:00 2001 From: Tal Levy Date: Tue, 30 Oct 2018 21:34:49 -0700 Subject: [PATCH 3/6] re-order check since original index is gone before shrunken --- .../indexlifecycle/TimeSeriesLifecycleActionsIT.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/x-pack/plugin/ilm/qa/multi-node/src/test/java/org/elasticsearch/xpack/indexlifecycle/TimeSeriesLifecycleActionsIT.java b/x-pack/plugin/ilm/qa/multi-node/src/test/java/org/elasticsearch/xpack/indexlifecycle/TimeSeriesLifecycleActionsIT.java index 87b7b713d836d..5a548ad8ed424 100644 --- a/x-pack/plugin/ilm/qa/multi-node/src/test/java/org/elasticsearch/xpack/indexlifecycle/TimeSeriesLifecycleActionsIT.java +++ b/x-pack/plugin/ilm/qa/multi-node/src/test/java/org/elasticsearch/xpack/indexlifecycle/TimeSeriesLifecycleActionsIT.java @@ -83,15 +83,24 @@ public void testFullPolicy() throws Exception { // index document {"foo": "bar"} to trigger rollover index(client(), originalIndex, "_id", "foo", "bar"); assertBusy(() -> assertTrue(indexExists(secondIndex))); - assertBusy(() -> assertFalse(indexExists(shrunkenOriginalIndex))); assertBusy(() -> { try { StepKey key = getStepKeyForIndex(originalIndex); logger.error("TRACE: ILM key [" + key + "]"); } catch (Exception e) { + // do nothing } assertFalse(indexExists(originalIndex)); }); + assertBusy(() -> { + try { + StepKey key = getStepKeyForIndex(originalIndex); + logger.error("TRACE: ILM key [" + key + "]"); + } catch (Exception e) { + // do nothing + } + assertFalse(indexExists(shrunkenOriginalIndex)); + }); } public void testMoveToAllocateStep() throws Exception { From 30df5e553bf3c0c81ea8ee54a9d5b76e8b416996 Mon Sep 17 00:00:00 2001 From: Tal Levy Date: Wed, 31 Oct 2018 10:53:42 -0700 Subject: [PATCH 4/6] remove logging --- .../TimeSeriesLifecycleActionsIT.java | 22 +++---------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/x-pack/plugin/ilm/qa/multi-node/src/test/java/org/elasticsearch/xpack/indexlifecycle/TimeSeriesLifecycleActionsIT.java b/x-pack/plugin/ilm/qa/multi-node/src/test/java/org/elasticsearch/xpack/indexlifecycle/TimeSeriesLifecycleActionsIT.java index 5a548ad8ed424..1deafefd54b1a 100644 --- a/x-pack/plugin/ilm/qa/multi-node/src/test/java/org/elasticsearch/xpack/indexlifecycle/TimeSeriesLifecycleActionsIT.java +++ b/x-pack/plugin/ilm/qa/multi-node/src/test/java/org/elasticsearch/xpack/indexlifecycle/TimeSeriesLifecycleActionsIT.java @@ -83,24 +83,8 @@ public void testFullPolicy() throws Exception { // index document {"foo": "bar"} to trigger rollover index(client(), originalIndex, "_id", "foo", "bar"); assertBusy(() -> assertTrue(indexExists(secondIndex))); - assertBusy(() -> { - try { - StepKey key = getStepKeyForIndex(originalIndex); - logger.error("TRACE: ILM key [" + key + "]"); - } catch (Exception e) { - // do nothing - } - assertFalse(indexExists(originalIndex)); - }); - assertBusy(() -> { - try { - StepKey key = getStepKeyForIndex(originalIndex); - logger.error("TRACE: ILM key [" + key + "]"); - } catch (Exception e) { - // do nothing - } - assertFalse(indexExists(shrunkenOriginalIndex)); - }); + assertBusy(() -> assertFalse(indexExists(originalIndex))); + assertBusy(() -> assertFalse(indexExists(shrunkenOriginalIndex))); } public void testMoveToAllocateStep() throws Exception { @@ -167,8 +151,8 @@ public void testMoveToRolloverStep() throws Exception { "}"); client().performRequest(moveToStepRequest); assertBusy(() -> assertTrue(indexExists(secondIndex))); - assertBusy(() -> assertFalse(indexExists(shrunkenOriginalIndex))); assertBusy(() -> assertFalse(indexExists(originalIndex))); + assertBusy(() -> assertFalse(indexExists(shrunkenOriginalIndex))); } public void testRolloverAction() throws Exception { From 638c2739245402faccb73d4026ab692e5ef89964 Mon Sep 17 00:00:00 2001 From: Tal Levy Date: Wed, 31 Oct 2018 11:36:56 -0700 Subject: [PATCH 5/6] add docs to the asserts --- .../xpack/indexlifecycle/TimeSeriesLifecycleActionsIT.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/x-pack/plugin/ilm/qa/multi-node/src/test/java/org/elasticsearch/xpack/indexlifecycle/TimeSeriesLifecycleActionsIT.java b/x-pack/plugin/ilm/qa/multi-node/src/test/java/org/elasticsearch/xpack/indexlifecycle/TimeSeriesLifecycleActionsIT.java index 1deafefd54b1a..82164e7701a96 100644 --- a/x-pack/plugin/ilm/qa/multi-node/src/test/java/org/elasticsearch/xpack/indexlifecycle/TimeSeriesLifecycleActionsIT.java +++ b/x-pack/plugin/ilm/qa/multi-node/src/test/java/org/elasticsearch/xpack/indexlifecycle/TimeSeriesLifecycleActionsIT.java @@ -82,8 +82,11 @@ public void testFullPolicy() throws Exception { updatePolicy(originalIndex, policy); // index document {"foo": "bar"} to trigger rollover index(client(), originalIndex, "_id", "foo", "bar"); + // asserts that rollover was called assertBusy(() -> assertTrue(indexExists(secondIndex))); + // asserts that shrink deleted the original index assertBusy(() -> assertFalse(indexExists(originalIndex))); + // asserts that the delete phase completed for the managed shrunken index assertBusy(() -> assertFalse(indexExists(shrunkenOriginalIndex))); } @@ -150,8 +153,11 @@ public void testMoveToRolloverStep() throws Exception { " }\n" + "}"); client().performRequest(moveToStepRequest); + // asserts that rollover was called assertBusy(() -> assertTrue(indexExists(secondIndex))); + // asserts that shrink deleted the original index assertBusy(() -> assertFalse(indexExists(originalIndex))); + // asserts that the delete phase completed for the managed shrunken index assertBusy(() -> assertFalse(indexExists(shrunkenOriginalIndex))); } From 1621e281d87e214e601b894994739c9a47d1b2ad Mon Sep 17 00:00:00 2001 From: Tal Levy Date: Wed, 31 Oct 2018 13:53:53 -0700 Subject: [PATCH 6/6] add more context to ordering of asserts --- .../TimeSeriesLifecycleActionsIT.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/x-pack/plugin/ilm/qa/multi-node/src/test/java/org/elasticsearch/xpack/indexlifecycle/TimeSeriesLifecycleActionsIT.java b/x-pack/plugin/ilm/qa/multi-node/src/test/java/org/elasticsearch/xpack/indexlifecycle/TimeSeriesLifecycleActionsIT.java index 82164e7701a96..352f52bd1aa7a 100644 --- a/x-pack/plugin/ilm/qa/multi-node/src/test/java/org/elasticsearch/xpack/indexlifecycle/TimeSeriesLifecycleActionsIT.java +++ b/x-pack/plugin/ilm/qa/multi-node/src/test/java/org/elasticsearch/xpack/indexlifecycle/TimeSeriesLifecycleActionsIT.java @@ -82,6 +82,13 @@ public void testFullPolicy() throws Exception { updatePolicy(originalIndex, policy); // index document {"foo": "bar"} to trigger rollover index(client(), originalIndex, "_id", "foo", "bar"); + + /* + * These asserts are in the order that they should be satisfied in, in + * order to maximize the time for all operations to complete. + * An "out of order" assert here may result in this test occasionally + * timing out and failing inappropriately. + */ // asserts that rollover was called assertBusy(() -> assertTrue(indexExists(secondIndex))); // asserts that shrink deleted the original index @@ -153,6 +160,13 @@ public void testMoveToRolloverStep() throws Exception { " }\n" + "}"); client().performRequest(moveToStepRequest); + + /* + * These asserts are in the order that they should be satisfied in, in + * order to maximize the time for all operations to complete. + * An "out of order" assert here may result in this test occasionally + * timing out and failing inappropriately. + */ // asserts that rollover was called assertBusy(() -> assertTrue(indexExists(secondIndex))); // asserts that shrink deleted the original index