From 21a230f825e6c84cc3054ad1847ed812a6a64ec2 Mon Sep 17 00:00:00 2001 From: Brian Seeders Date: Mon, 30 Oct 2023 13:42:49 -0400 Subject: [PATCH] Update ingest-user-agent module to use new rest test framework (#100736) --- modules/ingest-user-agent/build.gradle | 8 ++------ .../IngestUserAgentClientYamlTestSuiteIT.java | 14 ++++++++++++++ .../resources}/test-regexes.yml | 0 3 files changed, 16 insertions(+), 6 deletions(-) rename modules/ingest-user-agent/src/{test => yamlRestTest/resources}/test-regexes.yml (100%) diff --git a/modules/ingest-user-agent/build.gradle b/modules/ingest-user-agent/build.gradle index 5d3ae968b7878..64cd38c584820 100644 --- a/modules/ingest-user-agent/build.gradle +++ b/modules/ingest-user-agent/build.gradle @@ -5,8 +5,8 @@ * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ -apply plugin: 'elasticsearch.legacy-yaml-rest-test' -apply plugin: 'elasticsearch.legacy-yaml-rest-compat-test' +apply plugin: 'elasticsearch.internal-yaml-rest-test' +apply plugin: 'elasticsearch.yaml-rest-compat-test' esplugin { description 'Ingest processor that extracts information from a user agent' @@ -19,10 +19,6 @@ restResources { } } -testClusters.configureEach { - extraConfigFile 'ingest-user-agent/test-regexes.yml', file('src/test/test-regexes.yml') -} - tasks.named("yamlRestTestV7CompatTransform").configure {task -> task.addAllowedWarningRegex("setting \\[ecs\\] is deprecated as ECS format is the default and only option") } diff --git a/modules/ingest-user-agent/src/yamlRestTest/java/org/elasticsearch/ingest/useragent/IngestUserAgentClientYamlTestSuiteIT.java b/modules/ingest-user-agent/src/yamlRestTest/java/org/elasticsearch/ingest/useragent/IngestUserAgentClientYamlTestSuiteIT.java index e7a69f3026965..a942bc6ad8584 100644 --- a/modules/ingest-user-agent/src/yamlRestTest/java/org/elasticsearch/ingest/useragent/IngestUserAgentClientYamlTestSuiteIT.java +++ b/modules/ingest-user-agent/src/yamlRestTest/java/org/elasticsearch/ingest/useragent/IngestUserAgentClientYamlTestSuiteIT.java @@ -11,8 +11,11 @@ import com.carrotsearch.randomizedtesting.annotations.Name; import com.carrotsearch.randomizedtesting.annotations.ParametersFactory; +import org.elasticsearch.test.cluster.ElasticsearchCluster; +import org.elasticsearch.test.cluster.util.resource.Resource; import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate; import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase; +import org.junit.ClassRule; public class IngestUserAgentClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase { @@ -20,6 +23,17 @@ public IngestUserAgentClientYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidat super(testCandidate); } + @ClassRule + public static ElasticsearchCluster cluster = ElasticsearchCluster.local() + .configFile("ingest-user-agent/test-regexes.yml", Resource.fromClasspath("test-regexes.yml")) + .module("ingest-user-agent") + .build(); + + @Override + protected String getTestRestCluster() { + return cluster.getHttpAddresses(); + } + @ParametersFactory public static Iterable parameters() throws Exception { return ESClientYamlSuiteTestCase.createParameters(); diff --git a/modules/ingest-user-agent/src/test/test-regexes.yml b/modules/ingest-user-agent/src/yamlRestTest/resources/test-regexes.yml similarity index 100% rename from modules/ingest-user-agent/src/test/test-regexes.yml rename to modules/ingest-user-agent/src/yamlRestTest/resources/test-regexes.yml