Browse Source

[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
Tal Levy 6 years ago
parent
commit
06dfd4aadc

+ 2 - 2
x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/WaitForRolloverReadyStepTests.java

@@ -81,10 +81,10 @@ public class WaitForRolloverReadyStepTests extends AbstractStepTestCase<WaitForR
                 });
                 break;
             case 3:
-                maxAge = TimeValue.parseTimeValue(randomPositiveTimeValue(), "rollover_action_test");
+                maxAge = randomValueOtherThan(maxAge, () -> TimeValue.parseTimeValue(randomPositiveTimeValue(), "rollover_action_test"));
                 break;
             case 4:
-                maxDocs = randomNonNegativeLong();
+                maxDocs = randomValueOtherThan(maxDocs, () -> randomNonNegativeLong());
                 break;
             default:
                 throw new AssertionError("Illegal randomisation branch");

+ 0 - 48
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