浏览代码

Migrate x-pack-deprecation REST tests (#131444) (#132750)

Lorenzo Dematté 2 月之前
父节点
当前提交
8b77912f45
共有 14 个文件被更改,包括 226 次插入149 次删除
  1. 0 2
      build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/RestrictedBuildApiService.java
  2. 41 0
      x-pack/plugin/deprecation/qa/build.gradle
  3. 46 0
      x-pack/plugin/deprecation/qa/common/src/main/java/org/elasticsearch/xpack/deprecation/DeprecationSettings.java
  4. 20 0
      x-pack/plugin/deprecation/qa/deprecation-plugin/build.gradle
  5. 1 1
      x-pack/plugin/deprecation/qa/deprecation-plugin/src/main/java/org/elasticsearch/xpack/deprecation/plugin/TestDeprecatedQueryBuilder.java
  6. 9 35
      x-pack/plugin/deprecation/qa/deprecation-plugin/src/main/java/org/elasticsearch/xpack/deprecation/plugin/TestDeprecationHeaderRestAction.java
  7. 5 6
      x-pack/plugin/deprecation/qa/deprecation-plugin/src/main/java/org/elasticsearch/xpack/deprecation/plugin/TestDeprecationPlugin.java
  8. 22 0
      x-pack/plugin/deprecation/qa/early-deprecation-plugin/build.gradle
  9. 1 1
      x-pack/plugin/deprecation/qa/early-deprecation-plugin/src/main/java/org/elasticsearch/xpack/deprecation/earlyplugin/EarlyDeprecationTestPlugin.java
  10. 0 48
      x-pack/plugin/deprecation/qa/early-deprecation-rest/build.gradle
  11. 0 44
      x-pack/plugin/deprecation/qa/rest/build.gradle
  12. 32 12
      x-pack/plugin/deprecation/qa/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/DeprecationHttpIT.java
  13. 24 0
      x-pack/plugin/deprecation/qa/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/EarlyDeprecationIndexingIT.java
  14. 25 0
      x-pack/plugin/deprecation/qa/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/MlDeprecationIT.java

+ 0 - 2
build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/RestrictedBuildApiService.java

@@ -56,8 +56,6 @@ public abstract class RestrictedBuildApiService implements BuildService<Restrict
         map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:third-party:jira");
         map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:third-party:pagerduty");
         map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:third-party:slack");
-        map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:deprecation:qa:early-deprecation-rest");
-        map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:deprecation:qa:rest");
         map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:downsample:qa:with-security");
         map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:ent-search:qa:rest");
         map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:eql:qa:ccs-rolling-upgrade");

+ 41 - 0
x-pack/plugin/deprecation/qa/build.gradle

@@ -0,0 +1,41 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0; you may not use this file except in compliance with the Elastic License
+ * 2.0.
+ */
+
+apply plugin: 'elasticsearch.internal-java-rest-test'
+// Necessary to use tests in Serverless
+apply plugin: 'elasticsearch.internal-test-artifact'
+
+dependencies {
+  javaRestTestImplementation project(path: ':x-pack:plugin:deprecation:qa:common')
+  javaRestTestImplementation("com.fasterxml.jackson.core:jackson-annotations:${versions.jackson}")
+  javaRestTestImplementation("com.fasterxml.jackson.core:jackson-databind:${versions.jackson}")
+
+  clusterModules project(':x-pack:plugin:deprecation:qa::early-deprecation-plugin')
+  clusterModules project(':x-pack:plugin:deprecation:qa::deprecation-plugin')
+  clusterModules project(':modules:ingest-common')
+  clusterModules project(':modules:mapper-extras')
+  clusterModules project(':modules:data-streams')
+  clusterModules project(xpackModule('stack'))
+  clusterModules project(xpackModule('deprecation'))
+  clusterModules project(xpackModule('ilm'))
+  clusterModules project(xpackModule('ml'))
+  clusterModules project(xpackModule('mapper-constant-keyword'))
+  clusterModules project(xpackModule('wildcard'))
+  clusterModules project(xpackModule('transform'))
+}
+
+restResources {
+  restApi {
+    include '_common', 'indices', 'index'
+  }
+}
+
+// Test clusters run with security disabled
+tasks.named("javaRestTest") {
+  buildParams.withFipsEnabledOnly(it)
+}
+

+ 46 - 0
x-pack/plugin/deprecation/qa/common/src/main/java/org/elasticsearch/xpack/deprecation/DeprecationSettings.java

@@ -0,0 +1,46 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0; you may not use this file except in compliance with the Elastic License
+ * 2.0.
+ */
+
+package org.elasticsearch.xpack.deprecation;
+
+import org.elasticsearch.common.settings.Setting;
+
+public class DeprecationSettings {
+    public static final Setting<Boolean> TEST_DEPRECATED_SETTING_TRUE1 = Setting.boolSetting(
+        "test.setting.deprecated.true1",
+        true,
+        Setting.Property.NodeScope,
+        Setting.Property.DeprecatedWarning,
+        Setting.Property.Dynamic
+    );
+    public static final Setting<Boolean> TEST_DEPRECATED_SETTING_TRUE2 = Setting.boolSetting(
+        "test.setting.deprecated.true2",
+        true,
+        Setting.Property.NodeScope,
+        Setting.Property.DeprecatedWarning,
+        Setting.Property.Dynamic
+    );
+    public static final Setting<Boolean> TEST_DEPRECATED_SETTING_TRUE3 = Setting.boolSetting(
+        "test.setting.deprecated.true3",
+        true,
+        Setting.Property.NodeScope,
+        Setting.Property.Deprecated,
+        Setting.Property.Dynamic
+    );
+    public static final Setting<Boolean> TEST_NOT_DEPRECATED_SETTING = Setting.boolSetting(
+        "test.setting.not_deprecated",
+        false,
+        Setting.Property.NodeScope,
+        Setting.Property.Dynamic
+    );
+
+    public static final String DEPRECATED_ENDPOINT = "[/_test_cluster/deprecated_settings] exists for deprecated tests";
+    public static final String DEPRECATED_USAGE = "[deprecated_settings] usage is deprecated. use [settings] instead";
+    public static final String DEPRECATED_WARN_USAGE =
+        "[deprecated_warn_settings] usage is deprecated but won't be breaking in next version";
+    public static final String COMPATIBLE_API_USAGE = "You are using a compatible API for this request";
+}

+ 20 - 0
x-pack/plugin/deprecation/qa/deprecation-plugin/build.gradle

@@ -0,0 +1,20 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0; you may not use this file except in compliance with the Elastic License
+ * 2.0.
+ */
+
+apply plugin: 'elasticsearch.base-internal-es-plugin'
+apply plugin: 'elasticsearch.build'
+
+esplugin {
+  name = 'deprecation-plugin'
+  description = 'Deprecated query plugin'
+  classname ='org.elasticsearch.xpack.deprecation.plugin.TestDeprecationPlugin'
+}
+
+dependencies {
+  compileOnly project(":server")
+  implementation project(':x-pack:plugin:deprecation:qa::common')
+}

+ 1 - 1
x-pack/plugin/deprecation/qa/rest/src/main/java/org/elasticsearch/xpack/deprecation/TestDeprecatedQueryBuilder.java → x-pack/plugin/deprecation/qa/deprecation-plugin/src/main/java/org/elasticsearch/xpack/deprecation/plugin/TestDeprecatedQueryBuilder.java

@@ -5,7 +5,7 @@
  * 2.0.
  */
 
-package org.elasticsearch.xpack.deprecation;
+package org.elasticsearch.xpack.deprecation.plugin;
 
 import org.apache.lucene.search.Query;
 import org.elasticsearch.TransportVersion;

+ 9 - 35
x-pack/plugin/deprecation/qa/rest/src/main/java/org/elasticsearch/xpack/deprecation/TestDeprecationHeaderRestAction.java → x-pack/plugin/deprecation/qa/deprecation-plugin/src/main/java/org/elasticsearch/xpack/deprecation/plugin/TestDeprecationHeaderRestAction.java

@@ -4,7 +4,7 @@
  * 2.0; you may not use this file except in compliance with the Elastic License
  * 2.0.
  */
-package org.elasticsearch.xpack.deprecation;
+package org.elasticsearch.xpack.deprecation.plugin;
 
 import org.elasticsearch.client.internal.node.NodeClient;
 import org.elasticsearch.common.logging.DeprecationCategory;
@@ -26,6 +26,14 @@ import java.util.Map;
 
 import static org.elasticsearch.rest.RestRequest.Method.GET;
 import static org.elasticsearch.rest.RestRequest.Method.POST;
+import static org.elasticsearch.xpack.deprecation.DeprecationSettings.COMPATIBLE_API_USAGE;
+import static org.elasticsearch.xpack.deprecation.DeprecationSettings.DEPRECATED_ENDPOINT;
+import static org.elasticsearch.xpack.deprecation.DeprecationSettings.DEPRECATED_USAGE;
+import static org.elasticsearch.xpack.deprecation.DeprecationSettings.DEPRECATED_WARN_USAGE;
+import static org.elasticsearch.xpack.deprecation.DeprecationSettings.TEST_DEPRECATED_SETTING_TRUE1;
+import static org.elasticsearch.xpack.deprecation.DeprecationSettings.TEST_DEPRECATED_SETTING_TRUE2;
+import static org.elasticsearch.xpack.deprecation.DeprecationSettings.TEST_DEPRECATED_SETTING_TRUE3;
+import static org.elasticsearch.xpack.deprecation.DeprecationSettings.TEST_NOT_DEPRECATED_SETTING;
 
 /**
  * Enables testing {@code DeprecationRestHandler} via integration tests by guaranteeing a deprecated REST endpoint.
@@ -36,34 +44,6 @@ import static org.elasticsearch.rest.RestRequest.Method.POST;
 public class TestDeprecationHeaderRestAction extends BaseRestHandler {
     private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(TestDeprecationHeaderRestAction.class);
 
-    public static final Setting<Boolean> TEST_DEPRECATED_SETTING_TRUE1 = Setting.boolSetting(
-        "test.setting.deprecated.true1",
-        true,
-        Setting.Property.NodeScope,
-        Setting.Property.DeprecatedWarning,
-        Setting.Property.Dynamic
-    );
-    public static final Setting<Boolean> TEST_DEPRECATED_SETTING_TRUE2 = Setting.boolSetting(
-        "test.setting.deprecated.true2",
-        true,
-        Setting.Property.NodeScope,
-        Setting.Property.DeprecatedWarning,
-        Setting.Property.Dynamic
-    );
-    public static final Setting<Boolean> TEST_DEPRECATED_SETTING_TRUE3 = Setting.boolSetting(
-        "test.setting.deprecated.true3",
-        true,
-        Setting.Property.NodeScope,
-        Setting.Property.Deprecated,
-        Setting.Property.Dynamic
-    );
-    public static final Setting<Boolean> TEST_NOT_DEPRECATED_SETTING = Setting.boolSetting(
-        "test.setting.not_deprecated",
-        false,
-        Setting.Property.NodeScope,
-        Setting.Property.Dynamic
-    );
-
     private static final Map<String, Setting<?>> SETTINGS_MAP = Map.of(
         TEST_DEPRECATED_SETTING_TRUE1.getKey(),
         TEST_DEPRECATED_SETTING_TRUE1,
@@ -75,12 +55,6 @@ public class TestDeprecationHeaderRestAction extends BaseRestHandler {
         TEST_NOT_DEPRECATED_SETTING
     );
 
-    public static final String DEPRECATED_ENDPOINT = "[/_test_cluster/deprecated_settings] exists for deprecated tests";
-    public static final String DEPRECATED_USAGE = "[deprecated_settings] usage is deprecated. use [settings] instead";
-    public static final String DEPRECATED_WARN_USAGE =
-        "[deprecated_warn_settings] usage is deprecated but won't be breaking in next version";
-    public static final String COMPATIBLE_API_USAGE = "You are using a compatible API for this request";
-
     private final Settings settings;
 
     public TestDeprecationHeaderRestAction(Settings settings) {

+ 5 - 6
x-pack/plugin/deprecation/qa/rest/src/main/java/org/elasticsearch/xpack/deprecation/TestDeprecationPlugin.java → x-pack/plugin/deprecation/qa/deprecation-plugin/src/main/java/org/elasticsearch/xpack/deprecation/plugin/TestDeprecationPlugin.java

@@ -4,7 +4,7 @@
  * 2.0; you may not use this file except in compliance with the Elastic License
  * 2.0.
  */
-package org.elasticsearch.xpack.deprecation;
+package org.elasticsearch.xpack.deprecation.plugin;
 
 import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
 import org.elasticsearch.cluster.node.DiscoveryNodes;
@@ -28,6 +28,9 @@ import java.util.function.Predicate;
 import java.util.function.Supplier;
 
 import static java.util.Collections.singletonList;
+import static org.elasticsearch.xpack.deprecation.DeprecationSettings.TEST_DEPRECATED_SETTING_TRUE1;
+import static org.elasticsearch.xpack.deprecation.DeprecationSettings.TEST_DEPRECATED_SETTING_TRUE2;
+import static org.elasticsearch.xpack.deprecation.DeprecationSettings.TEST_NOT_DEPRECATED_SETTING;
 
 /**
  * Adds {@link TestDeprecationHeaderRestAction} for testing deprecation requests via HTTP.
@@ -51,11 +54,7 @@ public class TestDeprecationPlugin extends Plugin implements ActionPlugin, Searc
 
     @Override
     public List<Setting<?>> getSettings() {
-        return Arrays.asList(
-            TestDeprecationHeaderRestAction.TEST_DEPRECATED_SETTING_TRUE1,
-            TestDeprecationHeaderRestAction.TEST_DEPRECATED_SETTING_TRUE2,
-            TestDeprecationHeaderRestAction.TEST_NOT_DEPRECATED_SETTING
-        );
+        return Arrays.asList(TEST_DEPRECATED_SETTING_TRUE1, TEST_DEPRECATED_SETTING_TRUE2, TEST_NOT_DEPRECATED_SETTING);
     }
 
     @Override

+ 22 - 0
x-pack/plugin/deprecation/qa/early-deprecation-plugin/build.gradle

@@ -0,0 +1,22 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0; you may not use this file except in compliance with the Elastic License
+ * 2.0.
+ */
+
+apply plugin: 'elasticsearch.base-internal-es-plugin'
+apply plugin: 'elasticsearch.build'
+
+esplugin {
+  name = 'early-deprecation-plugin'
+  description = 'Deprecated query plugin'
+  classname = 'org.elasticsearch.xpack.deprecation.earlyplugin.EarlyDeprecationTestPlugin'
+}
+
+dependencies {
+  compileOnly project(":server")
+}
+tasks.named("javadoc").configure {
+  enabled = false
+}

+ 1 - 1
x-pack/plugin/deprecation/qa/early-deprecation-rest/src/main/java/org/elasticsearch/xpack/deprecation/EarlyDeprecationTestPlugin.java → x-pack/plugin/deprecation/qa/early-deprecation-plugin/src/main/java/org/elasticsearch/xpack/deprecation/earlyplugin/EarlyDeprecationTestPlugin.java

@@ -4,7 +4,7 @@
  * 2.0; you may not use this file except in compliance with the Elastic License
  * 2.0.
  */
-package org.elasticsearch.xpack.deprecation;
+package org.elasticsearch.xpack.deprecation.earlyplugin;
 
 import org.elasticsearch.common.logging.DeprecationCategory;
 import org.elasticsearch.common.logging.DeprecationLogger;

+ 0 - 48
x-pack/plugin/deprecation/qa/early-deprecation-rest/build.gradle

@@ -1,48 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * 2.0; you may not use this file except in compliance with the Elastic License
- * 2.0.
- */
-
-import org.elasticsearch.gradle.util.GradleUtils
-
-apply plugin: 'elasticsearch.base-internal-es-plugin'
-apply plugin: 'elasticsearch.legacy-java-rest-test'
-
-esplugin {
-  description = 'Deprecated query plugin'
-  classname ='org.elasticsearch.xpack.deprecation.EarlyDeprecationTestPlugin'
-}
-
-dependencies {
-  javaRestTestImplementation project(path: ':x-pack:plugin:deprecation:qa:common')
-
-  javaRestTestImplementation("com.fasterxml.jackson.core:jackson-annotations:${versions.jackson}")
-  javaRestTestImplementation("com.fasterxml.jackson.core:jackson-databind:${versions.jackson}")
-}
-
-// let the javaRestTest see the classpath of main
-GradleUtils.extendSourceSet(project, "main", "javaRestTest", tasks.named("javaRestTest"))
-
-restResources {
-  restApi {
-    include '_common', 'indices', 'index'
-  }
-}
-
-testClusters.configureEach {
-  testDistribution = 'DEFAULT'
-  setting 'xpack.security.enabled', 'false'
-  setting 'xpack.license.self_generated.type', 'trial'
-  setting 'cluster.deprecation_indexing.enabled', 'true'
-  setting 'cluster.deprecation_indexing.flush_interval', '1ms'
-  setting 'logger.org.elasticsearch.xpack.deprecation','TRACE'
-  setting 'logger.org.elasticsearch.xpack.deprecation.logging','TRACE'
-}
-
-// Test clusters run with security disabled
-tasks.named("javaRestTest") {
-  buildParams.withFipsEnabledOnly(it)
-}
-

+ 0 - 44
x-pack/plugin/deprecation/qa/rest/build.gradle

@@ -1,44 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * 2.0; you may not use this file except in compliance with the Elastic License
- * 2.0.
- */
-
-import org.elasticsearch.gradle.util.GradleUtils
-
-apply plugin: 'elasticsearch.base-internal-es-plugin'
-apply plugin: 'elasticsearch.legacy-java-rest-test'
-
-esplugin {
-  description = 'Deprecated query plugin'
-  classname ='org.elasticsearch.xpack.deprecation.TestDeprecationPlugin'
-}
-
-dependencies {
-  javaRestTestImplementation project(path: ':x-pack:plugin:deprecation:qa:common')
-  javaRestTestImplementation("com.fasterxml.jackson.core:jackson-annotations:${versions.jackson}")
-  javaRestTestImplementation("com.fasterxml.jackson.core:jackson-databind:${versions.jackson}")
-}
-
-// let the javaRestTest see the classpath of main
-GradleUtils.extendSourceSet(project, "main", "javaRestTest", tasks.named("javaRestTest"))
-
-restResources {
-  restApi {
-    include '_common', 'indices', 'index'
-  }
-}
-
-testClusters.configureEach {
-  testDistribution = 'DEFAULT'
-  setting 'cluster.deprecation_indexing.enabled', 'true'
-  setting 'cluster.deprecation_indexing.flush_interval', '100ms'
-  setting 'xpack.security.enabled', 'false'
-  setting 'xpack.license.self_generated.type', 'trial'
-}
-
-// Test clusters run with security disabled
-tasks.named("javaRestTest") {
-  buildParams.withFipsEnabledOnly(it)
-}

+ 32 - 12
x-pack/plugin/deprecation/qa/rest/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/DeprecationHttpIT.java → x-pack/plugin/deprecation/qa/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/DeprecationHttpIT.java

@@ -25,11 +25,13 @@ import org.elasticsearch.common.logging.LoggerMessageFormat;
 import org.elasticsearch.common.settings.Setting;
 import org.elasticsearch.common.settings.Settings;
 import org.elasticsearch.core.RestApiVersion;
+import org.elasticsearch.test.cluster.ElasticsearchCluster;
 import org.elasticsearch.test.rest.ESRestTestCase;
 import org.elasticsearch.xcontent.XContentBuilder;
 import org.elasticsearch.xcontent.json.JsonXContent;
 import org.hamcrest.Matcher;
 import org.junit.Before;
+import org.junit.ClassRule;
 import org.junit.Rule;
 import org.junit.rules.TestName;
 
@@ -44,9 +46,13 @@ import java.util.stream.Collectors;
 
 import static org.elasticsearch.common.logging.DeprecatedMessage.KEY_FIELD_NAME;
 import static org.elasticsearch.common.logging.DeprecatedMessage.X_OPAQUE_ID_FIELD_NAME;
-import static org.elasticsearch.xpack.deprecation.TestDeprecationHeaderRestAction.TEST_DEPRECATED_SETTING_TRUE1;
-import static org.elasticsearch.xpack.deprecation.TestDeprecationHeaderRestAction.TEST_DEPRECATED_SETTING_TRUE2;
-import static org.elasticsearch.xpack.deprecation.TestDeprecationHeaderRestAction.TEST_NOT_DEPRECATED_SETTING;
+import static org.elasticsearch.xpack.deprecation.DeprecationSettings.COMPATIBLE_API_USAGE;
+import static org.elasticsearch.xpack.deprecation.DeprecationSettings.DEPRECATED_ENDPOINT;
+import static org.elasticsearch.xpack.deprecation.DeprecationSettings.DEPRECATED_USAGE;
+import static org.elasticsearch.xpack.deprecation.DeprecationSettings.TEST_DEPRECATED_SETTING_TRUE1;
+import static org.elasticsearch.xpack.deprecation.DeprecationSettings.TEST_DEPRECATED_SETTING_TRUE2;
+import static org.elasticsearch.xpack.deprecation.DeprecationSettings.TEST_DEPRECATED_SETTING_TRUE3;
+import static org.elasticsearch.xpack.deprecation.DeprecationSettings.TEST_NOT_DEPRECATED_SETTING;
 import static org.hamcrest.Matchers.allOf;
 import static org.hamcrest.Matchers.containsInAnyOrder;
 import static org.hamcrest.Matchers.containsString;
@@ -62,6 +68,25 @@ import static org.hamcrest.Matchers.matchesRegex;
  */
 public class DeprecationHttpIT extends ESRestTestCase {
 
+    @ClassRule
+    public static ElasticsearchCluster cluster = ElasticsearchCluster.local()
+        .module("deprecation-plugin")
+        .module("x-pack-deprecation")
+        .module("x-pack-stack")
+        .module("x-pack-ilm")
+        .module("ingest-common")
+        .module("constant-keyword")
+        .setting("cluster.deprecation_indexing.enabled", "true")
+        .setting("cluster.deprecation_indexing.flush_interval", "100ms")
+        .setting("xpack.security.enabled", "false")
+        .setting("xpack.license.self_generated.type", "trial")
+        .build();
+
+    @Override
+    protected String getTestRestCluster() {
+        return cluster.getHttpAddresses();
+    }
+
     @Rule
     public TestName testName = new TestName();
 
@@ -233,9 +258,9 @@ public class DeprecationHttpIT extends ESRestTestCase {
         final List<String> deprecatedWarnings = getWarningHeaders(response.getHeaders());
         final List<Matcher<? super String>> headerMatchers = new ArrayList<>(4);
 
-        headerMatchers.add(equalTo(TestDeprecationHeaderRestAction.DEPRECATED_ENDPOINT));
+        headerMatchers.add(equalTo(DEPRECATED_ENDPOINT));
         if (useDeprecatedField) {
-            headerMatchers.add(equalTo(TestDeprecationHeaderRestAction.DEPRECATED_USAGE));
+            headerMatchers.add(equalTo(DEPRECATED_USAGE));
         }
 
         assertThat(deprecatedWarnings, everyItem(matchesRegex(HeaderWarning.WARNING_HEADER_PATTERN)));
@@ -379,12 +404,7 @@ public class DeprecationHttpIT extends ESRestTestCase {
      */
     public void testDeprecationCriticalWarnMessagesCanBeIndexed() throws Exception {
         final Request request = new Request("GET", "/_test_cluster/only_deprecated_setting");
-        request.setEntity(
-            buildSettingsRequest(
-                Collections.singletonList(TestDeprecationHeaderRestAction.TEST_DEPRECATED_SETTING_TRUE3),
-                "deprecation_critical"
-            )
-        );
+        request.setEntity(buildSettingsRequest(Collections.singletonList(TEST_DEPRECATED_SETTING_TRUE3), "deprecation_critical"));
         performScopedRequest(request);
 
         assertBusy(() -> {
@@ -601,7 +621,7 @@ public class DeprecationHttpIT extends ESRestTestCase {
         final List<String> deprecatedWarnings = getWarningHeaders(deprecatedApiResponse.getHeaders());
         assertThat(
             extractWarningValuesFromWarningHeaders(deprecatedWarnings),
-            containsInAnyOrder(TestDeprecationHeaderRestAction.DEPRECATED_ENDPOINT, TestDeprecationHeaderRestAction.COMPATIBLE_API_USAGE)
+            containsInAnyOrder(DEPRECATED_ENDPOINT, COMPATIBLE_API_USAGE)
         );
 
         assertBusy(() -> {

+ 24 - 0
x-pack/plugin/deprecation/qa/early-deprecation-rest/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/EarlyDeprecationIndexingIT.java → x-pack/plugin/deprecation/qa/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/EarlyDeprecationIndexingIT.java

@@ -15,7 +15,9 @@ import org.elasticsearch.client.Response;
 import org.elasticsearch.client.RestClient;
 import org.elasticsearch.client.RestClientBuilder;
 import org.elasticsearch.common.settings.Settings;
+import org.elasticsearch.test.cluster.ElasticsearchCluster;
 import org.elasticsearch.test.rest.ESRestTestCase;
+import org.junit.ClassRule;
 
 import java.io.IOException;
 import java.util.List;
@@ -35,6 +37,28 @@ import static org.hamcrest.Matchers.startsWith;
  */
 public class EarlyDeprecationIndexingIT extends ESRestTestCase {
 
+    @ClassRule
+    public static ElasticsearchCluster cluster = ElasticsearchCluster.local()
+        .module("early-deprecation-plugin")
+        .module("x-pack-deprecation")
+        .module("x-pack-stack")
+        .module("x-pack-ilm")
+        .module("ingest-common")
+        .module("constant-keyword")
+        .module("data-streams")
+        .setting("xpack.security.enabled", "false")
+        .setting("xpack.license.self_generated.type", "trial")
+        .setting("cluster.deprecation_indexing.enabled", "true")
+        .setting("cluster.deprecation_indexing.flush_interval", "1ms")
+        .setting("logger.org.elasticsearch.xpack.deprecation", "TRACE")
+        .setting("logger.org.elasticsearch.xpack.deprecation.logging", "TRACE")
+        .build();
+
+    @Override
+    protected String getTestRestCluster() {
+        return cluster.getHttpAddresses();
+    }
+
     /**
      * In EarlyDeprecationTestPlugin#onNodeStarted we simulate a very early deprecation that can happen before the template is loaded
      * The indexing has to be delayed until templates are loaded.

+ 25 - 0
x-pack/plugin/deprecation/qa/rest/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/MlDeprecationIT.java → x-pack/plugin/deprecation/qa/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/MlDeprecationIT.java

@@ -13,9 +13,11 @@ import org.elasticsearch.client.Response;
 import org.elasticsearch.client.WarningsHandler;
 import org.elasticsearch.common.settings.Settings;
 import org.elasticsearch.search.SearchModule;
+import org.elasticsearch.test.cluster.ElasticsearchCluster;
 import org.elasticsearch.test.rest.ESRestTestCase;
 import org.elasticsearch.xcontent.NamedXContentRegistry;
 import org.junit.After;
+import org.junit.ClassRule;
 
 import java.io.IOException;
 import java.util.Collections;
@@ -28,6 +30,29 @@ import static org.hamcrest.Matchers.hasSize;
 
 public class MlDeprecationIT extends ESRestTestCase {
 
+    @ClassRule
+    public static ElasticsearchCluster cluster = ElasticsearchCluster.local()
+        .module("deprecation-plugin")
+        .module("x-pack-deprecation")
+        .module("x-pack-stack")
+        .module("x-pack-ilm")
+        .module("x-pack-ml")
+        .module("mapper-extras")
+        .module("wildcard")
+        .module("ingest-common")
+        .module("constant-keyword")
+        .module("transform")
+        .setting("cluster.deprecation_indexing.enabled", "true")
+        .setting("cluster.deprecation_indexing.flush_interval", "100ms")
+        .setting("xpack.security.enabled", "false")
+        .setting("xpack.license.self_generated.type", "trial")
+        .build();
+
+    @Override
+    protected String getTestRestCluster() {
+        return cluster.getHttpAddresses();
+    }
+
     private static final RequestOptions REQUEST_OPTIONS = RequestOptions.DEFAULT.toBuilder()
         .setWarningsHandler(WarningsHandler.PERMISSIVE)
         .build();