From dedbc2367903c8c556784d96c858396db1d287eb Mon Sep 17 00:00:00 2001 From: Ed Savage Date: Mon, 20 Oct 2025 09:37:47 +1300 Subject: [PATCH] [ML] Future proof index names in REST tests (#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. --- .../resources/rest-api-spec/test/ml/custom_all_field.yml | 4 ++-- .../resources/rest-api-spec/test/ml/jobs_get_stats.yml | 2 +- .../resources/rest-api-spec/test/ml/upgrade_job_snapshot.yml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/ml/custom_all_field.yml b/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/ml/custom_all_field.yml index eefd9b937cbec..f3a22120d2036 100644 --- a/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/ml/custom_all_field.yml +++ b/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/ml/custom_all_field.yml @@ -75,7 +75,7 @@ setup: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser indices.refresh: - index: [.ml-anomalies-shared] + index: [.ml-anomalies*] --- "Test querying custom all field": @@ -148,7 +148,7 @@ setup: - do: search: - index: .ml-anomalies-shared + index: .ml-anomalies-custom-all-test-1,.ml-anomalies-custom-all-test-2 expand_wildcards: all rest_total_hits_as_int: true body: { query: { bool: { must: [ diff --git a/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/ml/jobs_get_stats.yml b/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/ml/jobs_get_stats.yml index ab4c7311d8302..cc44d69e39bab 100644 --- a/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/ml/jobs_get_stats.yml +++ b/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/ml/jobs_get_stats.yml @@ -444,7 +444,7 @@ setup: # With the index closed the low level ML API reports a problem - do: - catch: /type=cluster_block_exception, reason=index \[.ml-anomalies-shared\] blocked by. \[FORBIDDEN\/.\/index closed\]/ + catch: /type=cluster_block_exception, reason=index \[.ml-anomalies-shared.*?\] blocked by. \[FORBIDDEN\/.\/index closed\]/ ml.get_job_stats: {} # But the high level X-Pack API returns what it can - we do this diff --git a/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/ml/upgrade_job_snapshot.yml b/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/ml/upgrade_job_snapshot.yml index e0281880f0f95..fc85a95ea0886 100644 --- a/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/ml/upgrade_job_snapshot.yml +++ b/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/ml/upgrade_job_snapshot.yml @@ -60,7 +60,7 @@ setup: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser indices.refresh: - index: [.ml-anomalies-shared,.ml-state-000001] + index: [.ml-anomalies*,.ml-state-000001] --- "Test with unknown job id":