From 8ef12ad0cc92f41991c0c1f6fdaf8aad76bb6a06 Mon Sep 17 00:00:00 2001 From: Lorenzo Dematte Date: Thu, 17 Jul 2025 10:00:27 +0200 Subject: [PATCH 1/8] (WIP) Migrate x-pack-deprecation REST tests --- .../qa/early-deprecation-rest/build.gradle | 21 +++++++------------ .../EarlyDeprecationIndexingIT.java | 15 +++++++++++++ .../plugin/deprecation/qa/rest/build.gradle | 17 +++++++-------- .../xpack/deprecation/DeprecationHttpIT.java | 17 +++++++++++++++ .../xpack/deprecation/MlDeprecationIT.java | 18 ++++++++++++++++ 5 files changed, 66 insertions(+), 22 deletions(-) diff --git a/x-pack/plugin/deprecation/qa/early-deprecation-rest/build.gradle b/x-pack/plugin/deprecation/qa/early-deprecation-rest/build.gradle index 2fe46efca8a1c..464ac35dc772f 100644 --- a/x-pack/plugin/deprecation/qa/early-deprecation-rest/build.gradle +++ b/x-pack/plugin/deprecation/qa/early-deprecation-rest/build.gradle @@ -8,18 +8,23 @@ import org.elasticsearch.gradle.util.GradleUtils apply plugin: 'elasticsearch.base-internal-es-plugin' -apply plugin: 'elasticsearch.legacy-java-rest-test' +apply plugin: 'elasticsearch.internal-java-rest-test' esplugin { + name = 'deprecation-test-plugin' description = 'Deprecated query plugin' - classname ='org.elasticsearch.xpack.deprecation.EarlyDeprecationTestPlugin' + classname = 'org.elasticsearch.xpack.deprecation.EarlyDeprecationTestPlugin' } dependencies { - javaRestTestImplementation project(path: ':x-pack:plugin:deprecation:qa:common') + compileOnly project(":server") + 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(xpackModule('deprecation')) + clusterModules project(':x-pack:plugin:deprecation:qa:rest') } // let the javaRestTest see the classpath of main @@ -31,16 +36,6 @@ restResources { } } -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/early-deprecation-rest/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/EarlyDeprecationIndexingIT.java b/x-pack/plugin/deprecation/qa/early-deprecation-rest/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/EarlyDeprecationIndexingIT.java index 798730970d9d3..e220aa79fc918 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/early-deprecation-rest/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,19 @@ */ public class EarlyDeprecationIndexingIT extends ESRestTestCase { + @ClassRule + public static ElasticsearchCluster cluster = ElasticsearchCluster.local() + .module("x-pack-deprecation") + .module("deprecation-test-plugin") + .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(); + + /** * 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/build.gradle b/x-pack/plugin/deprecation/qa/rest/build.gradle index e3ad5799aaf75..1c622aa5a2f77 100644 --- a/x-pack/plugin/deprecation/qa/rest/build.gradle +++ b/x-pack/plugin/deprecation/qa/rest/build.gradle @@ -8,17 +8,24 @@ import org.elasticsearch.gradle.util.GradleUtils apply plugin: 'elasticsearch.base-internal-es-plugin' -apply plugin: 'elasticsearch.legacy-java-rest-test' +apply plugin: 'elasticsearch.internal-java-rest-test' esplugin { + name = 'deprecation-test-plugin' description = 'Deprecated query plugin' classname ='org.elasticsearch.xpack.deprecation.TestDeprecationPlugin' } dependencies { + compileOnly project(":server") + 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(xpackModule('deprecation')) + clusterModules project(':x-pack:plugin:deprecation:qa:rest') + clusterModules project(':x-pack:plugin:ml') } // let the javaRestTest see the classpath of main @@ -30,14 +37,6 @@ restResources { } } -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/rest/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/DeprecationHttpIT.java index 57bda3b35a1ad..c2190a63a3aed 100644 --- a/x-pack/plugin/deprecation/qa/rest/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/DeprecationHttpIT.java +++ b/x-pack/plugin/deprecation/qa/rest/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; @@ -62,6 +64,21 @@ */ public class DeprecationHttpIT extends ESRestTestCase { + @ClassRule + public static ElasticsearchCluster cluster = ElasticsearchCluster.local() + .module("x-pack-deprecation") + .module("deprecation-test-plugin") + .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(); diff --git a/x-pack/plugin/deprecation/qa/rest/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/MlDeprecationIT.java b/x-pack/plugin/deprecation/qa/rest/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/MlDeprecationIT.java index 54a48ab34e991..fad6ad8758782 100644 --- a/x-pack/plugin/deprecation/qa/rest/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/MlDeprecationIT.java +++ b/x-pack/plugin/deprecation/qa/rest/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,22 @@ public class MlDeprecationIT extends ESRestTestCase { + @ClassRule + public static ElasticsearchCluster cluster = ElasticsearchCluster.local() + .module("x-pack-deprecation") + .module("deprecation-test-plugin") + .module("x-pack-ml") + .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(); From 1c14a1ca9ea4d35e5ca1acd2c65a873d9d37113f Mon Sep 17 00:00:00 2001 From: Lorenzo Dematte Date: Thu, 17 Jul 2025 15:15:17 +0200 Subject: [PATCH 2/8] Using default distribution --- .../qa/early-deprecation-rest/build.gradle | 7 +++++-- .../deprecation/EarlyDeprecationIndexingIT.java | 13 +++++++++---- x-pack/plugin/deprecation/qa/rest/build.gradle | 9 ++++++--- .../xpack/deprecation/DeprecationHttpIT.java | 5 +++-- .../xpack/deprecation/MlDeprecationIT.java | 6 +++--- 5 files changed, 26 insertions(+), 14 deletions(-) diff --git a/x-pack/plugin/deprecation/qa/early-deprecation-rest/build.gradle b/x-pack/plugin/deprecation/qa/early-deprecation-rest/build.gradle index 464ac35dc772f..b0f0cb8b27a28 100644 --- a/x-pack/plugin/deprecation/qa/early-deprecation-rest/build.gradle +++ b/x-pack/plugin/deprecation/qa/early-deprecation-rest/build.gradle @@ -23,13 +23,16 @@ dependencies { javaRestTestImplementation("com.fasterxml.jackson.core:jackson-annotations:${versions.jackson}") javaRestTestImplementation("com.fasterxml.jackson.core:jackson-databind:${versions.jackson}") - clusterModules project(xpackModule('deprecation')) - clusterModules project(':x-pack:plugin:deprecation:qa:rest') + clusterPlugins project(':x-pack:plugin:deprecation:qa::early-deprecation-rest') } // let the javaRestTest see the classpath of main GradleUtils.extendSourceSet(project, "main", "javaRestTest", tasks.named("javaRestTest")) +tasks.named('javaRestTest') { + usesDefaultDistribution("to be triaged") +} + restResources { restApi { include '_common', 'indices', 'index' 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/early-deprecation-rest/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/EarlyDeprecationIndexingIT.java index e220aa79fc918..d5675c89abc3f 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/early-deprecation-rest/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/EarlyDeprecationIndexingIT.java @@ -16,6 +16,7 @@ import org.elasticsearch.client.RestClientBuilder; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.cluster.ElasticsearchCluster; +import org.elasticsearch.test.cluster.local.distribution.DistributionType; import org.elasticsearch.test.rest.ESRestTestCase; import org.junit.ClassRule; @@ -39,16 +40,20 @@ public class EarlyDeprecationIndexingIT extends ESRestTestCase { @ClassRule public static ElasticsearchCluster cluster = ElasticsearchCluster.local() - .module("x-pack-deprecation") - .module("deprecation-test-plugin") + .distribution(DistributionType.DEFAULT) + .plugin("deprecation-test-plugin") .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") + .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 diff --git a/x-pack/plugin/deprecation/qa/rest/build.gradle b/x-pack/plugin/deprecation/qa/rest/build.gradle index 1c622aa5a2f77..0b93581b83a6e 100644 --- a/x-pack/plugin/deprecation/qa/rest/build.gradle +++ b/x-pack/plugin/deprecation/qa/rest/build.gradle @@ -23,9 +23,7 @@ dependencies { javaRestTestImplementation("com.fasterxml.jackson.core:jackson-annotations:${versions.jackson}") javaRestTestImplementation("com.fasterxml.jackson.core:jackson-databind:${versions.jackson}") - clusterModules project(xpackModule('deprecation')) - clusterModules project(':x-pack:plugin:deprecation:qa:rest') - clusterModules project(':x-pack:plugin:ml') + clusterPlugins project(':x-pack:plugin:deprecation:qa:rest') } // let the javaRestTest see the classpath of main @@ -37,6 +35,11 @@ restResources { } } +tasks.named('javaRestTest') { + usesDefaultDistribution("to be triaged") +} + + // 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/rest/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/DeprecationHttpIT.java index c2190a63a3aed..254785a17f614 100644 --- a/x-pack/plugin/deprecation/qa/rest/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/DeprecationHttpIT.java +++ b/x-pack/plugin/deprecation/qa/rest/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/DeprecationHttpIT.java @@ -26,6 +26,7 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.core.RestApiVersion; import org.elasticsearch.test.cluster.ElasticsearchCluster; +import org.elasticsearch.test.cluster.local.distribution.DistributionType; import org.elasticsearch.test.rest.ESRestTestCase; import org.elasticsearch.xcontent.XContentBuilder; import org.elasticsearch.xcontent.json.JsonXContent; @@ -66,8 +67,8 @@ public class DeprecationHttpIT extends ESRestTestCase { @ClassRule public static ElasticsearchCluster cluster = ElasticsearchCluster.local() - .module("x-pack-deprecation") - .module("deprecation-test-plugin") + .distribution(DistributionType.DEFAULT) + .plugin("deprecation-test-plugin") .setting("cluster.deprecation_indexing.enabled", "true") .setting("cluster.deprecation_indexing.flush_interval", "100ms") .setting("xpack.security.enabled", "false") diff --git a/x-pack/plugin/deprecation/qa/rest/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/MlDeprecationIT.java b/x-pack/plugin/deprecation/qa/rest/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/MlDeprecationIT.java index fad6ad8758782..2e044081073bf 100644 --- a/x-pack/plugin/deprecation/qa/rest/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/MlDeprecationIT.java +++ b/x-pack/plugin/deprecation/qa/rest/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/MlDeprecationIT.java @@ -14,6 +14,7 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.search.SearchModule; import org.elasticsearch.test.cluster.ElasticsearchCluster; +import org.elasticsearch.test.cluster.local.distribution.DistributionType; import org.elasticsearch.test.rest.ESRestTestCase; import org.elasticsearch.xcontent.NamedXContentRegistry; import org.junit.After; @@ -32,9 +33,8 @@ public class MlDeprecationIT extends ESRestTestCase { @ClassRule public static ElasticsearchCluster cluster = ElasticsearchCluster.local() - .module("x-pack-deprecation") - .module("deprecation-test-plugin") - .module("x-pack-ml") + .distribution(DistributionType.DEFAULT) + .plugin("deprecation-test-plugin") .setting("cluster.deprecation_indexing.enabled", "true") .setting("cluster.deprecation_indexing.flush_interval", "100ms") .setting("xpack.security.enabled", "false") From 8730b91c17c2f0ce8d367bbe82e8da2f92a9857b Mon Sep 17 00:00:00 2001 From: Lorenzo Dematte Date: Thu, 17 Jul 2025 15:23:39 +0200 Subject: [PATCH 3/8] Removing from legacy allow list --- .../gradle/internal/RestrictedBuildApiService.java | 2 -- 1 file changed, 2 deletions(-) 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 205930133156c..067042f91b71c 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:downsample:qa:with-security"); map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:enrich:qa:rest"); map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:enrich:qa:rest-with-advanced-security"); From 9a7928840567b8883d7e282e90937e37836f93d3 Mon Sep 17 00:00:00 2001 From: Lorenzo Dematte Date: Fri, 18 Jul 2025 16:22:41 +0200 Subject: [PATCH 4/8] Move javaRestTest to common (parent) location; renamed test plugin projects --- x-pack/plugin/deprecation/qa/build.gradle | 35 ++++++++++++++ .../deprecation/DeprecationSettings.java | 46 +++++++++++++++++++ .../qa/deprecation-plugin/build.gradle | 20 ++++++++ .../TestDeprecatedQueryBuilder.java | 0 .../TestDeprecationHeaderRestAction.java | 42 ++++------------- .../deprecation/TestDeprecationPlugin.java | 9 ++-- .../qa/early-deprecation-plugin/build.gradle | 22 +++++++++ .../EarlyDeprecationTestPlugin.java | 0 .../qa/early-deprecation-rest/build.gradle | 46 ------------------- .../plugin/deprecation/qa/rest/build.gradle | 46 ------------------- .../xpack/deprecation/DeprecationHttpIT.java | 25 +++++----- .../EarlyDeprecationIndexingIT.java | 2 +- .../xpack/deprecation/MlDeprecationIT.java | 2 +- 13 files changed, 149 insertions(+), 146 deletions(-) create mode 100644 x-pack/plugin/deprecation/qa/common/src/main/java/org/elasticsearch/xpack/deprecation/DeprecationSettings.java create mode 100644 x-pack/plugin/deprecation/qa/deprecation-plugin/build.gradle rename x-pack/plugin/deprecation/qa/{rest => deprecation-plugin}/src/main/java/org/elasticsearch/xpack/deprecation/TestDeprecatedQueryBuilder.java (100%) rename x-pack/plugin/deprecation/qa/{rest => deprecation-plugin}/src/main/java/org/elasticsearch/xpack/deprecation/TestDeprecationHeaderRestAction.java (80%) rename x-pack/plugin/deprecation/qa/{rest => deprecation-plugin}/src/main/java/org/elasticsearch/xpack/deprecation/TestDeprecationPlugin.java (84%) create mode 100644 x-pack/plugin/deprecation/qa/early-deprecation-plugin/build.gradle rename x-pack/plugin/deprecation/qa/{early-deprecation-rest => early-deprecation-plugin}/src/main/java/org/elasticsearch/xpack/deprecation/EarlyDeprecationTestPlugin.java (100%) delete mode 100644 x-pack/plugin/deprecation/qa/early-deprecation-rest/build.gradle delete mode 100644 x-pack/plugin/deprecation/qa/rest/build.gradle rename x-pack/plugin/deprecation/qa/{rest => }/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/DeprecationHttpIT.java (97%) rename x-pack/plugin/deprecation/qa/{early-deprecation-rest => }/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/EarlyDeprecationIndexingIT.java (99%) rename x-pack/plugin/deprecation/qa/{rest => }/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/MlDeprecationIT.java (99%) diff --git a/x-pack/plugin/deprecation/qa/build.gradle b/x-pack/plugin/deprecation/qa/build.gradle index e69de29bb2d1d..553440d98783c 100644 --- a/x-pack/plugin/deprecation/qa/build.gradle +++ b/x-pack/plugin/deprecation/qa/build.gradle @@ -0,0 +1,35 @@ +/* + * 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}") + + clusterPlugins project(':x-pack:plugin:deprecation:qa::early-deprecation-plugin') + clusterPlugins project(':x-pack:plugin:deprecation:qa::deprecation-plugin') +} + +tasks.named('javaRestTest') { + usesDefaultDistribution("to be triaged") +} + +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..e6ea76cb31478 --- /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.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/TestDeprecatedQueryBuilder.java similarity index 100% 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/TestDeprecatedQueryBuilder.java 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/TestDeprecationHeaderRestAction.java similarity index 80% 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/TestDeprecationHeaderRestAction.java index 2b9d9b0875220..b604a7b595d18 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/TestDeprecationHeaderRestAction.java @@ -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/TestDeprecationPlugin.java similarity index 84% 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/TestDeprecationPlugin.java index 3867e02ac6ca7..58b84f74d0e09 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/TestDeprecationPlugin.java @@ -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..246d56ab32c98 --- /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.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/EarlyDeprecationTestPlugin.java similarity index 100% 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/EarlyDeprecationTestPlugin.java 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 b0f0cb8b27a28..0000000000000 --- a/x-pack/plugin/deprecation/qa/early-deprecation-rest/build.gradle +++ /dev/null @@ -1,46 +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.internal-java-rest-test' - -esplugin { - name = 'deprecation-test-plugin' - description = 'Deprecated query plugin' - classname = 'org.elasticsearch.xpack.deprecation.EarlyDeprecationTestPlugin' -} - -dependencies { - compileOnly project(":server") - - 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}") - - clusterPlugins project(':x-pack:plugin:deprecation:qa::early-deprecation-rest') -} - -// let the javaRestTest see the classpath of main -GradleUtils.extendSourceSet(project, "main", "javaRestTest", tasks.named("javaRestTest")) - -tasks.named('javaRestTest') { - usesDefaultDistribution("to be triaged") -} - -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/rest/build.gradle b/x-pack/plugin/deprecation/qa/rest/build.gradle deleted file mode 100644 index 0b93581b83a6e..0000000000000 --- a/x-pack/plugin/deprecation/qa/rest/build.gradle +++ /dev/null @@ -1,46 +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.internal-java-rest-test' - -esplugin { - name = 'deprecation-test-plugin' - description = 'Deprecated query plugin' - classname ='org.elasticsearch.xpack.deprecation.TestDeprecationPlugin' -} - -dependencies { - compileOnly project(":server") - - 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}") - - clusterPlugins project(':x-pack:plugin:deprecation:qa:rest') -} - -// let the javaRestTest see the classpath of main -GradleUtils.extendSourceSet(project, "main", "javaRestTest", tasks.named("javaRestTest")) - -restResources { - restApi { - include '_common', 'indices', 'index' - } -} - -tasks.named('javaRestTest') { - usesDefaultDistribution("to be triaged") -} - - -// 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 97% 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 254785a17f614..bd87b238c0e8d 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 @@ -47,9 +47,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; @@ -68,7 +72,7 @@ public class DeprecationHttpIT extends ESRestTestCase { @ClassRule public static ElasticsearchCluster cluster = ElasticsearchCluster.local() .distribution(DistributionType.DEFAULT) - .plugin("deprecation-test-plugin") + .plugin("deprecation-plugin") .setting("cluster.deprecation_indexing.enabled", "true") .setting("cluster.deprecation_indexing.flush_interval", "100ms") .setting("xpack.security.enabled", "false") @@ -251,9 +255,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))); @@ -397,12 +401,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(() -> { @@ -619,7 +618,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 99% 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 d5675c89abc3f..ebf9e17fe7500 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 @@ -41,7 +41,7 @@ public class EarlyDeprecationIndexingIT extends ESRestTestCase { @ClassRule public static ElasticsearchCluster cluster = ElasticsearchCluster.local() .distribution(DistributionType.DEFAULT) - .plugin("deprecation-test-plugin") + .plugin("early-deprecation-plugin") .setting("xpack.security.enabled", "false") .setting("xpack.license.self_generated.type", "trial") .setting("cluster.deprecation_indexing.enabled", "true") 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 99% 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 2e044081073bf..2ff60b1998e56 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 @@ -34,7 +34,7 @@ public class MlDeprecationIT extends ESRestTestCase { @ClassRule public static ElasticsearchCluster cluster = ElasticsearchCluster.local() .distribution(DistributionType.DEFAULT) - .plugin("deprecation-test-plugin") + .plugin("deprecation-plugin") .setting("cluster.deprecation_indexing.enabled", "true") .setting("cluster.deprecation_indexing.flush_interval", "100ms") .setting("xpack.security.enabled", "false") From 1a3d91418dd4c60247ef8d06dd80633cd635bc67 Mon Sep 17 00:00:00 2001 From: Lorenzo Dematte Date: Fri, 18 Jul 2025 16:26:25 +0200 Subject: [PATCH 5/8] Updated reason + comment --- x-pack/plugin/deprecation/qa/build.gradle | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/x-pack/plugin/deprecation/qa/build.gradle b/x-pack/plugin/deprecation/qa/build.gradle index 553440d98783c..7e15aeab8bf88 100644 --- a/x-pack/plugin/deprecation/qa/build.gradle +++ b/x-pack/plugin/deprecation/qa/build.gradle @@ -19,7 +19,9 @@ dependencies { } tasks.named('javaRestTest') { - usesDefaultDistribution("to be triaged") + // Tried to just include deprecation, data-streams and ml, but apparently some other non + // immediately apparent plugin is needed + usesDefaultDistribution("the .logs.deprecated index can not be written or read with a minimal plugin set") } restResources { From 5f0bbb0006bad84c13c6624173f17a273cfbd080 Mon Sep 17 00:00:00 2001 From: Lorenzo Dematte Date: Fri, 18 Jul 2025 16:34:36 +0200 Subject: [PATCH 6/8] Added build scan link --- x-pack/plugin/deprecation/qa/build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/x-pack/plugin/deprecation/qa/build.gradle b/x-pack/plugin/deprecation/qa/build.gradle index 7e15aeab8bf88..6027f7751f33f 100644 --- a/x-pack/plugin/deprecation/qa/build.gradle +++ b/x-pack/plugin/deprecation/qa/build.gradle @@ -21,6 +21,7 @@ dependencies { tasks.named('javaRestTest') { // Tried to just include deprecation, data-streams and ml, but apparently some other non // immediately apparent plugin is needed + // Example failing build scan: https://gradle-enterprise.elastic.co/s/rxaz3vi2a3tao usesDefaultDistribution("the .logs.deprecated index can not be written or read with a minimal plugin set") } From 2cb6e95ca482ac582a1f8447efdb60644ecd9f8f Mon Sep 17 00:00:00 2001 From: Lorenzo Dematte Date: Fri, 18 Jul 2025 17:49:37 +0200 Subject: [PATCH 7/8] Renaming packages to avoid split packages problems --- x-pack/plugin/deprecation/qa/deprecation-plugin/build.gradle | 2 +- .../deprecation/{ => plugin}/TestDeprecatedQueryBuilder.java | 2 +- .../{ => plugin}/TestDeprecationHeaderRestAction.java | 2 +- .../xpack/deprecation/{ => plugin}/TestDeprecationPlugin.java | 2 +- .../plugin/deprecation/qa/early-deprecation-plugin/build.gradle | 2 +- .../{ => earlyplugin}/EarlyDeprecationTestPlugin.java | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) rename x-pack/plugin/deprecation/qa/deprecation-plugin/src/main/java/org/elasticsearch/xpack/deprecation/{ => plugin}/TestDeprecatedQueryBuilder.java (98%) rename x-pack/plugin/deprecation/qa/deprecation-plugin/src/main/java/org/elasticsearch/xpack/deprecation/{ => plugin}/TestDeprecationHeaderRestAction.java (99%) rename x-pack/plugin/deprecation/qa/deprecation-plugin/src/main/java/org/elasticsearch/xpack/deprecation/{ => plugin}/TestDeprecationPlugin.java (98%) rename x-pack/plugin/deprecation/qa/early-deprecation-plugin/src/main/java/org/elasticsearch/xpack/deprecation/{ => earlyplugin}/EarlyDeprecationTestPlugin.java (94%) diff --git a/x-pack/plugin/deprecation/qa/deprecation-plugin/build.gradle b/x-pack/plugin/deprecation/qa/deprecation-plugin/build.gradle index e6ea76cb31478..cf4546dd06e03 100644 --- a/x-pack/plugin/deprecation/qa/deprecation-plugin/build.gradle +++ b/x-pack/plugin/deprecation/qa/deprecation-plugin/build.gradle @@ -11,7 +11,7 @@ apply plugin: 'elasticsearch.build' esplugin { name = 'deprecation-plugin' description = 'Deprecated query plugin' - classname ='org.elasticsearch.xpack.deprecation.TestDeprecationPlugin' + classname ='org.elasticsearch.xpack.deprecation.plugin.TestDeprecationPlugin' } dependencies { diff --git a/x-pack/plugin/deprecation/qa/deprecation-plugin/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/deprecation-plugin/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/deprecation-plugin/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/deprecation-plugin/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 99% rename from x-pack/plugin/deprecation/qa/deprecation-plugin/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 b604a7b595d18..797a9fbb8a238 100644 --- a/x-pack/plugin/deprecation/qa/deprecation-plugin/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; diff --git a/x-pack/plugin/deprecation/qa/deprecation-plugin/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 98% rename from x-pack/plugin/deprecation/qa/deprecation-plugin/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 58b84f74d0e09..ca8119268dbc5 100644 --- a/x-pack/plugin/deprecation/qa/deprecation-plugin/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; diff --git a/x-pack/plugin/deprecation/qa/early-deprecation-plugin/build.gradle b/x-pack/plugin/deprecation/qa/early-deprecation-plugin/build.gradle index 246d56ab32c98..e1faa524b7f34 100644 --- a/x-pack/plugin/deprecation/qa/early-deprecation-plugin/build.gradle +++ b/x-pack/plugin/deprecation/qa/early-deprecation-plugin/build.gradle @@ -11,7 +11,7 @@ apply plugin: 'elasticsearch.build' esplugin { name = 'early-deprecation-plugin' description = 'Deprecated query plugin' - classname = 'org.elasticsearch.xpack.deprecation.EarlyDeprecationTestPlugin' + classname = 'org.elasticsearch.xpack.deprecation.earlyplugin.EarlyDeprecationTestPlugin' } dependencies { diff --git a/x-pack/plugin/deprecation/qa/early-deprecation-plugin/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-plugin/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-plugin/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; From a367de4dab0a4af00534ee345327afa13b1e7b1a Mon Sep 17 00:00:00 2001 From: Lorenzo Dematte Date: Tue, 5 Aug 2025 18:28:34 +0200 Subject: [PATCH 8/8] Trim down module/plugins dependency set --- x-pack/plugin/deprecation/qa/build.gradle | 21 +++++++++++-------- .../xpack/deprecation/DeprecationHttpIT.java | 9 +++++--- .../EarlyDeprecationIndexingIT.java | 10 ++++++--- .../xpack/deprecation/MlDeprecationIT.java | 13 +++++++++--- 4 files changed, 35 insertions(+), 18 deletions(-) diff --git a/x-pack/plugin/deprecation/qa/build.gradle b/x-pack/plugin/deprecation/qa/build.gradle index 6027f7751f33f..49af65e680d62 100644 --- a/x-pack/plugin/deprecation/qa/build.gradle +++ b/x-pack/plugin/deprecation/qa/build.gradle @@ -14,15 +14,18 @@ dependencies { javaRestTestImplementation("com.fasterxml.jackson.core:jackson-annotations:${versions.jackson}") javaRestTestImplementation("com.fasterxml.jackson.core:jackson-databind:${versions.jackson}") - clusterPlugins project(':x-pack:plugin:deprecation:qa::early-deprecation-plugin') - clusterPlugins project(':x-pack:plugin:deprecation:qa::deprecation-plugin') -} - -tasks.named('javaRestTest') { - // Tried to just include deprecation, data-streams and ml, but apparently some other non - // immediately apparent plugin is needed - // Example failing build scan: https://gradle-enterprise.elastic.co/s/rxaz3vi2a3tao - usesDefaultDistribution("the .logs.deprecated index can not be written or read with a minimal plugin set") + 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 { diff --git a/x-pack/plugin/deprecation/qa/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/DeprecationHttpIT.java b/x-pack/plugin/deprecation/qa/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/DeprecationHttpIT.java index bd87b238c0e8d..df17c779a15df 100644 --- a/x-pack/plugin/deprecation/qa/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/DeprecationHttpIT.java +++ b/x-pack/plugin/deprecation/qa/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/DeprecationHttpIT.java @@ -26,7 +26,6 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.core.RestApiVersion; import org.elasticsearch.test.cluster.ElasticsearchCluster; -import org.elasticsearch.test.cluster.local.distribution.DistributionType; import org.elasticsearch.test.rest.ESRestTestCase; import org.elasticsearch.xcontent.XContentBuilder; import org.elasticsearch.xcontent.json.JsonXContent; @@ -71,8 +70,12 @@ public class DeprecationHttpIT extends ESRestTestCase { @ClassRule public static ElasticsearchCluster cluster = ElasticsearchCluster.local() - .distribution(DistributionType.DEFAULT) - .plugin("deprecation-plugin") + .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") diff --git a/x-pack/plugin/deprecation/qa/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/EarlyDeprecationIndexingIT.java b/x-pack/plugin/deprecation/qa/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/EarlyDeprecationIndexingIT.java index ebf9e17fe7500..b5a42d27bc6b1 100644 --- a/x-pack/plugin/deprecation/qa/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/EarlyDeprecationIndexingIT.java +++ b/x-pack/plugin/deprecation/qa/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/EarlyDeprecationIndexingIT.java @@ -16,7 +16,6 @@ import org.elasticsearch.client.RestClientBuilder; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.cluster.ElasticsearchCluster; -import org.elasticsearch.test.cluster.local.distribution.DistributionType; import org.elasticsearch.test.rest.ESRestTestCase; import org.junit.ClassRule; @@ -40,8 +39,13 @@ public class EarlyDeprecationIndexingIT extends ESRestTestCase { @ClassRule public static ElasticsearchCluster cluster = ElasticsearchCluster.local() - .distribution(DistributionType.DEFAULT) - .plugin("early-deprecation-plugin") + .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") diff --git a/x-pack/plugin/deprecation/qa/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/MlDeprecationIT.java b/x-pack/plugin/deprecation/qa/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/MlDeprecationIT.java index 2ff60b1998e56..4ee5f39e8df55 100644 --- a/x-pack/plugin/deprecation/qa/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/MlDeprecationIT.java +++ b/x-pack/plugin/deprecation/qa/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/MlDeprecationIT.java @@ -14,7 +14,6 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.search.SearchModule; import org.elasticsearch.test.cluster.ElasticsearchCluster; -import org.elasticsearch.test.cluster.local.distribution.DistributionType; import org.elasticsearch.test.rest.ESRestTestCase; import org.elasticsearch.xcontent.NamedXContentRegistry; import org.junit.After; @@ -33,8 +32,16 @@ public class MlDeprecationIT extends ESRestTestCase { @ClassRule public static ElasticsearchCluster cluster = ElasticsearchCluster.local() - .distribution(DistributionType.DEFAULT) - .plugin("deprecation-plugin") + .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")