From c31b97fd0f6e7fdd7400111006f8db17245bc471 Mon Sep 17 00:00:00 2001 From: Mary Gouseti Date: Thu, 27 Mar 2025 13:56:01 +0200 Subject: [PATCH] Fix `p0=deprecation/10_basic/Test Deprecations` (#125687) In #120505 we introduced a capabilities check in the yaml test `deprecation/10_basic/Test Deprecations` but we forgot to add them in the `RestDeprecationInfoAction`. In this PR we add the capabilities which will enable the test and we make the test resilient to the warning that occurs when the `.security-7` index is present. --- .../xpack/deprecation/RestDeprecationInfoAction.java | 8 ++++++++ .../resources/rest-api-spec/test/deprecation/10_basic.yml | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/RestDeprecationInfoAction.java b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/RestDeprecationInfoAction.java index 235209243ee58..d08918b562667 100644 --- a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/RestDeprecationInfoAction.java +++ b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/RestDeprecationInfoAction.java @@ -17,11 +17,14 @@ import java.io.IOException; import java.util.List; +import java.util.Set; import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestDeprecationInfoAction extends BaseRestHandler { + private static final Set SUPPORTED_CAPABILITIES = Set.of("data_streams", "ilm_policies", "templates"); + @Override public List routes() { return List.of( @@ -53,4 +56,9 @@ private static RestChannelConsumer handleGet(final RestRequest request, NodeClie ); return channel -> client.execute(DeprecationInfoAction.INSTANCE, infoRequest, new RestToXContentListener<>(channel)); } + + @Override + public Set supportedCapabilities() { + return SUPPORTED_CAPABILITIES; + } } diff --git a/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/deprecation/10_basic.yml b/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/deprecation/10_basic.yml index 78015468ba673..92a48e737d453 100644 --- a/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/deprecation/10_basic.yml +++ b/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/deprecation/10_basic.yml @@ -11,9 +11,11 @@ setup: - method: GET path: /_migration/deprecations capabilities: [ data_streams, ilm_policies, templates ] - test_runner_features: capabilities + test_runner_features: [capabilities, allowed_warnings] reason: "Support for data streams, ILM policies and templates" - do: + allowed_warnings: + - "this request accesses system indices: [.security-7], but in a future major version, direct access to system indices will be prevented by default" migration.deprecations: index: "*" - length: { cluster_settings: 0 }