[ML] Document test problem and make it slightly less likely
Relates elastic/x-pack-elasticsearch#689
This does NOT fix the problem, but makes it clearer why it happens
and, by changing ordering, should make it happen less often
Original commit: elastic/x-pack-elasticsearch@9ef60073c2a3f1329e765dd8f23c1833d30b76fe
@@ -93,10 +93,6 @@ setup:
job_id: farequote2
- match: { closed: true }
-
- - do:
- indices.refresh: {}
-
- do:
indices.exists:
index: ".ml-anomalies-farequote"
@@ -107,6 +103,9 @@ setup:
index: ".ml-anomalies-farequote"
- is_true: ''
+ - do:
+ indices.refresh: {}
+
- do:
count:
index: .ml-anomalies-shared
@@ -164,14 +163,18 @@ setup:
job_id: "farequote"
- match: { acknowledged: true }
- - do:
- indices.refresh: {}
+ # TODO: delete_job is asynchronous and returns before all job results are deleted - ideally
+ # we'd have a way to wait for delete_job to finish its work, but for now just assert some
+ # other things before refreshing the indexes to give time for delete_job to do its work
- do:
indices.exists:
index: ".ml-anomalies-shared"
- is_true: ''
+ - do:
+ indices.refresh: {}
+
- do:
count:
index: .ml-anomalies-shared
@@ -218,8 +221,9 @@ setup:
job_id: "farequote2"
- match: { acknowledged: true }
- - do:
- indices.refresh: {}
+ # TODO: delete_job is asynchronous and returns before all job results are deleted - ideally
+ # we'd have a way to wait for delete_job to finish its work, but for now just assert some
+ # other things before refreshing the indexes to give time for delete_job to do its work
- do:
indices.exists:
@@ -236,6 +240,9 @@ setup:
index: ".ml-anomalies-farequote2"
- is_false: ''
+ - do:
+ indices.refresh: {}
+
- do:
count:
index: .ml-anomalies-shared
@@ -323,6 +330,25 @@ setup:
job_id: "farequote"
- match: { acknowledged: true }
+ # TODO: delete_job is asynchronous and returns before all job results are deleted - ideally
+ # we'd have a way to wait for delete_job to finish its work, but for now just assert some
+ # other things before refreshing the indexes to give time for delete_job to do its work
+
+ - do:
+ indices.exists:
+ index: ".ml-anomalies-shared"
+ - is_true: ''
+
+ - do:
+ indices.exists:
+ index: ".ml-anomalies-foo"
+ - is_true: ''
+
+ - do:
+ indices.exists:
+ index: "foo"
+ - is_true: ''
+
- do:
indices.refresh: {}
@@ -341,5 +367,3 @@ setup:
index: .ml-anomalies-foo
- match: {count: 2}
-
-
