diff --git a/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/RestrictedBuildApiService.java b/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/RestrictedBuildApiService.java index 1fe131d44dc67..4e9f08bc48f38 100644 --- a/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/RestrictedBuildApiService.java +++ b/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/RestrictedBuildApiService.java @@ -56,8 +56,6 @@ private static ListMultimap, String> createLegacyRestTestBasePluginUsag 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:ent-search:qa:rest"); map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:eql:qa:ccs-rolling-upgrade"); map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:eql:qa:correctness"); diff --git a/x-pack/plugin/deprecation/qa/build.gradle b/x-pack/plugin/deprecation/qa/build.gradle index e69de29bb2d1d..49af65e680d62 100644 --- a/x-pack/plugin/deprecation/qa/build.gradle +++ b/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) +} + diff --git a/x-pack/plugin/deprecation/qa/common/src/main/java/org/elasticsearch/xpack/deprecation/DeprecationSettings.java b/x-pack/plugin/deprecation/qa/common/src/main/java/org/elasticsearch/xpack/deprecation/DeprecationSettings.java new file mode 100644 index 0000000000000..b6b1e8262f812 --- /dev/null +++ b/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 TEST_DEPRECATED_SETTING_TRUE1 = Setting.boolSetting( + "test.setting.deprecated.true1", + true, + Setting.Property.NodeScope, + Setting.Property.DeprecatedWarning, + Setting.Property.Dynamic + ); + public static final Setting TEST_DEPRECATED_SETTING_TRUE2 = Setting.boolSetting( + "test.setting.deprecated.true2", + true, + Setting.Property.NodeScope, + Setting.Property.DeprecatedWarning, + Setting.Property.Dynamic + ); + public static final Setting TEST_DEPRECATED_SETTING_TRUE3 = Setting.boolSetting( + "test.setting.deprecated.true3", + true, + Setting.Property.NodeScope, + Setting.Property.Deprecated, + Setting.Property.Dynamic + ); + public static final Setting 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"; +} diff --git a/x-pack/plugin/deprecation/qa/deprecation-plugin/build.gradle b/x-pack/plugin/deprecation/qa/deprecation-plugin/build.gradle new file mode 100644 index 0000000000000..cf4546dd06e03 --- /dev/null +++ b/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') +} diff --git a/x-pack/plugin/deprecation/qa/rest/src/main/java/org/elasticsearch/xpack/deprecation/TestDeprecatedQueryBuilder.java b/x-pack/plugin/deprecation/qa/deprecation-plugin/src/main/java/org/elasticsearch/xpack/deprecation/plugin/TestDeprecatedQueryBuilder.java similarity index 98% rename from x-pack/plugin/deprecation/qa/rest/src/main/java/org/elasticsearch/xpack/deprecation/TestDeprecatedQueryBuilder.java rename to x-pack/plugin/deprecation/qa/deprecation-plugin/src/main/java/org/elasticsearch/xpack/deprecation/plugin/TestDeprecatedQueryBuilder.java index 205a699d23593..5ad9cbf860c17 100644 --- a/x-pack/plugin/deprecation/qa/rest/src/main/java/org/elasticsearch/xpack/deprecation/TestDeprecatedQueryBuilder.java +++ b/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; diff --git a/x-pack/plugin/deprecation/qa/rest/src/main/java/org/elasticsearch/xpack/deprecation/TestDeprecationHeaderRestAction.java b/x-pack/plugin/deprecation/qa/deprecation-plugin/src/main/java/org/elasticsearch/xpack/deprecation/plugin/TestDeprecationHeaderRestAction.java similarity index 77% rename from x-pack/plugin/deprecation/qa/rest/src/main/java/org/elasticsearch/xpack/deprecation/TestDeprecationHeaderRestAction.java rename to x-pack/plugin/deprecation/qa/deprecation-plugin/src/main/java/org/elasticsearch/xpack/deprecation/plugin/TestDeprecationHeaderRestAction.java index 70942b04f85b8..5243ce49db37c 100644 --- a/x-pack/plugin/deprecation/qa/rest/src/main/java/org/elasticsearch/xpack/deprecation/TestDeprecationHeaderRestAction.java +++ b/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 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 @@ public class TestDeprecationHeaderRestAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(TestDeprecationHeaderRestAction.class); - public static final Setting TEST_DEPRECATED_SETTING_TRUE1 = Setting.boolSetting( - "test.setting.deprecated.true1", - true, - Setting.Property.NodeScope, - Setting.Property.DeprecatedWarning, - Setting.Property.Dynamic - ); - public static final Setting TEST_DEPRECATED_SETTING_TRUE2 = Setting.boolSetting( - "test.setting.deprecated.true2", - true, - Setting.Property.NodeScope, - Setting.Property.DeprecatedWarning, - Setting.Property.Dynamic - ); - public static final Setting TEST_DEPRECATED_SETTING_TRUE3 = Setting.boolSetting( - "test.setting.deprecated.true3", - true, - Setting.Property.NodeScope, - Setting.Property.Deprecated, - Setting.Property.Dynamic - ); - public static final Setting TEST_NOT_DEPRECATED_SETTING = Setting.boolSetting( - "test.setting.not_deprecated", - false, - Setting.Property.NodeScope, - Setting.Property.Dynamic - ); - private static final Map> 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) { diff --git a/x-pack/plugin/deprecation/qa/rest/src/main/java/org/elasticsearch/xpack/deprecation/TestDeprecationPlugin.java b/x-pack/plugin/deprecation/qa/deprecation-plugin/src/main/java/org/elasticsearch/xpack/deprecation/plugin/TestDeprecationPlugin.java similarity index 82% rename from x-pack/plugin/deprecation/qa/rest/src/main/java/org/elasticsearch/xpack/deprecation/TestDeprecationPlugin.java rename to x-pack/plugin/deprecation/qa/deprecation-plugin/src/main/java/org/elasticsearch/xpack/deprecation/plugin/TestDeprecationPlugin.java index 3867e02ac6ca7..ca8119268dbc5 100644 --- a/x-pack/plugin/deprecation/qa/rest/src/main/java/org/elasticsearch/xpack/deprecation/TestDeprecationPlugin.java +++ b/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.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 List getRestHandlers( @Override public List> 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 diff --git a/x-pack/plugin/deprecation/qa/early-deprecation-plugin/build.gradle b/x-pack/plugin/deprecation/qa/early-deprecation-plugin/build.gradle new file mode 100644 index 0000000000000..e1faa524b7f34 --- /dev/null +++ b/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 +} diff --git a/x-pack/plugin/deprecation/qa/early-deprecation-rest/src/main/java/org/elasticsearch/xpack/deprecation/EarlyDeprecationTestPlugin.java b/x-pack/plugin/deprecation/qa/early-deprecation-plugin/src/main/java/org/elasticsearch/xpack/deprecation/earlyplugin/EarlyDeprecationTestPlugin.java similarity index 94% rename from x-pack/plugin/deprecation/qa/early-deprecation-rest/src/main/java/org/elasticsearch/xpack/deprecation/EarlyDeprecationTestPlugin.java rename to x-pack/plugin/deprecation/qa/early-deprecation-plugin/src/main/java/org/elasticsearch/xpack/deprecation/earlyplugin/EarlyDeprecationTestPlugin.java index e8c04ab68c901..3e189ed1e379f 100644 --- a/x-pack/plugin/deprecation/qa/early-deprecation-rest/src/main/java/org/elasticsearch/xpack/deprecation/EarlyDeprecationTestPlugin.java +++ b/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; diff --git a/x-pack/plugin/deprecation/qa/early-deprecation-rest/build.gradle b/x-pack/plugin/deprecation/qa/early-deprecation-rest/build.gradle deleted file mode 100644 index f8d2a35d369fc..0000000000000 --- a/x-pack/plugin/deprecation/qa/early-deprecation-rest/build.gradle +++ /dev/null @@ -1,42 +0,0 @@ -import org.elasticsearch.gradle.util.GradleUtils -import org.elasticsearch.gradle.internal.info.BuildParams - -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) -} - diff --git a/x-pack/plugin/deprecation/qa/rest/build.gradle b/x-pack/plugin/deprecation/qa/rest/build.gradle deleted file mode 100644 index fc13f4fda13ac..0000000000000 --- a/x-pack/plugin/deprecation/qa/rest/build.gradle +++ /dev/null @@ -1,38 +0,0 @@ -import org.elasticsearch.gradle.util.GradleUtils -import org.elasticsearch.gradle.internal.info.BuildParams - -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) -} diff --git a/x-pack/plugin/deprecation/qa/rest/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/DeprecationHttpIT.java b/x-pack/plugin/deprecation/qa/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/DeprecationHttpIT.java similarity index 94% rename from x-pack/plugin/deprecation/qa/rest/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/DeprecationHttpIT.java rename to x-pack/plugin/deprecation/qa/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/DeprecationHttpIT.java index f6dd43164e387..eeb177ecb3ef1 100644 --- a/x-pack/plugin/deprecation/qa/rest/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/DeprecationHttpIT.java +++ b/x-pack/plugin/deprecation/qa/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/DeprecationHttpIT.java @@ -25,11 +25,13 @@ 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 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 @@ */ 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(); @@ -232,9 +257,9 @@ private void doTestDeprecationWarningsAppearInHeaders(String xOpaqueId) throws E final List deprecatedWarnings = getWarningHeaders(response.getHeaders()); final List> 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))); @@ -378,12 +403,7 @@ public void testDeprecationMessagesCanBeIndexed() throws Exception { */ 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(() -> { @@ -495,7 +515,7 @@ public void testCompatibleMessagesCanBeIndexed() throws Exception { final List deprecatedWarnings = getWarningHeaders(deprecatedApiResponse.getHeaders()); assertThat( extractWarningValuesFromWarningHeaders(deprecatedWarnings), - containsInAnyOrder(TestDeprecationHeaderRestAction.DEPRECATED_ENDPOINT, TestDeprecationHeaderRestAction.COMPATIBLE_API_USAGE) + containsInAnyOrder(DEPRECATED_ENDPOINT, COMPATIBLE_API_USAGE) ); assertBusy(() -> { diff --git a/x-pack/plugin/deprecation/qa/early-deprecation-rest/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/EarlyDeprecationIndexingIT.java b/x-pack/plugin/deprecation/qa/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/EarlyDeprecationIndexingIT.java similarity index 80% rename from x-pack/plugin/deprecation/qa/early-deprecation-rest/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/EarlyDeprecationIndexingIT.java rename to x-pack/plugin/deprecation/qa/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/EarlyDeprecationIndexingIT.java index 798730970d9d3..b5a42d27bc6b1 100644 --- a/x-pack/plugin/deprecation/qa/early-deprecation-rest/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/EarlyDeprecationIndexingIT.java +++ b/x-pack/plugin/deprecation/qa/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/EarlyDeprecationIndexingIT.java @@ -15,7 +15,9 @@ 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 @@ */ 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. diff --git a/x-pack/plugin/deprecation/qa/rest/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/MlDeprecationIT.java b/x-pack/plugin/deprecation/qa/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/MlDeprecationIT.java similarity index 82% rename from x-pack/plugin/deprecation/qa/rest/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/MlDeprecationIT.java rename to x-pack/plugin/deprecation/qa/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/MlDeprecationIT.java index 54a48ab34e991..4ee5f39e8df55 100644 --- a/x-pack/plugin/deprecation/qa/rest/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/MlDeprecationIT.java +++ b/x-pack/plugin/deprecation/qa/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/MlDeprecationIT.java @@ -13,9 +13,11 @@ 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 @@ 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();