Skip to content

Commit 9830306

Browse files
committed
[ML] Future proof index names in REST tests (elastic#136458)
Some ML REST tests make explicit reference to the AD results index, making the assumption that the index name will be `.ml-anomalies-shared`. This may not always be the case going forward in which cae REST compatibility tests will break. The bulk of the references can be handled by the yamlRestCompatTest transformation rules but a small number must be manually rewritten.
1 parent 71d54f4 commit 9830306

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/ml/custom_all_field.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ setup:
7575
headers:
7676
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
7777
indices.refresh:
78-
index: [.ml-anomalies-shared]
78+
index: [.ml-anomalies*]
7979

8080
---
8181
"Test querying custom all field":
@@ -148,7 +148,7 @@ setup:
148148

149149
- do:
150150
search:
151-
index: .ml-anomalies-shared
151+
index: .ml-anomalies-custom-all-test-1,.ml-anomalies-custom-all-test-2
152152
expand_wildcards: all
153153
rest_total_hits_as_int: true
154154
body: { query: { bool: { must: [

x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/ml/jobs_get_stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ setup:
444444

445445
# With the index closed the low level ML API reports a problem
446446
- do:
447-
catch: /type=cluster_block_exception, reason=index \[.ml-anomalies-shared\] blocked by. \[FORBIDDEN\/.\/index closed\]/
447+
catch: /type=cluster_block_exception, reason=index \[.ml-anomalies-shared.*?\] blocked by. \[FORBIDDEN\/.\/index closed\]/
448448
ml.get_job_stats: {}
449449

450450
# But the high level X-Pack API returns what it can - we do this

x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/ml/upgrade_job_snapshot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ setup:
6060
headers:
6161
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
6262
indices.refresh:
63-
index: [.ml-anomalies-shared,.ml-state-000001]
63+
index: [.ml-anomalies*,.ml-state-000001]
6464

6565
---
6666
"Test with unknown job id":

0 commit comments

Comments
 (0)