Skip to content

Commit ad75481

Browse files
authored
[ML] Future proof index names in REST tests (#136458) (#136786)
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 c28a887 commit ad75481

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
@@ -440,7 +440,7 @@ setup:
440440

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

446446
# 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)