From 06dfd4aadc628b85cd36aa16f3b9129f470a6eba Mon Sep 17 00:00:00 2001 From: Tal Levy Date: Fri, 14 Dec 2018 11:36:18 -0800 Subject: [PATCH] [TEST] fix flaky ILM tests (#36612) * WaitForRolloverReadyStepTests#mutateInstance sometimes did not mutate the instance correctly * 40_explain_lifecycle#"Test new phase still has phase_time" is not really a necessary integration test. In addition to this, it is flaky due to the asynchronous nature of ILM metadata population --- .../WaitForRolloverReadyStepTests.java | 4 +- .../test/ilm/40_explain_lifecycle.yml | 48 ------------------- 2 files changed, 2 insertions(+), 50 deletions(-) diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/WaitForRolloverReadyStepTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/WaitForRolloverReadyStepTests.java index f7378278ffb..46acda7fdeb 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/WaitForRolloverReadyStepTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/WaitForRolloverReadyStepTests.java @@ -81,10 +81,10 @@ public class WaitForRolloverReadyStepTests extends AbstractStepTestCase TimeValue.parseTimeValue(randomPositiveTimeValue(), "rollover_action_test")); break; case 4: - maxDocs = randomNonNegativeLong(); + maxDocs = randomValueOtherThan(maxDocs, () -> randomNonNegativeLong()); break; default: throw new AssertionError("Illegal randomisation branch"); diff --git a/x-pack/plugin/ilm/qa/rest/src/test/resources/rest-api-spec/test/ilm/40_explain_lifecycle.yml b/x-pack/plugin/ilm/qa/rest/src/test/resources/rest-api-spec/test/ilm/40_explain_lifecycle.yml index 8c8206d8611..dff5ed955ff 100644 --- a/x-pack/plugin/ilm/qa/rest/src/test/resources/rest-api-spec/test/ilm/40_explain_lifecycle.yml +++ b/x-pack/plugin/ilm/qa/rest/src/test/resources/rest-api-spec/test/ilm/40_explain_lifecycle.yml @@ -213,51 +213,3 @@ teardown: - is_false: indices.my_index - is_false: indices.my_index2 - is_false: indices.another_index - ---- -"Test new phase still has phase_time": - - - do: - ilm.put_lifecycle: - policy: "mypolicy" - body: | - { - "policy": { - "phases": { - "hot": { - "min_age": "1000s", - "actions": {} - }, - "warm": { - "min_age": "2000s", - "actions": { - "forcemerge": { - "max_num_segments": 10000 - } - } - } - } - } - } - - - do: - indices.create: - index: foo - body: - settings: - index.lifecycle.name: "mypolicy" - - - do: - ilm.explain_lifecycle: - index: "foo" - - - is_true: indices.foo.managed - - match: { indices.foo.index: "foo" } - - match: { indices.foo.policy: "mypolicy" } - - match: { indices.foo.phase: "new" } - - match: { indices.foo.action: "complete" } - - match: { indices.foo.step: "complete" } - - is_true: indices.foo.phase_time_millis - - is_false: indices.foo.failed_step - - is_false: indices.foo.step_info - - is_false: indices.foo.phase_execution