Skip to content

Commit

Permalink
Update ingest-user-agent module to use new rest test framework (elast…
Browse files Browse the repository at this point in the history
  • Loading branch information
brianseeders authored Oct 30, 2023
1 parent eb39d6f commit 21a230f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
8 changes: 2 additions & 6 deletions modules/ingest-user-agent/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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")
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,29 @@
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 {

public IngestUserAgentClientYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidate testCandidate) {
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<Object[]> parameters() throws Exception {
return ESClientYamlSuiteTestCase.createParameters();
Expand Down

0 comments on commit 21a230f

Please sign in to comment.