From 604c6dd528b10ae28ebf2c56ca1c08b5516de807 Mon Sep 17 00:00:00 2001 From: Jake Landis Date: Mon, 6 Jul 2020 14:16:26 -0500 Subject: [PATCH] 7.x - Create plugin for yamlTest task (#56841) (#59090) This commit creates a new Gradle plugin to provide a separate task name and source set for running YAML based REST tests. The only project converted to use the new plugin in this PR is distribution/archives/integ-test-zip. For which the testing has been moved to :rest-api-spec since it makes the most sense and it avoids a small but awkward change to the distribution plugin. The remaining cases in modules, plugins, and x-pack will be handled in followups. This plugin is distinctly different from the plugin introduced in #55896 since the YAML REST tests are intended to be black box tests over HTTP. As such they should not (by default) have access to the classpath for that which they are testing. The YAML based REST tests will be moved to separate source sets (yamlRestTest). The which source is the target for the test resources is dependent on if this new plugin is applied. If it is not applied, it will default to the test source set. Further, this introduces a breaking change for plugin developers that use the YAML testing framework. They will now need to either use the new source set and matching task, or configure the rest resources to use the old "test" source set that matches the old integTest task. (The former should be preferred). As part of this change (which is also breaking for plugin developers) the rest resources plugin has been removed from the build plugin and now requires either explicit application or application via the new YAML REST test plugin. Plugin developers should be able to fix the breaking changes to the YAML tests by adding apply plugin: 'elasticsearch.yaml-rest-test' and moving the YAML tests under a yamlRestTest folder (instead of test) --- TESTING.asciidoc | 11 +- .../gradle/plugin/PluginBuildPlugin.groovy | 2 - .../test/StandaloneRestTestPlugin.groovy | 3 - .../gradle/test/RestIntegTestTask.java | 9 ++ .../gradle/test/rest/CopyRestApiTask.java | 60 ++++++--- .../gradle/test/rest/CopyRestTestsTask.java | 26 +++- .../gradle/test/rest/RestResourcesPlugin.java | 13 +- .../gradle/test/rest/YamlRestTestPlugin.java | 126 ++++++++++++++++++ .../gradle/util/GradleUtils.java | 16 ++- .../elasticsearch.yaml-rest-test.properties | 20 +++ distribution/archives/build.gradle | 6 - distribution/docker/build.gradle | 1 + docs/build.gradle | 1 + modules/aggs-matrix-stats/build.gradle | 1 + modules/analysis-common/build.gradle | 1 + modules/geo/build.gradle | 1 + modules/ingest-common/build.gradle | 1 + modules/ingest-geoip/build.gradle | 2 + modules/ingest-user-agent/build.gradle | 1 + modules/lang-expression/build.gradle | 1 + modules/lang-mustache/build.gradle | 1 + modules/lang-painless/build.gradle | 1 + modules/mapper-extras/build.gradle | 3 +- modules/parent-join/build.gradle | 3 +- modules/percolator/build.gradle | 1 + modules/rank-eval/build.gradle | 1 + modules/reindex/build.gradle | 1 + modules/repository-url/build.gradle | 4 +- modules/transport-netty4/build.gradle | 2 + plugins/analysis-icu/build.gradle | 1 + plugins/analysis-kuromoji/build.gradle | 1 + plugins/analysis-nori/build.gradle | 1 + plugins/analysis-phonetic/build.gradle | 1 + plugins/analysis-smartcn/build.gradle | 1 + plugins/analysis-stempel/build.gradle | 1 + plugins/analysis-ukrainian/build.gradle | 1 + plugins/discovery-azure-classic/build.gradle | 1 + plugins/discovery-ec2/build.gradle | 1 + .../discovery-ec2/qa/amazon-ec2/build.gradle | 1 + plugins/discovery-gce/build.gradle | 2 + plugins/discovery-gce/qa/gce/build.gradle | 1 + plugins/examples/custom-settings/build.gradle | 1 + .../build.gradle | 1 + .../examples/custom-suggester/build.gradle | 1 + .../examples/painless-whitelist/build.gradle | 1 + plugins/examples/rescore/build.gradle | 1 + plugins/examples/rest-handler/build.gradle | 1 + .../script-expert-scoring/build.gradle | 1 + .../build.gradle | 1 + plugins/ingest-attachment/build.gradle | 1 + plugins/mapper-annotated-text/build.gradle | 1 + plugins/mapper-murmur3/build.gradle | 1 + plugins/mapper-size/build.gradle | 1 + plugins/repository-azure/build.gradle | 1 + plugins/repository-gcs/build.gradle | 1 + plugins/repository-hdfs/build.gradle | 1 + plugins/repository-s3/build.gradle | 2 + plugins/store-smb/build.gradle | 1 + qa/mixed-cluster/build.gradle | 1 + qa/multi-cluster-search/build.gradle | 1 + qa/rolling-upgrade/build.gradle | 1 + qa/smoke-test-ingest-disabled/build.gradle | 1 + .../build.gradle | 1 + qa/smoke-test-multinode/build.gradle | 1 + qa/smoke-test-plugins/build.gradle | 1 + rest-api-spec/build.gradle | 11 +- .../test/rest/ClientYamlTestSuiteIT.java | 4 +- x-pack/docs/build.gradle | 1 + .../plugin/async-search/qa/rest/build.gradle | 1 + .../plugin/autoscaling/qa/rest/build.gradle | 1 + x-pack/plugin/build.gradle | 7 + x-pack/plugin/ccr/qa/rest/build.gradle | 1 + x-pack/plugin/enrich/qa/rest/build.gradle | 1 + x-pack/plugin/eql/qa/rest/build.gradle | 1 + .../graph/qa/with-security/build.gradle | 1 + x-pack/plugin/ilm/qa/rest/build.gradle | 1 + .../ml/qa/ml-with-security/build.gradle | 1 + .../qa/azure/build.gradle | 1 + .../searchable-snapshots/qa/gcs/build.gradle | 1 + .../qa/minio/build.gradle | 1 + .../searchable-snapshots/qa/rest/build.gradle | 1 + .../searchable-snapshots/qa/s3/build.gradle | 1 + x-pack/plugin/spatial/build.gradle | 1 + x-pack/plugin/stack/qa/rest/build.gradle | 1 + x-pack/plugin/watcher/qa/rest/build.gradle | 1 + .../watcher/qa/with-security/build.gradle | 1 + .../build.gradle | 1 + .../build.gradle | 1 + .../build.gradle | 1 + .../reindex-tests-with-security/build.gradle | 1 + x-pack/qa/rolling-upgrade/build.gradle | 1 + x-pack/qa/smoke-test-plugins-ssl/build.gradle | 1 + x-pack/qa/smoke-test-plugins/build.gradle | 1 + .../build.gradle | 1 + x-pack/qa/third-party/jira/build.gradle | 1 + x-pack/qa/third-party/pagerduty/build.gradle | 1 + x-pack/qa/third-party/slack/build.gradle | 1 + 97 files changed, 351 insertions(+), 57 deletions(-) create mode 100644 buildSrc/src/main/java/org/elasticsearch/gradle/test/rest/YamlRestTestPlugin.java create mode 100644 buildSrc/src/main/resources/META-INF/gradle-plugins/elasticsearch.yaml-rest-test.properties rename distribution/archives/integ-test-zip/src/test/java/org/elasticsearch/test/rest/IntegTestZipClientYamlTestSuiteIT.java => rest-api-spec/src/yamlRestTest/java/org/elasticsearch/test/rest/ClientYamlTestSuiteIT.java (88%) diff --git a/TESTING.asciidoc b/TESTING.asciidoc index c65cd30407e74..9d6b08e03bce9 100644 --- a/TESTING.asciidoc +++ b/TESTING.asciidoc @@ -301,22 +301,21 @@ restResources { } --------------------------------------------------------------------------- -YAML tests that include x-pack specific APIs need to explicitly declare +YAML REST tests that include x-pack specific APIs need to explicitly declare which APIs are required through a similar `includeXpack` configuration. The REST tests are run automatically when executing the "./gradlew check" command. To run only the -REST tests use the following command: +YAML REST tests use the following command (modules and plugins may also include YAML REST tests): --------------------------------------------------------------------------- -./gradlew :distribution:archives:integ-test-zip:integTestRunner \ - --tests "org.elasticsearch.test.rest.IntegTestZipClientYamlTestSuiteIT" +./gradlew :rest-api-spec:yamlRestTest --------------------------------------------------------------------------- A specific test case can be run with the following command: --------------------------------------------------------------------------- -./gradlew ':distribution:archives:integ-test-zip:integTestRunner' \ - --tests "org.elasticsearch.test.rest.IntegTestZipClientYamlTestSuiteIT" \ +./gradlew ':rest-api-spec:yamlRestTestRunner' \ + --tests "org.elasticsearch.test.rest.ClientYamlTestSuiteIT" \ -Dtests.method="test {p0=cat.segments/10_basic/Help}" --------------------------------------------------------------------------- diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/plugin/PluginBuildPlugin.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/plugin/PluginBuildPlugin.groovy index 75409843e0fbf..d9d2748e98cc8 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/plugin/PluginBuildPlugin.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/plugin/PluginBuildPlugin.groovy @@ -24,7 +24,6 @@ import org.elasticsearch.gradle.NoticeTask import org.elasticsearch.gradle.Version import org.elasticsearch.gradle.VersionProperties import org.elasticsearch.gradle.info.BuildParams -import org.elasticsearch.gradle.test.rest.RestResourcesPlugin import org.elasticsearch.gradle.test.RestIntegTestTask import org.elasticsearch.gradle.testclusters.RunTask import org.elasticsearch.gradle.testclusters.TestClustersPlugin @@ -56,7 +55,6 @@ class PluginBuildPlugin implements Plugin { void apply(Project project) { project.pluginManager.apply(BuildPlugin) project.pluginManager.apply(TestClustersPlugin) - project.pluginManager.apply(RestResourcesPlugin) PluginPropertiesExtension extension = project.extensions.create(PLUGIN_EXTENSION_NAME, PluginPropertiesExtension, project) configureDependencies(project) diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/StandaloneRestTestPlugin.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/StandaloneRestTestPlugin.groovy index 779ad7618e5e9..1d6c03666d84f 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/StandaloneRestTestPlugin.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/StandaloneRestTestPlugin.groovy @@ -27,7 +27,6 @@ import org.elasticsearch.gradle.ExportElasticsearchBuildResourcesTask import org.elasticsearch.gradle.info.BuildParams import org.elasticsearch.gradle.info.GlobalBuildInfoPlugin import org.elasticsearch.gradle.precommit.PrecommitTasks -import org.elasticsearch.gradle.test.rest.RestResourcesPlugin import org.elasticsearch.gradle.testclusters.TestClustersPlugin import org.gradle.api.InvalidUserDataException import org.gradle.api.Plugin @@ -73,8 +72,6 @@ class StandaloneRestTestPlugin implements Plugin { // only setup tests to build SourceSetContainer sourceSets = project.extensions.getByType(SourceSetContainer) SourceSet testSourceSet = sourceSets.create('test') - // need to apply plugin after test source sets are created - project.pluginManager.apply(RestResourcesPlugin) project.tasks.withType(Test).configureEach { Test test -> test.testClassesDirs = testSourceSet.output.classesDirs diff --git a/buildSrc/src/main/java/org/elasticsearch/gradle/test/RestIntegTestTask.java b/buildSrc/src/main/java/org/elasticsearch/gradle/test/RestIntegTestTask.java index 4a05067df4543..43af532444506 100644 --- a/buildSrc/src/main/java/org/elasticsearch/gradle/test/RestIntegTestTask.java +++ b/buildSrc/src/main/java/org/elasticsearch/gradle/test/RestIntegTestTask.java @@ -28,6 +28,7 @@ import org.gradle.api.NamedDomainObjectContainer; import org.gradle.api.Project; import org.gradle.api.Task; +import org.gradle.api.tasks.Internal; public class RestIntegTestTask extends DefaultTask { @@ -36,6 +37,9 @@ public class RestIntegTestTask extends DefaultTask { private static final String TESTS_CLUSTER = "tests.cluster"; private static final String TESTS_CLUSTER_NAME = "tests.clustername"; + // TODO: refactor this so that work is not done in constructor and find usages and register them, not create them + // See: https://docs.gradle.org/current/userguide/task_configuration_avoidance.html + // See: https://github.com/elastic/elasticsearch/issues/47804 public RestIntegTestTask() { Project project = getProject(); String name = getName(); @@ -101,4 +105,9 @@ public void setDependsOn(Iterable dependencies) { public void runner(Action configure) { configure.execute(runner); } + + @Internal + public RestTestRunnerTask getRunner() { + return runner; + } } diff --git a/buildSrc/src/main/java/org/elasticsearch/gradle/test/rest/CopyRestApiTask.java b/buildSrc/src/main/java/org/elasticsearch/gradle/test/rest/CopyRestApiTask.java index a059400844c3d..0caf6bdc543c2 100644 --- a/buildSrc/src/main/java/org/elasticsearch/gradle/test/rest/CopyRestApiTask.java +++ b/buildSrc/src/main/java/org/elasticsearch/gradle/test/rest/CopyRestApiTask.java @@ -26,6 +26,7 @@ import org.gradle.api.artifacts.Configuration; import org.gradle.api.file.ConfigurableFileCollection; import org.gradle.api.file.FileTree; +import org.gradle.api.plugins.JavaPluginConvention; import org.gradle.api.provider.ListProperty; import org.gradle.api.tasks.Input; import org.gradle.api.tasks.InputFiles; @@ -41,6 +42,8 @@ import java.io.File; import java.io.IOException; import java.nio.file.Files; +import java.util.Objects; +import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; @@ -54,7 +57,7 @@ public class CopyRestApiTask extends DefaultTask { private static final String REST_API_PREFIX = "rest-api-spec/api"; final ListProperty includeCore = getProject().getObjects().listProperty(String.class); final ListProperty includeXpack = getProject().getObjects().listProperty(String.class); - + String sourceSetName; Configuration coreConfig; Configuration xpackConfig; @@ -81,6 +84,11 @@ public ListProperty getIncludeXpack() { return includeXpack; } + @Input + String getSourceSetName() { + return sourceSetName; + } + @SkipWhenEmpty @InputFiles public FileTree getInputDir() { @@ -109,7 +117,12 @@ public FileTree getInputDir() { @OutputDirectory public File getOutputDir() { - return new File(getTestSourceSet().getOutput().getResourcesDir(), REST_API_PREFIX); + return new File( + getSourceSet().orElseThrow(() -> new IllegalArgumentException("could not find source set [" + sourceSetName + "]")) + .getOutput() + .getResourcesDir(), + REST_API_PREFIX + ); } @TaskAction @@ -131,7 +144,8 @@ void copy() { ); project.copy(c -> { c.from(project.zipTree(coreConfig.getSingleFile())); - c.into(getTestSourceSet().getOutput().getResourcesDir()); // this ends up as the same dir as outputDir + // this ends up as the same dir as outputDir + c.into(Objects.requireNonNull(getSourceSet().orElseThrow().getOutput().getResourcesDir())); if (includeCore.get().isEmpty()) { c.include(REST_API_PREFIX + "/**"); } else { @@ -178,31 +192,33 @@ private boolean projectHasYamlRestTests() { } private File getTestSourceResourceDir() { - SourceSet testSources = getTestSourceSet(); - if (testSources == null) { - return null; - } - Set resourceDir = testSources.getResources() - .getSrcDirs() - .stream() - .filter(f -> f.isDirectory() && f.getParentFile().getName().equals("test") && f.getName().equals("resources")) - .collect(Collectors.toSet()); - assert resourceDir.size() <= 1; - if (resourceDir.size() == 0) { + Optional testSourceSet = getSourceSet(); + if (testSourceSet.isPresent()) { + SourceSet testSources = testSourceSet.get(); + Set resourceDir = testSources.getResources() + .getSrcDirs() + .stream() + .filter(f -> f.isDirectory() && f.getParentFile().getName().equals("test") && f.getName().equals("resources")) + .collect(Collectors.toSet()); + assert resourceDir.size() <= 1; + if (resourceDir.size() == 0) { + return null; + } + return resourceDir.iterator().next(); + } else { return null; } - return resourceDir.iterator().next(); } private File getTestOutputResourceDir() { - SourceSet testSources = getTestSourceSet(); - if (testSources == null) { - return null; - } - return testSources.getOutput().getResourcesDir(); + Optional testSourceSet = getSourceSet(); + return testSourceSet.map(sourceSet -> sourceSet.getOutput().getResourcesDir()).orElse(null); } - private SourceSet getTestSourceSet() { - return GradleUtils.getJavaSourceSets(getProject()).findByName("test"); + private Optional getSourceSet() { + Project project = getProject(); + return project.getConvention().findPlugin(JavaPluginConvention.class) == null + ? Optional.empty() + : Optional.ofNullable(GradleUtils.getJavaSourceSets(project).findByName(getSourceSetName())); } } diff --git a/buildSrc/src/main/java/org/elasticsearch/gradle/test/rest/CopyRestTestsTask.java b/buildSrc/src/main/java/org/elasticsearch/gradle/test/rest/CopyRestTestsTask.java index 0d067b40edb29..089e8d2b03ff7 100644 --- a/buildSrc/src/main/java/org/elasticsearch/gradle/test/rest/CopyRestTestsTask.java +++ b/buildSrc/src/main/java/org/elasticsearch/gradle/test/rest/CopyRestTestsTask.java @@ -26,6 +26,7 @@ import org.gradle.api.artifacts.Configuration; import org.gradle.api.file.ConfigurableFileCollection; import org.gradle.api.file.FileTree; +import org.gradle.api.plugins.JavaPluginConvention; import org.gradle.api.provider.ListProperty; import org.gradle.api.tasks.Input; import org.gradle.api.tasks.InputFiles; @@ -39,6 +40,8 @@ import javax.inject.Inject; import java.io.File; +import java.util.Objects; +import java.util.Optional; import java.util.stream.Collectors; /** @@ -52,6 +55,7 @@ public class CopyRestTestsTask extends DefaultTask { final ListProperty includeCore = getProject().getObjects().listProperty(String.class); final ListProperty includeXpack = getProject().getObjects().listProperty(String.class); + String sourceSetName; Configuration coreConfig; Configuration xpackConfig; @@ -78,6 +82,11 @@ public ListProperty getIncludeXpack() { return includeXpack; } + @Input + String getSourceSetName() { + return sourceSetName; + } + @SkipWhenEmpty @InputFiles public FileTree getInputDir() { @@ -103,7 +112,12 @@ public FileTree getInputDir() { @OutputDirectory public File getOutputDir() { - return new File(getTestSourceSet().getOutput().getResourcesDir(), REST_TEST_PREFIX); + return new File( + getSourceSet().orElseThrow(() -> new IllegalArgumentException("could not find source set [" + sourceSetName + "]")) + .getOutput() + .getResourcesDir(), + REST_TEST_PREFIX + ); } @TaskAction @@ -127,7 +141,8 @@ void copy() { ); project.copy(c -> { c.from(project.zipTree(coreConfig.getSingleFile())); - c.into(getTestSourceSet().getOutput().getResourcesDir()); // this ends up as the same dir as outputDir + // this ends up as the same dir as outputDir + c.into(Objects.requireNonNull(getSourceSet().orElseThrow().getOutput().getResourcesDir())); c.include( includeCore.get().stream().map(prefix -> REST_TEST_PREFIX + "/" + prefix + "*/**").collect(Collectors.toList()) ); @@ -145,7 +160,10 @@ void copy() { } } - private SourceSet getTestSourceSet() { - return GradleUtils.getJavaSourceSets(getProject()).findByName("test"); + private Optional getSourceSet() { + Project project = getProject(); + return project.getConvention().findPlugin(JavaPluginConvention.class) == null + ? Optional.empty() + : Optional.ofNullable(GradleUtils.getJavaSourceSets(project).findByName(getSourceSetName())); } } diff --git a/buildSrc/src/main/java/org/elasticsearch/gradle/test/rest/RestResourcesPlugin.java b/buildSrc/src/main/java/org/elasticsearch/gradle/test/rest/RestResourcesPlugin.java index fb2f2264a0720..e2eabe469c975 100644 --- a/buildSrc/src/main/java/org/elasticsearch/gradle/test/rest/RestResourcesPlugin.java +++ b/buildSrc/src/main/java/org/elasticsearch/gradle/test/rest/RestResourcesPlugin.java @@ -25,6 +25,8 @@ import org.gradle.api.artifacts.Configuration; import org.gradle.api.artifacts.Dependency; import org.gradle.api.provider.Provider; +import org.gradle.api.tasks.SourceSet; +import org.gradle.api.tasks.SourceSetContainer; import java.util.Map; @@ -76,6 +78,7 @@ * Will copy any of the the x-pack tests that start with graph, and will copy the X-pack graph specification, as well as the full core * Rest API specification. * + * Additionally you can specify which sourceSetName resources should be copied to. The default is the yamlRestTest source set. * @see CopyRestApiTask * @see CopyRestTestsTask */ @@ -97,6 +100,7 @@ public void apply(Project project) { task.includeCore.set(extension.restTests.getIncludeCore()); task.includeXpack.set(extension.restTests.getIncludeXpack()); task.coreConfig = testConfig; + task.sourceSetName = SourceSet.TEST_SOURCE_SET_NAME; if (BuildParams.isInternal()) { // core Dependency restTestdependency = project.getDependencies() @@ -127,6 +131,7 @@ public void apply(Project project) { task.includeXpack.set(extension.restApi.getIncludeXpack()); task.dependsOn(copyRestYamlTestTask); task.coreConfig = specConfig; + task.sourceSetName = SourceSet.TEST_SOURCE_SET_NAME; if (BuildParams.isInternal()) { Dependency restSpecDependency = project.getDependencies() .project(Map.of("path", ":rest-api-spec", "configuration", "restSpecs")); @@ -144,6 +149,12 @@ public void apply(Project project) { task.dependsOn(task.coreConfig); }); - project.getTasks().named("processTestResources").configure(t -> t.dependsOn(copyRestYamlSpecTask)); + project.afterEvaluate(p -> { + SourceSetContainer sourceSets = project.getExtensions().getByType(SourceSetContainer.class); + SourceSet testSourceSet = sourceSets.findByName(SourceSet.TEST_SOURCE_SET_NAME); + if (testSourceSet != null) { + project.getTasks().named(testSourceSet.getProcessResourcesTaskName()).configure(t -> t.dependsOn(copyRestYamlSpecTask)); + } + }); } } diff --git a/buildSrc/src/main/java/org/elasticsearch/gradle/test/rest/YamlRestTestPlugin.java b/buildSrc/src/main/java/org/elasticsearch/gradle/test/rest/YamlRestTestPlugin.java new file mode 100644 index 0000000000000..676d2ffbf6268 --- /dev/null +++ b/buildSrc/src/main/java/org/elasticsearch/gradle/test/rest/YamlRestTestPlugin.java @@ -0,0 +1,126 @@ +/* + * Licensed to Elasticsearch under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.elasticsearch.gradle.test.rest; + +import org.elasticsearch.gradle.ElasticsearchJavaPlugin; +import org.elasticsearch.gradle.VersionProperties; +import org.elasticsearch.gradle.info.BuildParams; +import org.elasticsearch.gradle.plugin.PluginPropertiesExtension; +import org.elasticsearch.gradle.test.RestIntegTestTask; +import org.elasticsearch.gradle.testclusters.RestTestRunnerTask; +import org.elasticsearch.gradle.testclusters.TestClustersPlugin; +import org.elasticsearch.gradle.util.GradleUtils; +import org.gradle.api.Plugin; +import org.gradle.api.Project; +import org.gradle.api.plugins.JavaBasePlugin; +import org.gradle.api.tasks.SourceSet; +import org.gradle.api.tasks.SourceSetContainer; +import org.gradle.api.tasks.bundling.Zip; + +/** + * Apply this plugin to run the YAML based REST tests. + */ +public class YamlRestTestPlugin implements Plugin { + + public static final String SOURCE_SET_NAME = "yamlRestTest"; + + @Override + public void apply(Project project) { + + // yaml Rest tests require a Java test runner + project.getPluginManager().apply(ElasticsearchJavaPlugin.class); + // to spin up the external cluster + project.getPluginManager().apply(TestClustersPlugin.class); + // to copy around the yaml tests and json spec + project.getPluginManager().apply(RestResourcesPlugin.class); + + // note - source sets are not created via org.elasticsearch.gradle.util.GradleUtils.addTestSourceSet since unlike normal tests + // we only want the yamlRestTestSourceSet on the classpath by default. The yaml tests should be pure black box testing over HTTP and + // such it should not need the main class on the class path. Also, there are some special setup steps unique to YAML REST tests. + + // create source set + SourceSetContainer sourceSets = project.getExtensions().getByType(SourceSetContainer.class); + SourceSet yamlTestSourceSet = sourceSets.create(SOURCE_SET_NAME); + + // create task - note can not use .register due to the work in RestIntegTestTask's constructor :( + // see: https://github.com/elastic/elasticsearch/issues/47804 + RestIntegTestTask yamlRestTestTask = project.getTasks().create(SOURCE_SET_NAME, RestIntegTestTask.class); + yamlRestTestTask.setGroup(JavaBasePlugin.VERIFICATION_GROUP); + yamlRestTestTask.setDescription("Runs the YAML based REST tests against an external cluster"); + + // setup task dependency + if (BuildParams.isInternal()) { + project.getDependencies().add(yamlTestSourceSet.getImplementationConfigurationName(), project.project(":test:framework")); + } else { + project.getDependencies() + .add( + yamlTestSourceSet.getImplementationConfigurationName(), + "org.elasticsearch.test:framework:" + VersionProperties.getElasticsearch() + ); + } + + // setup the copy for the rest resources + project.getTasks().withType(CopyRestApiTask.class, copyRestApiTask -> { + copyRestApiTask.sourceSetName = SOURCE_SET_NAME; + project.getTasks().named(yamlTestSourceSet.getProcessResourcesTaskName()).configure(t -> t.dependsOn(copyRestApiTask)); + }); + project.getTasks().withType(CopyRestTestsTask.class, copyRestTestTask -> { copyRestTestTask.sourceSetName = SOURCE_SET_NAME; }); + + // make the new test run after unit tests + yamlRestTestTask.mustRunAfter(project.getTasks().named("test")); + + // setup the runner + RestTestRunnerTask runner = yamlRestTestTask.getRunner(); + runner.setTestClassesDirs(yamlTestSourceSet.getOutput().getClassesDirs()); + runner.setClasspath(yamlTestSourceSet.getRuntimeClasspath()); + + // if this a module or plugin, it may have an associated zip file with it's contents, add that to the test cluster + project.getPluginManager().withPlugin("elasticsearch.esplugin", plugin -> { + Zip bundle = (Zip) project.getTasks().getByName("bundlePlugin"); + yamlRestTestTask.dependsOn(bundle); + if (project.getPath().startsWith(":modules:")) { + runner.getClusters().forEach(c -> c.module(bundle.getArchiveFile())); + } else { + runner.getClusters().forEach(c -> c.plugin(project.getObjects().fileProperty().value(bundle.getArchiveFile()))); + } + }); + + // es-plugins may declare dependencies on additional modules, add those to the test cluster too. + project.afterEvaluate(p -> { + PluginPropertiesExtension pluginPropertiesExtension = project.getExtensions().findByType(PluginPropertiesExtension.class); + if (pluginPropertiesExtension != null) { // not all projects are defined as plugins + pluginPropertiesExtension.getExtendedPlugins().forEach(pluginName -> { + Project extensionProject = project.getProject().findProject(":modules:" + pluginName); + if (extensionProject != null) { // extension plugin may be defined, but not required to be a module + Zip extensionBundle = (Zip) extensionProject.getTasks().getByName("bundlePlugin"); + yamlRestTestTask.dependsOn(extensionBundle); + runner.getClusters().forEach(c -> c.module(extensionBundle.getArchiveFile())); + } + }); + } + }); + + // setup IDE + GradleUtils.setupIdeForTestSourceSet(project, yamlTestSourceSet); + + // wire this task into check + project.getTasks().named(JavaBasePlugin.CHECK_TASK_NAME).configure(check -> check.dependsOn(yamlRestTestTask)); + } +} diff --git a/buildSrc/src/main/java/org/elasticsearch/gradle/util/GradleUtils.java b/buildSrc/src/main/java/org/elasticsearch/gradle/util/GradleUtils.java index dc9a101f64b57..c628d33ebb4d3 100644 --- a/buildSrc/src/main/java/org/elasticsearch/gradle/util/GradleUtils.java +++ b/buildSrc/src/main/java/org/elasticsearch/gradle/util/GradleUtils.java @@ -163,6 +163,15 @@ public static TaskProvider addTestSourceSet(Project project, String sourceSet extendSourceSet(project, SourceSet.MAIN_SOURCE_SET_NAME, sourceSetName); + setupIdeForTestSourceSet(project, testSourceSet); + + // add to the check task + project.getTasks().named(JavaBasePlugin.CHECK_TASK_NAME).configure(check -> check.dependsOn(testTask)); + + return testTask; + } + + public static void setupIdeForTestSourceSet(Project project, SourceSet testSourceSet) { // setup IDEs String runtimeClasspathName = testSourceSet.getRuntimeClasspathConfigurationName(); Configuration runtimeClasspathConfiguration = project.getConfigurations().getByName(runtimeClasspathName); @@ -178,14 +187,9 @@ public static TaskProvider addTestSourceSet(Project project, String sourceSet eclipseSourceSets.add(old); } eclipseSourceSets.add(testSourceSet); - eclipse.getClasspath().setSourceSets(sourceSets); + eclipse.getClasspath().setSourceSets(project.getExtensions().getByType(SourceSetContainer.class)); eclipse.getClasspath().getPlusConfigurations().add(runtimeClasspathConfiguration); }); - - // add to the check task - project.getTasks().named(JavaBasePlugin.CHECK_TASK_NAME).configure(check -> check.dependsOn(testTask)); - - return testTask; } /** diff --git a/buildSrc/src/main/resources/META-INF/gradle-plugins/elasticsearch.yaml-rest-test.properties b/buildSrc/src/main/resources/META-INF/gradle-plugins/elasticsearch.yaml-rest-test.properties new file mode 100644 index 0000000000000..9d38c3cdc2622 --- /dev/null +++ b/buildSrc/src/main/resources/META-INF/gradle-plugins/elasticsearch.yaml-rest-test.properties @@ -0,0 +1,20 @@ +# +# Licensed to Elasticsearch under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +implementation-class=org.elasticsearch.gradle.test.rest.YamlRestTestPlugin diff --git a/distribution/archives/build.gradle b/distribution/archives/build.gradle index bbb26ef43522e..00aa86d01136c 100644 --- a/distribution/archives/build.gradle +++ b/distribution/archives/build.gradle @@ -332,12 +332,6 @@ configure(subprojects.findAll { it.name == 'integ-test-zip' }) { group = "org.elasticsearch.distribution.integ-test-zip" - restResources { - restTests { - includeCore '*' - } - } - integTest { dependsOn assemble runner { diff --git a/distribution/docker/build.gradle b/distribution/docker/build.gradle index e4dd5e1ba30a5..764be39a941d2 100644 --- a/distribution/docker/build.gradle +++ b/distribution/docker/build.gradle @@ -9,6 +9,7 @@ import org.elasticsearch.gradle.testfixtures.TestFixturesPlugin apply plugin: 'elasticsearch.standalone-rest-test' apply plugin: 'elasticsearch.test.fixtures' apply plugin: 'elasticsearch.distribution-download' +apply plugin: 'elasticsearch.rest-resources' testFixtures.useFixture() diff --git a/docs/build.gradle b/docs/build.gradle index 6dd85ad79fd93..9db63588f1262 100644 --- a/docs/build.gradle +++ b/docs/build.gradle @@ -22,6 +22,7 @@ import static org.elasticsearch.gradle.testclusters.TestDistribution.DEFAULT */ apply plugin: 'elasticsearch.docs-test' +apply plugin: 'elasticsearch.rest-resources' /* List of files that have snippets that will not work until platinum tests can occur ... */ buildRestTests.expectedUnconvertedCandidates = [ diff --git a/modules/aggs-matrix-stats/build.gradle b/modules/aggs-matrix-stats/build.gradle index 07ebf5950448d..705dda76f5c07 100644 --- a/modules/aggs-matrix-stats/build.gradle +++ b/modules/aggs-matrix-stats/build.gradle @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ +apply plugin: 'elasticsearch.rest-resources' esplugin { description 'Adds aggregations whose input are a list of numeric fields and output includes a matrix.' diff --git a/modules/analysis-common/build.gradle b/modules/analysis-common/build.gradle index 24e6e651c3fd9..4af7cf09b4ca7 100644 --- a/modules/analysis-common/build.gradle +++ b/modules/analysis-common/build.gradle @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ +apply plugin: 'elasticsearch.rest-resources' esplugin { description 'Adds "built in" analyzers to Elasticsearch.' diff --git a/modules/geo/build.gradle b/modules/geo/build.gradle index 9e1eb22ef3205..e0f5147df8b90 100644 --- a/modules/geo/build.gradle +++ b/modules/geo/build.gradle @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ +apply plugin: 'elasticsearch.rest-resources' esplugin { description 'Placeholder plugin for geospatial features in ES. only registers geo_shape field mapper for now' diff --git a/modules/ingest-common/build.gradle b/modules/ingest-common/build.gradle index ddadef788c560..3026670bb33d4 100644 --- a/modules/ingest-common/build.gradle +++ b/modules/ingest-common/build.gradle @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ +apply plugin: 'elasticsearch.rest-resources' esplugin { description 'Module for ingest processors that do not require additional security permissions or have large dependencies and resources' diff --git a/modules/ingest-geoip/build.gradle b/modules/ingest-geoip/build.gradle index 58e351c80338d..f1e26b8dabcb2 100644 --- a/modules/ingest-geoip/build.gradle +++ b/modules/ingest-geoip/build.gradle @@ -19,6 +19,8 @@ import org.apache.tools.ant.taskdefs.condition.Os +apply plugin: 'elasticsearch.rest-resources' + esplugin { description 'Ingest processor that uses looksup geo data based on ip adresses using the Maxmind geo database' classname 'org.elasticsearch.ingest.geoip.IngestGeoIpPlugin' diff --git a/modules/ingest-user-agent/build.gradle b/modules/ingest-user-agent/build.gradle index d45b30c9f1daf..9b12ab11df7c6 100644 --- a/modules/ingest-user-agent/build.gradle +++ b/modules/ingest-user-agent/build.gradle @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ +apply plugin: 'elasticsearch.rest-resources' esplugin { description 'Ingest processor that extracts information from a user agent' diff --git a/modules/lang-expression/build.gradle b/modules/lang-expression/build.gradle index b7e66d375a2ea..41b31a65fd424 100644 --- a/modules/lang-expression/build.gradle +++ b/modules/lang-expression/build.gradle @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ +apply plugin: 'elasticsearch.rest-resources' esplugin { description 'Lucene expressions integration for Elasticsearch' diff --git a/modules/lang-mustache/build.gradle b/modules/lang-mustache/build.gradle index 2a4fffdebf7d2..f8a3920cffc64 100644 --- a/modules/lang-mustache/build.gradle +++ b/modules/lang-mustache/build.gradle @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ +apply plugin: 'elasticsearch.rest-resources' esplugin { description 'Mustache scripting integration for Elasticsearch' diff --git a/modules/lang-painless/build.gradle b/modules/lang-painless/build.gradle index 027c35db9b332..03b161e12063a 100644 --- a/modules/lang-painless/build.gradle +++ b/modules/lang-painless/build.gradle @@ -18,6 +18,7 @@ */ import org.elasticsearch.gradle.testclusters.DefaultTestClustersTask; +apply plugin: 'elasticsearch.rest-resources' apply plugin: 'elasticsearch.validate-rest-spec' esplugin { diff --git a/modules/mapper-extras/build.gradle b/modules/mapper-extras/build.gradle index ccc2d2c239830..fb5e8a7b03b2b 100644 --- a/modules/mapper-extras/build.gradle +++ b/modules/mapper-extras/build.gradle @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ +apply plugin: 'elasticsearch.rest-resources' esplugin { description 'Adds advanced field mappers' @@ -25,6 +26,6 @@ esplugin { restResources { restApi { - includeCore '_common', 'cluster', 'nodes', 'indices', 'index', 'search', 'get' + includeCore '_common', 'cluster', 'nodes', 'indices', 'index', 'search', 'get' } } diff --git a/modules/parent-join/build.gradle b/modules/parent-join/build.gradle index 28f2c1823a14d..594d81c0740e8 100644 --- a/modules/parent-join/build.gradle +++ b/modules/parent-join/build.gradle @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ +apply plugin: 'elasticsearch.rest-resources' esplugin { description 'This module adds the support parent-child queries and aggregations' @@ -25,6 +26,6 @@ esplugin { restResources { restApi { - includeCore '_common', 'cluster', 'nodes', 'indices', 'index', 'search' + includeCore '_common', 'cluster', 'nodes', 'indices', 'index', 'search' } } diff --git a/modules/percolator/build.gradle b/modules/percolator/build.gradle index e1b0c81f9f8ee..926a6d2f9251e 100644 --- a/modules/percolator/build.gradle +++ b/modules/percolator/build.gradle @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ +apply plugin: 'elasticsearch.rest-resources' esplugin { description 'Percolator module adds capability to index queries and query these queries by specifying documents' diff --git a/modules/rank-eval/build.gradle b/modules/rank-eval/build.gradle index 582833dc1bd22..3e6d41060c577 100644 --- a/modules/rank-eval/build.gradle +++ b/modules/rank-eval/build.gradle @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ +apply plugin: 'elasticsearch.rest-resources' esplugin { description 'The Rank Eval module adds APIs to evaluate ranking quality.' diff --git a/modules/reindex/build.gradle b/modules/reindex/build.gradle index c5539b8933fc5..b34bb82cce534 100644 --- a/modules/reindex/build.gradle +++ b/modules/reindex/build.gradle @@ -24,6 +24,7 @@ import org.elasticsearch.gradle.info.BuildParams apply plugin: 'elasticsearch.test-with-dependencies' apply plugin: 'elasticsearch.jdk-download' +apply plugin: 'elasticsearch.rest-resources' esplugin { description 'The Reindex module adds APIs to reindex from one index to another or update documents in place.' diff --git a/modules/repository-url/build.gradle b/modules/repository-url/build.gradle index cec28b1d00fc8..9eaf68b7641a2 100644 --- a/modules/repository-url/build.gradle +++ b/modules/repository-url/build.gradle @@ -21,6 +21,8 @@ import org.elasticsearch.gradle.PropertyNormalization import org.elasticsearch.gradle.info.BuildParams import org.elasticsearch.gradle.test.AntFixture +apply plugin: 'elasticsearch.rest-resources' + esplugin { description 'Module for URL repository' classname 'org.elasticsearch.plugin.repository.url.URLRepositoryPlugin' @@ -28,7 +30,7 @@ esplugin { restResources { restApi { - includeCore '_common', 'cluster', 'nodes', 'indices', 'index', 'bulk', 'count', 'snapshot' + includeCore '_common', 'cluster', 'nodes', 'indices', 'index', 'bulk', 'count', 'snapshot' } } diff --git a/modules/transport-netty4/build.gradle b/modules/transport-netty4/build.gradle index d451b18303624..2095bf1e8cc44 100644 --- a/modules/transport-netty4/build.gradle +++ b/modules/transport-netty4/build.gradle @@ -21,6 +21,8 @@ import org.elasticsearch.gradle.info.BuildParams import org.elasticsearch.gradle.test.RestIntegTestTask +apply plugin: 'elasticsearch.rest-resources' + /* TODOs: * fix permissions such that only netty4 can open sockets etc? diff --git a/plugins/analysis-icu/build.gradle b/plugins/analysis-icu/build.gradle index 1709b9ff23b53..5294868ae2d71 100644 --- a/plugins/analysis-icu/build.gradle +++ b/plugins/analysis-icu/build.gradle @@ -18,6 +18,7 @@ import de.thetaphi.forbiddenapis.gradle.CheckForbiddenApis * specific language governing permissions and limitations * under the License. */ +apply plugin: 'elasticsearch.rest-resources' esplugin { description 'The ICU Analysis plugin integrates the Lucene ICU module into Elasticsearch, adding ICU-related analysis components.' diff --git a/plugins/analysis-kuromoji/build.gradle b/plugins/analysis-kuromoji/build.gradle index 138c2c0d3a9a1..c3d2576ccc821 100644 --- a/plugins/analysis-kuromoji/build.gradle +++ b/plugins/analysis-kuromoji/build.gradle @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ +apply plugin: 'elasticsearch.rest-resources' esplugin { description 'The Japanese (kuromoji) Analysis plugin integrates Lucene kuromoji analysis module into elasticsearch.' diff --git a/plugins/analysis-nori/build.gradle b/plugins/analysis-nori/build.gradle index 2e3fb1d45d6cd..001e149804fab 100644 --- a/plugins/analysis-nori/build.gradle +++ b/plugins/analysis-nori/build.gradle @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ +apply plugin: 'elasticsearch.rest-resources' esplugin { description 'The Korean (nori) Analysis plugin integrates Lucene nori analysis module into elasticsearch.' diff --git a/plugins/analysis-phonetic/build.gradle b/plugins/analysis-phonetic/build.gradle index 064790822880a..db035eeb98a88 100644 --- a/plugins/analysis-phonetic/build.gradle +++ b/plugins/analysis-phonetic/build.gradle @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ +apply plugin: 'elasticsearch.rest-resources' esplugin { description 'The Phonetic Analysis plugin integrates phonetic token filter analysis with elasticsearch.' diff --git a/plugins/analysis-smartcn/build.gradle b/plugins/analysis-smartcn/build.gradle index 1a03c597b3d88..1dd36e9305031 100644 --- a/plugins/analysis-smartcn/build.gradle +++ b/plugins/analysis-smartcn/build.gradle @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ +apply plugin: 'elasticsearch.rest-resources' esplugin { description 'Smart Chinese Analysis plugin integrates Lucene Smart Chinese analysis module into elasticsearch.' diff --git a/plugins/analysis-stempel/build.gradle b/plugins/analysis-stempel/build.gradle index c86b502ccb230..4cfc7c01742fa 100644 --- a/plugins/analysis-stempel/build.gradle +++ b/plugins/analysis-stempel/build.gradle @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ +apply plugin: 'elasticsearch.rest-resources' esplugin { description 'The Stempel (Polish) Analysis plugin integrates Lucene stempel (polish) analysis module into elasticsearch.' diff --git a/plugins/analysis-ukrainian/build.gradle b/plugins/analysis-ukrainian/build.gradle index 9728a29bfd671..9ee5b17bff4ac 100644 --- a/plugins/analysis-ukrainian/build.gradle +++ b/plugins/analysis-ukrainian/build.gradle @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ +apply plugin: 'elasticsearch.rest-resources' esplugin { description 'The Ukrainian Analysis plugin integrates the Lucene UkrainianMorfologikAnalyzer into elasticsearch.' diff --git a/plugins/discovery-azure-classic/build.gradle b/plugins/discovery-azure-classic/build.gradle index a72d5396fc0b0..1b799ebe4c6ab 100644 --- a/plugins/discovery-azure-classic/build.gradle +++ b/plugins/discovery-azure-classic/build.gradle @@ -19,6 +19,7 @@ import org.elasticsearch.gradle.info.BuildParams * specific language governing permissions and limitations * under the License. */ +apply plugin: 'elasticsearch.rest-resources' esplugin { description 'The Azure Classic Discovery plugin allows to use Azure Classic API for the unicast discovery mechanism' diff --git a/plugins/discovery-ec2/build.gradle b/plugins/discovery-ec2/build.gradle index eef654380b696..d98cb4f031e02 100644 --- a/plugins/discovery-ec2/build.gradle +++ b/plugins/discovery-ec2/build.gradle @@ -18,6 +18,7 @@ import org.elasticsearch.gradle.info.BuildParams * specific language governing permissions and limitations * under the License. */ +apply plugin: 'elasticsearch.rest-resources' esplugin { description 'The EC2 discovery plugin allows to use AWS API for the unicast discovery mechanism.' diff --git a/plugins/discovery-ec2/qa/amazon-ec2/build.gradle b/plugins/discovery-ec2/qa/amazon-ec2/build.gradle index 4a94ff388742d..c7f94ef278b66 100644 --- a/plugins/discovery-ec2/qa/amazon-ec2/build.gradle +++ b/plugins/discovery-ec2/qa/amazon-ec2/build.gradle @@ -27,6 +27,7 @@ import static org.elasticsearch.gradle.PropertyNormalization.IGNORE_VALUE apply plugin: 'elasticsearch.standalone-rest-test' apply plugin: 'elasticsearch.rest-test' +apply plugin: 'elasticsearch.rest-resources' dependencies { testImplementation project(':plugins:discovery-ec2') diff --git a/plugins/discovery-gce/build.gradle b/plugins/discovery-gce/build.gradle index 46b8319808013..70d50d80c5bce 100644 --- a/plugins/discovery-gce/build.gradle +++ b/plugins/discovery-gce/build.gradle @@ -1,3 +1,5 @@ +apply plugin: 'elasticsearch.rest-resources' + esplugin { description 'The Google Compute Engine (GCE) Discovery plugin allows to use GCE API for the unicast discovery mechanism.' classname 'org.elasticsearch.plugin.discovery.gce.GceDiscoveryPlugin' diff --git a/plugins/discovery-gce/qa/gce/build.gradle b/plugins/discovery-gce/qa/gce/build.gradle index e9925851251c5..9ae4dc475fb89 100644 --- a/plugins/discovery-gce/qa/gce/build.gradle +++ b/plugins/discovery-gce/qa/gce/build.gradle @@ -26,6 +26,7 @@ import static org.elasticsearch.gradle.PropertyNormalization.IGNORE_VALUE apply plugin: 'elasticsearch.standalone-rest-test' apply plugin: 'elasticsearch.rest-test' +apply plugin: 'elasticsearch.rest-resources' final int gceNumberOfNodes = 3 diff --git a/plugins/examples/custom-settings/build.gradle b/plugins/examples/custom-settings/build.gradle index b750018fefe87..5c2b604494930 100644 --- a/plugins/examples/custom-settings/build.gradle +++ b/plugins/examples/custom-settings/build.gradle @@ -18,6 +18,7 @@ */ apply plugin: 'elasticsearch.testclusters' apply plugin: 'elasticsearch.esplugin' +apply plugin: 'elasticsearch.rest-resources' esplugin { name 'custom-settings' diff --git a/plugins/examples/custom-significance-heuristic/build.gradle b/plugins/examples/custom-significance-heuristic/build.gradle index 4aebd4ac31150..5387097ef7e54 100644 --- a/plugins/examples/custom-significance-heuristic/build.gradle +++ b/plugins/examples/custom-significance-heuristic/build.gradle @@ -18,6 +18,7 @@ */ apply plugin: 'elasticsearch.testclusters' apply plugin: 'elasticsearch.esplugin' +apply plugin: 'elasticsearch.rest-resources' esplugin { name 'custom-significance-heuristic' diff --git a/plugins/examples/custom-suggester/build.gradle b/plugins/examples/custom-suggester/build.gradle index 1966d8285b1e0..f31286f90282a 100644 --- a/plugins/examples/custom-suggester/build.gradle +++ b/plugins/examples/custom-suggester/build.gradle @@ -18,6 +18,7 @@ */ apply plugin: 'elasticsearch.testclusters' apply plugin: 'elasticsearch.esplugin' +apply plugin: 'elasticsearch.rest-resources' esplugin { name 'custom-suggester' diff --git a/plugins/examples/painless-whitelist/build.gradle b/plugins/examples/painless-whitelist/build.gradle index 6b1a78e352f58..62edb8294cdac 100644 --- a/plugins/examples/painless-whitelist/build.gradle +++ b/plugins/examples/painless-whitelist/build.gradle @@ -18,6 +18,7 @@ */ apply plugin: 'elasticsearch.testclusters' apply plugin: 'elasticsearch.esplugin' +apply plugin: 'elasticsearch.rest-resources' esplugin { name 'painless-whitelist' diff --git a/plugins/examples/rescore/build.gradle b/plugins/examples/rescore/build.gradle index e18805bc5477c..20527b8b6dbc7 100644 --- a/plugins/examples/rescore/build.gradle +++ b/plugins/examples/rescore/build.gradle @@ -18,6 +18,7 @@ */ apply plugin: 'elasticsearch.testclusters' apply plugin: 'elasticsearch.esplugin' +apply plugin: 'elasticsearch.rest-resources' esplugin { name 'example-rescore' diff --git a/plugins/examples/rest-handler/build.gradle b/plugins/examples/rest-handler/build.gradle index a75c730668387..92d7f296b0be8 100644 --- a/plugins/examples/rest-handler/build.gradle +++ b/plugins/examples/rest-handler/build.gradle @@ -20,6 +20,7 @@ import org.elasticsearch.gradle.info.BuildParams */ apply plugin: 'elasticsearch.testclusters' apply plugin: 'elasticsearch.esplugin' +apply plugin: 'elasticsearch.rest-resources' esplugin { name 'rest-handler' diff --git a/plugins/examples/script-expert-scoring/build.gradle b/plugins/examples/script-expert-scoring/build.gradle index 6f88baccefc3d..65b6203967461 100644 --- a/plugins/examples/script-expert-scoring/build.gradle +++ b/plugins/examples/script-expert-scoring/build.gradle @@ -18,6 +18,7 @@ */ apply plugin: 'elasticsearch.testclusters' apply plugin: 'elasticsearch.esplugin' +apply plugin: 'elasticsearch.rest-resources' esplugin { name 'script-expert-scoring' diff --git a/plugins/examples/security-authorization-engine/build.gradle b/plugins/examples/security-authorization-engine/build.gradle index 21c369bb87279..2f844c5b40ccc 100644 --- a/plugins/examples/security-authorization-engine/build.gradle +++ b/plugins/examples/security-authorization-engine/build.gradle @@ -1,5 +1,6 @@ apply plugin: 'elasticsearch.testclusters' apply plugin: 'elasticsearch.esplugin' +apply plugin: 'elasticsearch.rest-resources' esplugin { name 'security-authorization-engine' diff --git a/plugins/ingest-attachment/build.gradle b/plugins/ingest-attachment/build.gradle index 703276f67821e..2207dcd5d3377 100644 --- a/plugins/ingest-attachment/build.gradle +++ b/plugins/ingest-attachment/build.gradle @@ -18,6 +18,7 @@ import org.elasticsearch.gradle.info.BuildParams * specific language governing permissions and limitations * under the License. */ +apply plugin: 'elasticsearch.rest-resources' esplugin { description 'Ingest processor that uses Apache Tika to extract contents' diff --git a/plugins/mapper-annotated-text/build.gradle b/plugins/mapper-annotated-text/build.gradle index 2ae9a9278b0a5..a8a5a53196eb3 100644 --- a/plugins/mapper-annotated-text/build.gradle +++ b/plugins/mapper-annotated-text/build.gradle @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ +apply plugin: 'elasticsearch.rest-resources' esplugin { description 'The Mapper Annotated_text plugin adds support for text fields with markup used to inject annotation tokens into the index.' diff --git a/plugins/mapper-murmur3/build.gradle b/plugins/mapper-murmur3/build.gradle index f556e82db3867..5b9c459eea8be 100644 --- a/plugins/mapper-murmur3/build.gradle +++ b/plugins/mapper-murmur3/build.gradle @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ +apply plugin: 'elasticsearch.rest-resources' esplugin { description 'The Mapper Murmur3 plugin allows to compute hashes of a field\'s values at index-time and to store them in the index.' diff --git a/plugins/mapper-size/build.gradle b/plugins/mapper-size/build.gradle index 0c757b4966bd3..fd4deab79bbb5 100644 --- a/plugins/mapper-size/build.gradle +++ b/plugins/mapper-size/build.gradle @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ +apply plugin: 'elasticsearch.rest-resources' esplugin { description 'The Mapper Size plugin allows document to record their uncompressed size at index time.' diff --git a/plugins/repository-azure/build.gradle b/plugins/repository-azure/build.gradle index 16acac35da71a..723a4c1e0753a 100644 --- a/plugins/repository-azure/build.gradle +++ b/plugins/repository-azure/build.gradle @@ -22,6 +22,7 @@ import static org.elasticsearch.gradle.PropertyNormalization.IGNORE_VALUE * specific language governing permissions and limitations * under the License. */ +apply plugin: 'elasticsearch.rest-resources' esplugin { description 'The Azure Repository plugin adds support for Azure storage repositories.' diff --git a/plugins/repository-gcs/build.gradle b/plugins/repository-gcs/build.gradle index 7ae94bfedda0a..5a60f96d8abbd 100644 --- a/plugins/repository-gcs/build.gradle +++ b/plugins/repository-gcs/build.gradle @@ -28,6 +28,7 @@ import static org.elasticsearch.gradle.PropertyNormalization.IGNORE_VALUE * specific language governing permissions and limitations * under the License. */ +apply plugin: 'elasticsearch.rest-resources' esplugin { description 'The GCS repository plugin adds Google Cloud Storage support for repositories.' diff --git a/plugins/repository-hdfs/build.gradle b/plugins/repository-hdfs/build.gradle index aa3d9bf3fac8c..963ed7fa37a3b 100644 --- a/plugins/repository-hdfs/build.gradle +++ b/plugins/repository-hdfs/build.gradle @@ -28,6 +28,7 @@ import java.nio.file.Paths import static org.elasticsearch.gradle.PropertyNormalization.IGNORE_VALUE apply plugin: 'elasticsearch.test.fixtures' +apply plugin: 'elasticsearch.rest-resources' esplugin { description 'The HDFS repository plugin adds support for Hadoop Distributed File-System (HDFS) repositories.' diff --git a/plugins/repository-s3/build.gradle b/plugins/repository-s3/build.gradle index 33620d4043532..4098fb7468520 100644 --- a/plugins/repository-s3/build.gradle +++ b/plugins/repository-s3/build.gradle @@ -22,6 +22,8 @@ import static org.elasticsearch.gradle.PropertyNormalization.IGNORE_VALUE * specific language governing permissions and limitations * under the License. */ +apply plugin: 'elasticsearch.rest-resources' + esplugin { description 'The S3 repository plugin adds S3 repositories' classname 'org.elasticsearch.repositories.s3.S3RepositoryPlugin' diff --git a/plugins/store-smb/build.gradle b/plugins/store-smb/build.gradle index 87aad3e59769b..fd137f0e34cc7 100644 --- a/plugins/store-smb/build.gradle +++ b/plugins/store-smb/build.gradle @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ +apply plugin: 'elasticsearch.rest-resources' esplugin { description 'The Store SMB plugin adds support for SMB stores.' diff --git a/qa/mixed-cluster/build.gradle b/qa/mixed-cluster/build.gradle index 73027b01ecab9..48ccfc9ecb55a 100644 --- a/qa/mixed-cluster/build.gradle +++ b/qa/mixed-cluster/build.gradle @@ -25,6 +25,7 @@ import org.elasticsearch.gradle.testclusters.RestTestRunnerTask apply plugin: 'elasticsearch.testclusters' apply plugin: 'elasticsearch.standalone-test' apply from : "$rootDir/gradle/bwc-test.gradle" +apply plugin: 'elasticsearch.rest-resources' restResources { restTests { diff --git a/qa/multi-cluster-search/build.gradle b/qa/multi-cluster-search/build.gradle index 8544dd58aeaf4..eaf8ae5d4cdd9 100644 --- a/qa/multi-cluster-search/build.gradle +++ b/qa/multi-cluster-search/build.gradle @@ -21,6 +21,7 @@ import org.elasticsearch.gradle.test.RestIntegTestTask apply plugin: 'elasticsearch.testclusters' apply plugin: 'elasticsearch.standalone-test' +apply plugin: 'elasticsearch.rest-resources' dependencies { testImplementation project(":client:rest-high-level") diff --git a/qa/rolling-upgrade/build.gradle b/qa/rolling-upgrade/build.gradle index f25df2b29d0f3..ec428c6a019c2 100644 --- a/qa/rolling-upgrade/build.gradle +++ b/qa/rolling-upgrade/build.gradle @@ -24,6 +24,7 @@ import org.elasticsearch.gradle.testclusters.RestTestRunnerTask apply plugin: 'elasticsearch.testclusters' apply plugin: 'elasticsearch.standalone-test' apply from : "$rootDir/gradle/bwc-test.gradle" +apply plugin: 'elasticsearch.rest-resources' for (Version bwcVersion : BuildParams.bwcVersions.wireCompatible) { /* diff --git a/qa/smoke-test-ingest-disabled/build.gradle b/qa/smoke-test-ingest-disabled/build.gradle index 5cac835431b0e..441e0f2328bb9 100644 --- a/qa/smoke-test-ingest-disabled/build.gradle +++ b/qa/smoke-test-ingest-disabled/build.gradle @@ -20,6 +20,7 @@ apply plugin: 'elasticsearch.testclusters' apply plugin: 'elasticsearch.standalone-rest-test' apply plugin: 'elasticsearch.rest-test' +apply plugin: 'elasticsearch.rest-resources' dependencies { testImplementation project(':modules:ingest-common') diff --git a/qa/smoke-test-ingest-with-all-dependencies/build.gradle b/qa/smoke-test-ingest-with-all-dependencies/build.gradle index d96a673bd05a1..234f1aa76fa01 100644 --- a/qa/smoke-test-ingest-with-all-dependencies/build.gradle +++ b/qa/smoke-test-ingest-with-all-dependencies/build.gradle @@ -20,6 +20,7 @@ apply plugin: 'elasticsearch.testclusters' apply plugin: 'elasticsearch.standalone-rest-test' apply plugin: 'elasticsearch.rest-test' +apply plugin: 'elasticsearch.rest-resources' dependencies { testImplementation project(':modules:ingest-common') diff --git a/qa/smoke-test-multinode/build.gradle b/qa/smoke-test-multinode/build.gradle index 244b5d1e8af6e..0aa282b7fe7a2 100644 --- a/qa/smoke-test-multinode/build.gradle +++ b/qa/smoke-test-multinode/build.gradle @@ -20,6 +20,7 @@ apply plugin: 'elasticsearch.testclusters' apply plugin: 'elasticsearch.standalone-rest-test' apply plugin: 'elasticsearch.rest-test' +apply plugin: 'elasticsearch.rest-resources' restResources { restTests { diff --git a/qa/smoke-test-plugins/build.gradle b/qa/smoke-test-plugins/build.gradle index 03992b3c1dc9c..9c7a900c47cac 100644 --- a/qa/smoke-test-plugins/build.gradle +++ b/qa/smoke-test-plugins/build.gradle @@ -23,6 +23,7 @@ import org.elasticsearch.gradle.info.BuildParams apply plugin: 'elasticsearch.testclusters' apply plugin: 'elasticsearch.standalone-rest-test' apply plugin: 'elasticsearch.rest-test' +apply plugin: 'elasticsearch.rest-resources' int pluginsCount = 0 diff --git a/rest-api-spec/build.gradle b/rest-api-spec/build.gradle index 2144dc1765af9..76bc0daa2e1e1 100644 --- a/rest-api-spec/build.gradle +++ b/rest-api-spec/build.gradle @@ -2,11 +2,18 @@ apply plugin: 'elasticsearch.build' apply plugin: 'elasticsearch.publish' apply plugin: 'elasticsearch.rest-resources' apply plugin: 'elasticsearch.validate-rest-spec' +apply plugin: 'elasticsearch.yaml-rest-test' -test.enabled = false -jarHell.enabled = false +restResources { + restTests { + includeCore '*' + } +} artifacts { restSpecs(new File(projectDir, "src/main/resources/rest-api-spec/api")) restTests(new File(projectDir, "src/main/resources/rest-api-spec/test")) } + +test.enabled = false +jarHell.enabled = false diff --git a/distribution/archives/integ-test-zip/src/test/java/org/elasticsearch/test/rest/IntegTestZipClientYamlTestSuiteIT.java b/rest-api-spec/src/yamlRestTest/java/org/elasticsearch/test/rest/ClientYamlTestSuiteIT.java similarity index 88% rename from distribution/archives/integ-test-zip/src/test/java/org/elasticsearch/test/rest/IntegTestZipClientYamlTestSuiteIT.java rename to rest-api-spec/src/yamlRestTest/java/org/elasticsearch/test/rest/ClientYamlTestSuiteIT.java index cd3a778280153..51c102c028a7a 100644 --- a/distribution/archives/integ-test-zip/src/test/java/org/elasticsearch/test/rest/IntegTestZipClientYamlTestSuiteIT.java +++ b/rest-api-spec/src/yamlRestTest/java/org/elasticsearch/test/rest/ClientYamlTestSuiteIT.java @@ -25,8 +25,8 @@ import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase; /** Rest integration test. Runs against a cluster started by {@code gradle integTest} */ -public class IntegTestZipClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase { - public IntegTestZipClientYamlTestSuiteIT(ClientYamlTestCandidate testCandidate) { +public class ClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase { + public ClientYamlTestSuiteIT(ClientYamlTestCandidate testCandidate) { super(testCandidate); } diff --git a/x-pack/docs/build.gradle b/x-pack/docs/build.gradle index d4f1f7f85d216..3b70e9c4b37ec 100644 --- a/x-pack/docs/build.gradle +++ b/x-pack/docs/build.gradle @@ -1,4 +1,5 @@ apply plugin: 'elasticsearch.docs-test' +apply plugin: 'elasticsearch.rest-resources' /* List of files that have snippets that probably should be converted to * `// CONSOLE` and `// TESTRESPONSE` but have yet to be converted. Try and diff --git a/x-pack/plugin/async-search/qa/rest/build.gradle b/x-pack/plugin/async-search/qa/rest/build.gradle index be95cc5562297..319901b34ec7b 100644 --- a/x-pack/plugin/async-search/qa/rest/build.gradle +++ b/x-pack/plugin/async-search/qa/rest/build.gradle @@ -2,6 +2,7 @@ import org.elasticsearch.gradle.info.BuildParams apply plugin: 'elasticsearch.testclusters' apply plugin: 'elasticsearch.esplugin' +apply plugin: 'elasticsearch.rest-resources' esplugin { description 'Deprecated query plugin' diff --git a/x-pack/plugin/autoscaling/qa/rest/build.gradle b/x-pack/plugin/autoscaling/qa/rest/build.gradle index 79a3bb98cd566..4d46ca4f4ea05 100644 --- a/x-pack/plugin/autoscaling/qa/rest/build.gradle +++ b/x-pack/plugin/autoscaling/qa/rest/build.gradle @@ -3,6 +3,7 @@ import org.elasticsearch.gradle.test.RestIntegTestTask apply plugin: 'elasticsearch.testclusters' apply plugin: 'elasticsearch.standalone-test' +apply plugin: 'elasticsearch.rest-resources' dependencies { testImplementation project(path: xpackModule('core'), configuration: 'testArtifacts') diff --git a/x-pack/plugin/build.gradle b/x-pack/plugin/build.gradle index 0310a0fe864f4..ea60808936495 100644 --- a/x-pack/plugin/build.gradle +++ b/x-pack/plugin/build.gradle @@ -8,6 +8,7 @@ import java.nio.charset.StandardCharsets apply plugin: 'elasticsearch.testclusters' apply plugin: 'elasticsearch.standalone-rest-test' apply plugin: 'elasticsearch.rest-test' +apply plugin: 'elasticsearch.rest-resources' apply plugin: 'elasticsearch.validate-rest-spec' archivesBaseName = 'x-pack' @@ -63,6 +64,12 @@ configurations { testArtifacts.extendsFrom testImplementation } +restResources { + restApi { + includeCore '*' + } +} + artifacts { restXpackSpecs(new File(projectDir, "src/test/resources/rest-api-spec/api")) restXpackTests(new File(projectDir, "src/test/resources/rest-api-spec/test")) diff --git a/x-pack/plugin/ccr/qa/rest/build.gradle b/x-pack/plugin/ccr/qa/rest/build.gradle index 5d7b237075d34..925fdb0972187 100644 --- a/x-pack/plugin/ccr/qa/rest/build.gradle +++ b/x-pack/plugin/ccr/qa/rest/build.gradle @@ -2,6 +2,7 @@ import org.elasticsearch.gradle.test.RestIntegTestTask apply plugin: 'elasticsearch.testclusters' apply plugin: 'elasticsearch.standalone-test' +apply plugin: 'elasticsearch.rest-resources' restResources { restApi { diff --git a/x-pack/plugin/enrich/qa/rest/build.gradle b/x-pack/plugin/enrich/qa/rest/build.gradle index aceca6945b040..2402a3d296a78 100644 --- a/x-pack/plugin/enrich/qa/rest/build.gradle +++ b/x-pack/plugin/enrich/qa/rest/build.gradle @@ -1,6 +1,7 @@ apply plugin: 'elasticsearch.testclusters' apply plugin: 'elasticsearch.standalone-rest-test' apply plugin: 'elasticsearch.rest-test' +apply plugin: 'elasticsearch.rest-resources' restResources { restApi { diff --git a/x-pack/plugin/eql/qa/rest/build.gradle b/x-pack/plugin/eql/qa/rest/build.gradle index 3bc5401a172aa..a8d9cfb4bcf71 100644 --- a/x-pack/plugin/eql/qa/rest/build.gradle +++ b/x-pack/plugin/eql/qa/rest/build.gradle @@ -3,6 +3,7 @@ import org.elasticsearch.gradle.info.BuildParams apply plugin: 'elasticsearch.testclusters' apply plugin: 'elasticsearch.standalone-rest-test' apply plugin: 'elasticsearch.rest-test' +apply plugin: 'elasticsearch.rest-resources' restResources { restApi { diff --git a/x-pack/plugin/graph/qa/with-security/build.gradle b/x-pack/plugin/graph/qa/with-security/build.gradle index 3d5891d113957..c6853d02b4c78 100644 --- a/x-pack/plugin/graph/qa/with-security/build.gradle +++ b/x-pack/plugin/graph/qa/with-security/build.gradle @@ -1,6 +1,7 @@ apply plugin: 'elasticsearch.testclusters' apply plugin: 'elasticsearch.standalone-rest-test' apply plugin: 'elasticsearch.rest-test' +apply plugin: 'elasticsearch.rest-resources' dependencies { testImplementation project(":x-pack:plugin:core") diff --git a/x-pack/plugin/ilm/qa/rest/build.gradle b/x-pack/plugin/ilm/qa/rest/build.gradle index a39262682ef2b..7b47573c049ce 100644 --- a/x-pack/plugin/ilm/qa/rest/build.gradle +++ b/x-pack/plugin/ilm/qa/rest/build.gradle @@ -2,6 +2,7 @@ import org.elasticsearch.gradle.test.RestIntegTestTask apply plugin: 'elasticsearch.testclusters' apply plugin: 'elasticsearch.standalone-test' +apply plugin: 'elasticsearch.rest-resources' dependencies { testImplementation project(path: xpackModule('core'), configuration: 'testArtifacts') diff --git a/x-pack/plugin/ml/qa/ml-with-security/build.gradle b/x-pack/plugin/ml/qa/ml-with-security/build.gradle index 8e4110515716e..7476728e07878 100644 --- a/x-pack/plugin/ml/qa/ml-with-security/build.gradle +++ b/x-pack/plugin/ml/qa/ml-with-security/build.gradle @@ -1,6 +1,7 @@ apply plugin: 'elasticsearch.testclusters' apply plugin: 'elasticsearch.standalone-rest-test' apply plugin: 'elasticsearch.rest-test' +apply plugin: 'elasticsearch.rest-resources' dependencies { testImplementation project(path: xpackModule('core'), configuration: 'default') diff --git a/x-pack/plugin/searchable-snapshots/qa/azure/build.gradle b/x-pack/plugin/searchable-snapshots/qa/azure/build.gradle index ab332b7848a1e..fee7dd3e0faa4 100644 --- a/x-pack/plugin/searchable-snapshots/qa/azure/build.gradle +++ b/x-pack/plugin/searchable-snapshots/qa/azure/build.gradle @@ -21,6 +21,7 @@ import static org.elasticsearch.gradle.PropertyNormalization.IGNORE_VALUE apply plugin: 'elasticsearch.standalone-rest-test' apply plugin: 'elasticsearch.rest-test' +apply plugin: 'elasticsearch.rest-resources' final Project fixture = project(':test:fixtures:azure-fixture') final Project repositoryPlugin = project(':plugins:repository-azure') diff --git a/x-pack/plugin/searchable-snapshots/qa/gcs/build.gradle b/x-pack/plugin/searchable-snapshots/qa/gcs/build.gradle index 07b4f487ee243..ca7cf2178daa2 100644 --- a/x-pack/plugin/searchable-snapshots/qa/gcs/build.gradle +++ b/x-pack/plugin/searchable-snapshots/qa/gcs/build.gradle @@ -27,6 +27,7 @@ import static org.elasticsearch.gradle.PropertyNormalization.IGNORE_VALUE apply plugin: 'elasticsearch.standalone-rest-test' apply plugin: 'elasticsearch.rest-test' +apply plugin: 'elasticsearch.rest-resources' final Project fixture = project(':test:fixtures:gcs-fixture') final Project repositoryPlugin = project(':plugins:repository-gcs') diff --git a/x-pack/plugin/searchable-snapshots/qa/minio/build.gradle b/x-pack/plugin/searchable-snapshots/qa/minio/build.gradle index 2172683832adf..b8a2cd803104d 100644 --- a/x-pack/plugin/searchable-snapshots/qa/minio/build.gradle +++ b/x-pack/plugin/searchable-snapshots/qa/minio/build.gradle @@ -4,6 +4,7 @@ import static org.elasticsearch.gradle.PropertyNormalization.IGNORE_VALUE apply plugin: 'elasticsearch.standalone-rest-test' apply plugin: 'elasticsearch.rest-test' apply plugin: 'elasticsearch.test.fixtures' +apply plugin: 'elasticsearch.rest-resources' final Project fixture = project(':test:fixtures:minio-fixture') final Project repositoryPlugin = project(':plugins:repository-s3') diff --git a/x-pack/plugin/searchable-snapshots/qa/rest/build.gradle b/x-pack/plugin/searchable-snapshots/qa/rest/build.gradle index e5c2404f96e4f..3d46400384b69 100644 --- a/x-pack/plugin/searchable-snapshots/qa/rest/build.gradle +++ b/x-pack/plugin/searchable-snapshots/qa/rest/build.gradle @@ -3,6 +3,7 @@ import org.elasticsearch.gradle.info.BuildParams apply plugin: 'elasticsearch.testclusters' apply plugin: 'elasticsearch.standalone-rest-test' apply plugin: 'elasticsearch.rest-test' +apply plugin: 'elasticsearch.rest-resources' dependencies { testImplementation project(path: xpackModule('searchable-snapshots'), configuration: 'testArtifacts') diff --git a/x-pack/plugin/searchable-snapshots/qa/s3/build.gradle b/x-pack/plugin/searchable-snapshots/qa/s3/build.gradle index a1af5a9875525..f1998ffa06645 100644 --- a/x-pack/plugin/searchable-snapshots/qa/s3/build.gradle +++ b/x-pack/plugin/searchable-snapshots/qa/s3/build.gradle @@ -3,6 +3,7 @@ import org.elasticsearch.gradle.info.BuildParams apply plugin: 'elasticsearch.standalone-rest-test' apply plugin: 'elasticsearch.rest-test' +apply plugin: 'elasticsearch.rest-resources' final Project fixture = project(':test:fixtures:s3-fixture') final Project repositoryPlugin = project(':plugins:repository-s3') diff --git a/x-pack/plugin/spatial/build.gradle b/x-pack/plugin/spatial/build.gradle index 644317b1b97de..8ac5a414e616e 100644 --- a/x-pack/plugin/spatial/build.gradle +++ b/x-pack/plugin/spatial/build.gradle @@ -1,6 +1,7 @@ evaluationDependsOn(xpackModule('core')) apply plugin: 'elasticsearch.esplugin' +apply plugin: 'elasticsearch.rest-resources' esplugin { name 'spatial' diff --git a/x-pack/plugin/stack/qa/rest/build.gradle b/x-pack/plugin/stack/qa/rest/build.gradle index 38c6a121b7d3e..cc94a51db26ce 100644 --- a/x-pack/plugin/stack/qa/rest/build.gradle +++ b/x-pack/plugin/stack/qa/rest/build.gradle @@ -2,6 +2,7 @@ import org.elasticsearch.gradle.test.RestIntegTestTask apply plugin: 'elasticsearch.testclusters' apply plugin: 'elasticsearch.standalone-test' +apply plugin: 'elasticsearch.rest-resources' dependencies { testImplementation project(path: xpackModule('core'), configuration: 'testArtifacts') diff --git a/x-pack/plugin/watcher/qa/rest/build.gradle b/x-pack/plugin/watcher/qa/rest/build.gradle index 456b43c218fd3..265f19722f25f 100644 --- a/x-pack/plugin/watcher/qa/rest/build.gradle +++ b/x-pack/plugin/watcher/qa/rest/build.gradle @@ -1,6 +1,7 @@ apply plugin: 'elasticsearch.testclusters' apply plugin: 'elasticsearch.standalone-rest-test' apply plugin: 'elasticsearch.rest-test' +apply plugin: 'elasticsearch.rest-resources' dependencies { testImplementation project(':x-pack:qa') diff --git a/x-pack/plugin/watcher/qa/with-security/build.gradle b/x-pack/plugin/watcher/qa/with-security/build.gradle index 0f2042da573a0..1f467979c2af6 100644 --- a/x-pack/plugin/watcher/qa/with-security/build.gradle +++ b/x-pack/plugin/watcher/qa/with-security/build.gradle @@ -1,6 +1,7 @@ apply plugin: 'elasticsearch.testclusters' apply plugin: 'elasticsearch.standalone-rest-test' apply plugin: 'elasticsearch.rest-test' +apply plugin: 'elasticsearch.rest-resources' dependencies { testImplementation project(':x-pack:qa') diff --git a/x-pack/qa/core-rest-tests-with-security/build.gradle b/x-pack/qa/core-rest-tests-with-security/build.gradle index ce415a817c81b..94887249d53c8 100644 --- a/x-pack/qa/core-rest-tests-with-security/build.gradle +++ b/x-pack/qa/core-rest-tests-with-security/build.gradle @@ -1,6 +1,7 @@ apply plugin: 'elasticsearch.testclusters' apply plugin: 'elasticsearch.standalone-rest-test' apply plugin: 'elasticsearch.rest-test' +apply plugin: 'elasticsearch.rest-resources' dependencies { testImplementation project(':x-pack:qa') diff --git a/x-pack/qa/multi-cluster-search-security/build.gradle b/x-pack/qa/multi-cluster-search-security/build.gradle index 0b440faac2e33..6ff3b96851451 100644 --- a/x-pack/qa/multi-cluster-search-security/build.gradle +++ b/x-pack/qa/multi-cluster-search-security/build.gradle @@ -2,6 +2,7 @@ import org.elasticsearch.gradle.test.RestIntegTestTask apply plugin: 'elasticsearch.testclusters' apply plugin: 'elasticsearch.standalone-test' +apply plugin: 'elasticsearch.rest-resources' dependencies { testImplementation project(':x-pack:qa') diff --git a/x-pack/qa/multi-cluster-tests-with-security/build.gradle b/x-pack/qa/multi-cluster-tests-with-security/build.gradle index dea3e914ab4ef..fb0536cdaf270 100644 --- a/x-pack/qa/multi-cluster-tests-with-security/build.gradle +++ b/x-pack/qa/multi-cluster-tests-with-security/build.gradle @@ -2,6 +2,7 @@ import org.elasticsearch.gradle.test.RestIntegTestTask apply plugin: 'elasticsearch.testclusters' apply plugin: 'elasticsearch.standalone-test' +apply plugin: 'elasticsearch.rest-resources' dependencies { testImplementation project(':x-pack:qa') diff --git a/x-pack/qa/reindex-tests-with-security/build.gradle b/x-pack/qa/reindex-tests-with-security/build.gradle index f6225013bac6e..9186fc883d53a 100644 --- a/x-pack/qa/reindex-tests-with-security/build.gradle +++ b/x-pack/qa/reindex-tests-with-security/build.gradle @@ -3,6 +3,7 @@ import org.elasticsearch.gradle.info.BuildParams apply plugin: 'elasticsearch.testclusters' apply plugin: 'elasticsearch.standalone-rest-test' apply plugin: 'elasticsearch.rest-test' +apply plugin: 'elasticsearch.rest-resources' dependencies { testImplementation project(path: xpackModule('core'), configuration: 'default') diff --git a/x-pack/qa/rolling-upgrade/build.gradle b/x-pack/qa/rolling-upgrade/build.gradle index f1530b1d78805..a0795dc9ff37e 100644 --- a/x-pack/qa/rolling-upgrade/build.gradle +++ b/x-pack/qa/rolling-upgrade/build.gradle @@ -5,6 +5,7 @@ import org.elasticsearch.gradle.testclusters.RestTestRunnerTask apply plugin: 'elasticsearch.testclusters' apply plugin: 'elasticsearch.standalone-test' apply from : "$rootDir/gradle/bwc-test.gradle" +apply plugin: 'elasticsearch.rest-resources' dependencies { testImplementation project(':x-pack:qa') diff --git a/x-pack/qa/smoke-test-plugins-ssl/build.gradle b/x-pack/qa/smoke-test-plugins-ssl/build.gradle index a5ef85c1e52d4..be7408573c0f7 100644 --- a/x-pack/qa/smoke-test-plugins-ssl/build.gradle +++ b/x-pack/qa/smoke-test-plugins-ssl/build.gradle @@ -5,6 +5,7 @@ import org.elasticsearch.gradle.http.WaitForHttpResource apply plugin: 'elasticsearch.testclusters' apply plugin: 'elasticsearch.standalone-rest-test' apply plugin: 'elasticsearch.rest-test' +apply plugin: 'elasticsearch.rest-resources' dependencies { testImplementation project(':x-pack:plugin:core') diff --git a/x-pack/qa/smoke-test-plugins/build.gradle b/x-pack/qa/smoke-test-plugins/build.gradle index faf4e1ed58c5c..2fec86d7b2a1b 100644 --- a/x-pack/qa/smoke-test-plugins/build.gradle +++ b/x-pack/qa/smoke-test-plugins/build.gradle @@ -3,6 +3,7 @@ import org.elasticsearch.gradle.MavenFilteringHack apply plugin: 'elasticsearch.testclusters' apply plugin: 'elasticsearch.standalone-rest-test' apply plugin: 'elasticsearch.rest-test' +apply plugin: 'elasticsearch.rest-resources' dependencies { testImplementation project(':x-pack:qa') diff --git a/x-pack/qa/smoke-test-security-with-mustache/build.gradle b/x-pack/qa/smoke-test-security-with-mustache/build.gradle index 9600e4605d067..0d9c92141b49e 100644 --- a/x-pack/qa/smoke-test-security-with-mustache/build.gradle +++ b/x-pack/qa/smoke-test-security-with-mustache/build.gradle @@ -1,6 +1,7 @@ apply plugin: 'elasticsearch.testclusters' apply plugin: 'elasticsearch.standalone-rest-test' apply plugin: 'elasticsearch.rest-test' +apply plugin: 'elasticsearch.rest-resources' dependencies { testImplementation project(':x-pack:qa') diff --git a/x-pack/qa/third-party/jira/build.gradle b/x-pack/qa/third-party/jira/build.gradle index 3aa4a9f506dfe..4f3a0870bdd34 100644 --- a/x-pack/qa/third-party/jira/build.gradle +++ b/x-pack/qa/third-party/jira/build.gradle @@ -6,6 +6,7 @@ import java.nio.charset.StandardCharsets apply plugin: 'elasticsearch.testclusters' apply plugin: 'elasticsearch.standalone-rest-test' apply plugin: 'elasticsearch.rest-test' +apply plugin: 'elasticsearch.rest-resources' dependencies { testImplementation project(':x-pack:plugin:core') diff --git a/x-pack/qa/third-party/pagerduty/build.gradle b/x-pack/qa/third-party/pagerduty/build.gradle index b35f1b6c8712c..d23cc39a77e1e 100644 --- a/x-pack/qa/third-party/pagerduty/build.gradle +++ b/x-pack/qa/third-party/pagerduty/build.gradle @@ -1,6 +1,7 @@ apply plugin: 'elasticsearch.testclusters' apply plugin: 'elasticsearch.standalone-rest-test' apply plugin: 'elasticsearch.rest-test' +apply plugin: 'elasticsearch.rest-resources' dependencies { testImplementation project(':x-pack:plugin:core') diff --git a/x-pack/qa/third-party/slack/build.gradle b/x-pack/qa/third-party/slack/build.gradle index 0028c2a680237..3860522db4d42 100644 --- a/x-pack/qa/third-party/slack/build.gradle +++ b/x-pack/qa/third-party/slack/build.gradle @@ -1,6 +1,7 @@ apply plugin: 'elasticsearch.testclusters' apply plugin: 'elasticsearch.standalone-rest-test' apply plugin: 'elasticsearch.rest-test' +apply plugin: 'elasticsearch.rest-resources' dependencies { testImplementation project(':x-pack:plugin:core')