diff --git a/build.gradle b/build.gradle index e1dfdce13eaf7..f8f5fea92e62f 100644 --- a/build.gradle +++ b/build.gradle @@ -25,6 +25,8 @@ import org.elasticsearch.gradle.BwcVersions import org.elasticsearch.gradle.Version import org.elasticsearch.gradle.VersionProperties import org.elasticsearch.gradle.plugin.PluginBuildPlugin +import org.elasticsearch.gradle.test.RestIntegTestTask +import org.elasticsearch.gradle.test.RestTestPlugin import org.gradle.plugins.ide.eclipse.model.SourceFolder import org.gradle.util.DistributionLocator import org.gradle.util.GradleVersion @@ -41,6 +43,7 @@ apply plugin: 'nebula.info-scm' apply from: 'gradle/build-scan.gradle' apply from: 'gradle/build-complete.gradle' apply from: 'gradle/runtime-jdk-provision.gradle' +apply from: 'gradle/copy-rest-api-spec-to-global.gradle' // common maven publishing configuration allprojects { @@ -138,6 +141,15 @@ subprojects { precommit.dependsOn 'spotlessJavaCheck' } } + //copy the rest api spec to a global location and add to the test classpath + project.tasks.withType(RestIntegTestTask) { + configurations { + copyRestApiSpecGlobal + } + dependencies { + testRuntime project(path: ':', configuration: 'copyRestApiSpecGlobal') + } + } } /* Introspect all versions of ES that may be tested against for backwards diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/CopyRestApiSpecPlugin.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/CopyRestApiSpecPlugin.groovy new file mode 100644 index 0000000000000..5b3fef9c32c85 --- /dev/null +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/CopyRestApiSpecPlugin.groovy @@ -0,0 +1,40 @@ +package org.elasticsearch.gradle.test + +import org.elasticsearch.gradle.VersionProperties +import org.elasticsearch.gradle.info.BuildParams +import org.elasticsearch.gradle.testclusters.RestTestRunnerTask +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.api.Task +import org.gradle.api.tasks.Copy + +/** + * Copies the core REST specs to the local resource directory for the REST YAML tests. + */ +class CopyRestApiSpecPlugin implements Plugin { + + @Override + void apply(Project project) { + project.with { + configurations.create('restSpec') + dependencies.add( + 'restSpec', + BuildParams.internal ? project.project(':rest-api-spec') : + "org.elasticsearch:rest-api-spec:${VersionProperties.elasticsearch}" + ) + + tasks.create("copyCoreRestSpecLocal", Copy) { + dependsOn project.configurations.restSpec + into(project.sourceSets.test.output.resourcesDir) + from({ project.zipTree(project.configurations.restSpec.singleFile) }) { + includeEmptyDirs = false + include 'rest-api-spec/api/**' + } + } + + tasks.withType(RestTestRunnerTask).each { Task t -> + t.dependsOn('copyCoreRestSpecLocal') + } + } + } +} diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/RestIntegTestTask.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/RestIntegTestTask.groovy index 58e72e2dd7be4..835df65803367 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/RestIntegTestTask.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/RestIntegTestTask.groovy @@ -18,18 +18,13 @@ */ package org.elasticsearch.gradle.test -import org.elasticsearch.gradle.VersionProperties -import org.elasticsearch.gradle.info.BuildParams + import org.elasticsearch.gradle.testclusters.ElasticsearchCluster import org.elasticsearch.gradle.testclusters.RestTestRunnerTask -import org.elasticsearch.gradle.tool.Boilerplate import org.gradle.api.DefaultTask import org.gradle.api.Task -import org.gradle.api.file.FileCopyDetails -import org.gradle.api.tasks.Copy -import org.gradle.api.tasks.Input import org.gradle.api.tasks.testing.Test -import org.gradle.plugins.ide.idea.IdeaPlugin + /** * A wrapper task around setting up a cluster and running rest tests. */ @@ -37,10 +32,6 @@ class RestIntegTestTask extends DefaultTask { protected Test runner - /** Flag indicating whether the rest tests in the rest spec should be run. */ - @Input - Boolean includePackaged = false - RestIntegTestTask() { runner = project.tasks.create("${name}Runner", RestTestRunnerTask.class) super.dependsOn(runner) @@ -69,10 +60,6 @@ class RestIntegTestTask extends DefaultTask { runner.systemProperty('test.clustername', System.getProperty("tests.clustername")) } - // copy the rest spec/tests onto the test classpath - Copy copyRestSpec = createCopyRestSpecTask() - project.sourceSets.test.output.builtBy(copyRestSpec) - // this must run after all projects have been configured, so we know any project // references can be accessed as a fully configured project.gradle.projectsEvaluated { @@ -83,12 +70,6 @@ class RestIntegTestTask extends DefaultTask { } } - /** Sets the includePackaged property */ - public void includePackaged(boolean include) { - includePackaged = include - } - - @Override public Task dependsOn(Object... dependencies) { runner.dependsOn(dependencies) @@ -113,38 +94,4 @@ class RestIntegTestTask extends DefaultTask { public void runner(Closure configure) { project.tasks.getByName("${name}Runner").configure(configure) } - - Copy createCopyRestSpecTask() { - Boilerplate.maybeCreate(project.configurations, 'restSpec') { - project.dependencies.add( - 'restSpec', - BuildParams.internal ? project.project(':rest-api-spec') : - "org.elasticsearch:rest-api-spec:${VersionProperties.elasticsearch}" - ) - } - - return Boilerplate.maybeCreate(project.tasks, 'copyRestSpec', Copy) { Copy copy -> - copy.dependsOn project.configurations.restSpec - copy.into(project.sourceSets.test.output.resourcesDir) - copy.from({ project.zipTree(project.configurations.restSpec.singleFile) }) { - includeEmptyDirs = false - include 'rest-api-spec/**' - filesMatching('rest-api-spec/test/**') { FileCopyDetails details -> - if (includePackaged == false) { - details.exclude() - } - } - } - - if (project.plugins.hasPlugin(IdeaPlugin)) { - project.idea { - module { - if (scopes.TEST != null) { - scopes.TEST.plus.add(project.configurations.restSpec) - } - } - } - } - } - } } diff --git a/buildSrc/src/main/resources/META-INF/gradle-plugins/elasticsearch.copy-rest-api-spec.properties b/buildSrc/src/main/resources/META-INF/gradle-plugins/elasticsearch.copy-rest-api-spec.properties new file mode 100644 index 0000000000000..1bb4c4d776bd7 --- /dev/null +++ b/buildSrc/src/main/resources/META-INF/gradle-plugins/elasticsearch.copy-rest-api-spec.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.CopyRestApiSpecPlugin diff --git a/client/rest-high-level/build.gradle b/client/rest-high-level/build.gradle index fc15a4550f0a2..28a708b1eaf1e 100644 --- a/client/rest-high-level/build.gradle +++ b/client/rest-high-level/build.gradle @@ -24,6 +24,7 @@ apply plugin: 'elasticsearch.rest-test' apply plugin: 'nebula.maven-base-publish' apply plugin: 'nebula.maven-scm' apply plugin: 'com.github.johnrengelman.shadow' +apply plugin: 'elasticsearch.copy-rest-api-spec' group = 'org.elasticsearch.client' archivesBaseName = 'elasticsearch-rest-high-level-client' @@ -36,18 +37,6 @@ publishing { } } -configurations { - restSpec -} - -idea { - module { - if (scopes.TEST != null) { - scopes.TEST.plus.add(project.configurations.restSpec) - } - } -} - dependencies { compile project(':modules:mapper-extras') compile project(':modules:parent-join') @@ -70,17 +59,11 @@ dependencies { testCompile(project(':x-pack:plugin:core')) { exclude group: 'org.elasticsearch', module: 'elasticsearch-rest-high-level-client' } - - restSpec project(':rest-api-spec') } -//we need to copy the yaml spec so we can check naming (see RestHighlevelClientTests#testApiNamingConventions) processTestResources { - dependsOn configurations.restSpec // so that configurations resolve - from({ zipTree(configurations.restSpec.singleFile) }) { - include 'rest-api-spec/api/**' - } from(project(':client:rest-high-level').file('src/test/resources')) + dependsOn copyCoreRestSpecLocal } dependencyLicenses { diff --git a/distribution/archives/build.gradle b/distribution/archives/build.gradle index 022453f945e6a..791bc94b041f3 100644 --- a/distribution/archives/build.gradle +++ b/distribution/archives/build.gradle @@ -305,17 +305,21 @@ subprojects { configure(subprojects.findAll { it.name == 'integ-test-zip' }) { apply plugin: 'elasticsearch.standalone-rest-test' apply plugin: 'elasticsearch.rest-test' + apply plugin: 'elasticsearch.copy-rest-api-spec' group = "org.elasticsearch.distribution.integ-test-zip" integTest { dependsOn assemble - includePackaged = true } processTestResources { + from({ zipTree(configurations.restSpec.singleFile) }) { + include 'rest-api-spec/test/**' + } inputs.properties(project(':distribution').restTestExpansions) MavenFilteringHack.filter(it, project(':distribution').restTestExpansions) + dependsOn configurations.restSpec } diff --git a/distribution/docker/build.gradle b/distribution/docker/build.gradle index f9d12ce242da8..8cc7a00672426 100644 --- a/distribution/docker/build.gradle +++ b/distribution/docker/build.gradle @@ -6,6 +6,7 @@ import org.elasticsearch.gradle.testfixtures.TestFixturesPlugin apply plugin: 'elasticsearch.standalone-rest-test' apply plugin: 'elasticsearch.test.fixtures' +apply plugin: 'elasticsearch.copy-rest-api-spec' testFixtures.useFixture() @@ -13,13 +14,11 @@ configurations { dockerPlugins dockerSource ossDockerSource - restSpec } dependencies { dockerSource project(path: ":distribution:archives:linux-tar") ossDockerSource project(path: ":distribution:archives:oss-linux-tar") - restSpec project(':rest-api-spec') } ext.expansions = { oss, local -> @@ -128,12 +127,9 @@ preProcessFixture { } processTestResources { - from({ zipTree(configurations.restSpec.singleFile) }) { - include 'rest-api-spec/api/**' - } from project(':x-pack:plugin:core') .file('src/test/resources/org/elasticsearch/xpack/security/transport/ssl/certs/simple/testnode.jks') - dependsOn configurations.restSpec + dependsOn copyCoreRestSpecLocal } task integTest(type: Test) { diff --git a/gradle/copy-rest-api-spec-to-global.gradle b/gradle/copy-rest-api-spec-to-global.gradle new file mode 100644 index 0000000000000..0c59d3dcd440b --- /dev/null +++ b/gradle/copy-rest-api-spec-to-global.gradle @@ -0,0 +1,61 @@ + +/** + * Copies all of the REST api specs (including core, modules, plugins, and x-pack) to common location for the REST YAML test. + * This plugin is expected to only be applied to applied to the root project. + */ +File rootBuildDir = rootProject.buildDir + +tasks.create("copyCoreRestSpecGlobal", Copy) { + from project.findProject(':rest-api-spec').projectDir + into rootBuildDir + includeEmptyDirs = false + include '**/src/**/rest-api-spec/api/**' + eachFile { + path = new File("rest-api-spec/api", name) + } +} + +tasks.create("copyModulesRestSpecGlobal", Copy) { + from project.findProject(':modules').projectDir + into rootBuildDir + includeEmptyDirs = false + include '**/src/**/rest-api-spec/api/**' + eachFile { + path = new File("rest-api-spec/api", name) + } +} + +tasks.create("copyPluginsRestSpecGlobal", Copy) { + from project.findProject(':plugins').projectDir + into rootBuildDir + includeEmptyDirs = false + include '**/src/**/rest-api-spec/api/**' + exclude '**/examples/**' + eachFile { + path = new File("rest-api-spec/api", name) + } +} + +tasks.create("copyXpackPluginsRestSpecGlobal", Copy) { + from project.findProject(':x-pack:plugin').projectDir + into rootBuildDir + includeEmptyDirs = false + include '**/src/**/rest-api-spec/api/**' + eachFile { + path = new File("rest-api-spec/api", name) + } +} + +tasks.create("copyAllRestSpecsGlobal") { + dependsOn copyCoreRestSpecGlobal + dependsOn copyModulesRestSpecGlobal + dependsOn copyPluginsRestSpecGlobal + dependsOn copyXpackPluginsRestSpecGlobal +} + +configurations { + copyRestApiSpecGlobal +} +artifacts { + copyRestApiSpecGlobal(file(rootBuildDir)) { builtBy copyAllRestSpecsGlobal } +} diff --git a/modules/lang-painless/build.gradle b/modules/lang-painless/build.gradle index 75e41dcf2e2aa..71d7618b4a3e9 100644 --- a/modules/lang-painless/build.gradle +++ b/modules/lang-painless/build.gradle @@ -22,6 +22,8 @@ esplugin { description 'An easy, safe and fast scripting language for Elasticsearch' classname 'org.elasticsearch.painless.PainlessPlugin' } +//since there are local api specs, we need to copy the core spec locally too +apply plugin: 'elasticsearch.copy-rest-api-spec' testClusters.integTest { module file(project(':modules:mapper-extras').tasks.bundlePlugin.archiveFile) diff --git a/plugins/examples/rest-handler/build.gradle b/plugins/examples/rest-handler/build.gradle index 12f3c0e095335..d00e0202a465e 100644 --- a/plugins/examples/rest-handler/build.gradle +++ b/plugins/examples/rest-handler/build.gradle @@ -1,5 +1,3 @@ -import org.elasticsearch.gradle.info.BuildParams - /* * Licensed to Elasticsearch under one or more contributor * license agreements. See the NOTICE file distributed with @@ -18,8 +16,11 @@ import org.elasticsearch.gradle.info.BuildParams * specific language governing permissions and limitations * under the License. */ +import org.elasticsearch.gradle.info.BuildParams + apply plugin: 'elasticsearch.testclusters' apply plugin: 'elasticsearch.esplugin' +apply plugin: 'elasticsearch.copy-rest-api-spec' esplugin { name 'rest-handler' @@ -51,3 +52,5 @@ testingConventions.naming { baseClass 'org.elasticsearch.test.ESTestCase' } } + + diff --git a/qa/mixed-cluster/build.gradle b/qa/mixed-cluster/build.gradle index 0f02cbd52d4e9..358a8cca22934 100644 --- a/qa/mixed-cluster/build.gradle +++ b/qa/mixed-cluster/build.gradle @@ -24,23 +24,19 @@ import org.elasticsearch.gradle.testclusters.RestTestRunnerTask apply plugin: 'elasticsearch.testclusters' apply plugin: 'elasticsearch.standalone-test' +apply plugin: 'elasticsearch.copy-rest-api-spec' tasks.register("bwcTest") { description = 'Runs backwards compatibility tests.' group = 'verification' } -configurations { - restSpec -} - -dependencies { - restSpec project(':rest-api-spec') -} - processTestResources { - from({ zipTree(configurations.restSpec.singleFile) }) + from({ zipTree(configurations.restSpec.singleFile) }) { + include 'rest-api-spec/test/**' + } dependsOn configurations.restSpec + dependsOn copyCoreRestSpecLocal } for (Version bwcVersion : bwcVersions.wireCompatible) { diff --git a/qa/remote-clusters/build.gradle b/qa/remote-clusters/build.gradle index f3027a0d5b91b..2286012a63702 100644 --- a/qa/remote-clusters/build.gradle +++ b/qa/remote-clusters/build.gradle @@ -88,12 +88,8 @@ def createAndSetWritable(Object... locations) { } processTestResources { - from({ zipTree(configurations.restSpec.singleFile) }) { - include 'rest-api-spec/api/**' - } from project(':x-pack:plugin:core') .file('src/test/resources/org/elasticsearch/xpack/security/transport/ssl/certs/simple/testnode.jks') - dependsOn configurations.restSpec } task integTest(type: Test) { diff --git a/qa/rolling-upgrade/build.gradle b/qa/rolling-upgrade/build.gradle index bf1bc2d5b1073..cefe23ac38ab5 100644 --- a/qa/rolling-upgrade/build.gradle +++ b/qa/rolling-upgrade/build.gradle @@ -23,6 +23,7 @@ import org.elasticsearch.gradle.testclusters.RestTestRunnerTask apply plugin: 'elasticsearch.testclusters' apply plugin: 'elasticsearch.standalone-test' +apply plugin: 'elasticsearch.copy-rest-api-spec' // This is a top level task which we will add dependencies to below. // It is a single task that can be used to backcompat tests against all versions. @@ -31,19 +32,8 @@ task bwcTest { group = 'verification' } -configurations { - restSpec -} - -dependencies { - restSpec project(':rest-api-spec') -} - processTestResources { - from({ zipTree(configurations.restSpec.singleFile) }) { - include 'rest-api-spec/api/**' - } - dependsOn configurations.restSpec + dependsOn copyCoreRestSpecLocal } for (Version bwcVersion : bwcVersions.wireCompatible) { diff --git a/qa/smoke-test-multinode/build.gradle b/qa/smoke-test-multinode/build.gradle index b76a865c6f898..99387cccc152d 100644 --- a/qa/smoke-test-multinode/build.gradle +++ b/qa/smoke-test-multinode/build.gradle @@ -20,11 +20,16 @@ apply plugin: 'elasticsearch.testclusters' apply plugin: 'elasticsearch.standalone-rest-test' apply plugin: 'elasticsearch.rest-test' +apply plugin: 'elasticsearch.copy-rest-api-spec' -integTest { - includePackaged = true +processTestResources { + from({ zipTree(configurations.restSpec.singleFile) }) { + include 'rest-api-spec/test/**' + } + dependsOn configurations.restSpec } + File repo = file("$buildDir/testclusters/repo") testClusters.integTest { numberOfNodes = 2 diff --git a/x-pack/docs/build.gradle b/x-pack/docs/build.gradle index 57759b9427bee..01632ee0c17d2 100644 --- a/x-pack/docs/build.gradle +++ b/x-pack/docs/build.gradle @@ -1,6 +1,7 @@ import java.nio.charset.StandardCharsets apply plugin: 'elasticsearch.docs-test' +apply plugin: 'elasticsearch.copy-rest-api-spec' /* List of files that have snippets that probably should be converted to * `// CONSOLE` and `// TESTRESPONSE` but have yet to be converted. Try and @@ -21,10 +22,12 @@ dependencies { testCompile project(path: xpackProject('plugin').path, configuration: 'testArtifacts') } -// copy xpack rest api -File xpackResources = new File(xpackProject('plugin').projectDir, 'src/test/resources') -project.copyRestSpec.from(xpackResources) { - include 'rest-api-spec/api/**' +processTestResources { + from({ new File(xpackProject('plugin').projectDir, 'src/test/resources')}) { + include 'rest-api-spec/api/**' + } + dependsOn configurations.restSpec + dependsOn copyCoreRestSpecLocal } testClusters.integTest { diff --git a/x-pack/plugin/build.gradle b/x-pack/plugin/build.gradle index 85d28fcd65d40..26d9b24692f77 100644 --- a/x-pack/plugin/build.gradle +++ b/x-pack/plugin/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.copy-rest-api-spec' archivesBaseName = 'x-pack' @@ -55,7 +56,10 @@ task copyKeyCerts(type: Copy) { } // Add keystores to test classpath: it expects it there sourceSets.test.resources.srcDir(keystoreDir) -processTestResources.dependsOn(copyKeyCerts) +processTestResources { + dependsOn copyKeyCerts + dependsOn copyCoreRestSpecLocal +} integTest.runner { /* diff --git a/x-pack/plugin/ccr/qa/build.gradle b/x-pack/plugin/ccr/qa/build.gradle index 46609933699ca..4306abf6b7f8b 100644 --- a/x-pack/plugin/ccr/qa/build.gradle +++ b/x-pack/plugin/ccr/qa/build.gradle @@ -7,12 +7,3 @@ dependencies { compile project(':test:framework') } -subprojects { - project.tasks.withType(RestIntegTestTask) { - final File xPackResources = new File(xpackProject('plugin').projectDir, 'src/test/resources') - project.copyRestSpec.from(xPackResources) { - include 'rest-api-spec/api/**' - } - } - -} diff --git a/x-pack/plugin/enrich/qa/build.gradle b/x-pack/plugin/enrich/qa/build.gradle index d3e95d997c3fb..ef337d3df0b4c 100644 --- a/x-pack/plugin/enrich/qa/build.gradle +++ b/x-pack/plugin/enrich/qa/build.gradle @@ -1,4 +1,3 @@ -import org.elasticsearch.gradle.test.RestIntegTestTask apply plugin: 'elasticsearch.build' test.enabled = false @@ -6,12 +5,3 @@ test.enabled = false dependencies { compile project(':test:framework') } - -subprojects { - project.tasks.withType(RestIntegTestTask) { - final File xPackResources = new File(xpackProject('plugin').projectDir, 'src/test/resources') - project.copyRestSpec.from(xPackResources) { - include 'rest-api-spec/api/**' - } - } -} diff --git a/x-pack/plugin/eql/qa/build.gradle b/x-pack/plugin/eql/qa/build.gradle index d3e95d997c3fb..79ff4091f6d2d 100644 --- a/x-pack/plugin/eql/qa/build.gradle +++ b/x-pack/plugin/eql/qa/build.gradle @@ -6,12 +6,3 @@ test.enabled = false dependencies { compile project(':test:framework') } - -subprojects { - project.tasks.withType(RestIntegTestTask) { - final File xPackResources = new File(xpackProject('plugin').projectDir, 'src/test/resources') - project.copyRestSpec.from(xPackResources) { - include 'rest-api-spec/api/**' - } - } -} diff --git a/x-pack/plugin/graph/qa/build.gradle b/x-pack/plugin/graph/qa/build.gradle index 012e25f5d4f9d..e69de29bb2d1d 100644 --- a/x-pack/plugin/graph/qa/build.gradle +++ b/x-pack/plugin/graph/qa/build.gradle @@ -1,17 +0,0 @@ -import org.elasticsearch.gradle.test.RestIntegTestTask - -subprojects { - // HACK: please fix this - // we want to add the rest api specs for xpack to qa tests, but we - // need to wait until after the project is evaluated to only apply - // to those that rest tests. this used to be done automatically - // when xpack was a plugin, but now there is no place with xpack as a module. - // instead, we should package these and make them easy to use for rest tests, - // but currently, they must be copied into the resources of the test runner. - project.tasks.withType(RestIntegTestTask) { - File xpackResources = new File(xpackProject('plugin').projectDir, 'src/test/resources') - project.copyRestSpec.from(xpackResources) { - include 'rest-api-spec/api/**' - } - } -} diff --git a/x-pack/plugin/ilm/qa/build.gradle b/x-pack/plugin/ilm/qa/build.gradle index 46908e1d849b9..8b137891791fe 100644 --- a/x-pack/plugin/ilm/qa/build.gradle +++ b/x-pack/plugin/ilm/qa/build.gradle @@ -1,11 +1 @@ -import org.elasticsearch.gradle.test.RestIntegTestTask - -subprojects { - project.tasks.withType(RestIntegTestTask) { - final File xPackResources = new File(xpackProject('plugin').projectDir, 'src/test/resources') - project.copyRestSpec.from(xPackResources) { - include 'rest-api-spec/api/**' - } - } -} diff --git a/x-pack/plugin/ml/qa/build.gradle b/x-pack/plugin/ml/qa/build.gradle index 012e25f5d4f9d..e69de29bb2d1d 100644 --- a/x-pack/plugin/ml/qa/build.gradle +++ b/x-pack/plugin/ml/qa/build.gradle @@ -1,17 +0,0 @@ -import org.elasticsearch.gradle.test.RestIntegTestTask - -subprojects { - // HACK: please fix this - // we want to add the rest api specs for xpack to qa tests, but we - // need to wait until after the project is evaluated to only apply - // to those that rest tests. this used to be done automatically - // when xpack was a plugin, but now there is no place with xpack as a module. - // instead, we should package these and make them easy to use for rest tests, - // but currently, they must be copied into the resources of the test runner. - project.tasks.withType(RestIntegTestTask) { - File xpackResources = new File(xpackProject('plugin').projectDir, 'src/test/resources') - project.copyRestSpec.from(xpackResources) { - include 'rest-api-spec/api/**' - } - } -} diff --git a/x-pack/plugin/security/qa/build.gradle b/x-pack/plugin/security/qa/build.gradle index 46908e1d849b9..e69de29bb2d1d 100644 --- a/x-pack/plugin/security/qa/build.gradle +++ b/x-pack/plugin/security/qa/build.gradle @@ -1,11 +0,0 @@ -import org.elasticsearch.gradle.test.RestIntegTestTask - -subprojects { - project.tasks.withType(RestIntegTestTask) { - final File xPackResources = new File(xpackProject('plugin').projectDir, 'src/test/resources') - project.copyRestSpec.from(xPackResources) { - include 'rest-api-spec/api/**' - } - } -} - diff --git a/x-pack/qa/build.gradle b/x-pack/qa/build.gradle index 2555b0ef729dc..c710c625a9898 100644 --- a/x-pack/qa/build.gradle +++ b/x-pack/qa/build.gradle @@ -1,8 +1,6 @@ // this file must exist so that qa projects are found // by the elasticsearch x-plugins include mechanism -import org.elasticsearch.gradle.test.RestIntegTestTask - apply plugin: 'elasticsearch.build' test.enabled = false @@ -10,18 +8,3 @@ dependencies { compile project(':test:framework') } -subprojects { - // HACK: please fix this - // we want to add the rest api specs for xpack to qa tests, but we - // need to wait until after the project is evaluated to only apply - // to those that rest tests. this used to be done automatically - // when xpack was a plugin, but now there is no place with xpack as a module. - // instead, we should package these and make them easy to use for rest tests, - // but currently, they must be copied into the resources of the test runner. - project.tasks.withType(RestIntegTestTask) { - File xpackResources = new File(xpackProject('plugin').projectDir, 'src/test/resources') - project.copyRestSpec.from(xpackResources) { - include 'rest-api-spec/api/**' - } - } -} 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 f273efaf5bcd2..a34ccd30a7c31 100644 --- a/x-pack/qa/core-rest-tests-with-security/build.gradle +++ b/x-pack/qa/core-rest-tests-with-security/build.gradle @@ -1,13 +1,20 @@ apply plugin: 'elasticsearch.testclusters' apply plugin: 'elasticsearch.standalone-rest-test' apply plugin: 'elasticsearch.rest-test' +apply plugin: 'elasticsearch.copy-rest-api-spec' dependencies { testCompile project(':x-pack:qa') } +processTestResources { + from({ zipTree(configurations.restSpec.singleFile) }) { + include 'rest-api-spec/test/**' + } + dependsOn configurations.restSpec +} + integTest { - includePackaged = true runner { systemProperty 'tests.rest.blacklist', [ diff --git a/x-pack/qa/full-cluster-restart/build.gradle b/x-pack/qa/full-cluster-restart/build.gradle index 180d42e7d5dc9..cd0a6aaeff8e8 100644 --- a/x-pack/qa/full-cluster-restart/build.gradle +++ b/x-pack/qa/full-cluster-restart/build.gradle @@ -39,24 +39,6 @@ tasks.register("copyTestNodeKeyMaterial", Copy) { into outputDir } -configurations { - restSpec -} - -dependencies { - restSpec project(':rest-api-spec') -} - -processTestResources { - dependsOn configurations.restSpec - from({ zipTree(configurations.restSpec.singleFile) }) { - include 'rest-api-spec/api/**' - } - from(project(xpackModule('core')).sourceSets.test.resources) { - include 'rest-api-spec/api/**' - } -} - for (Version bwcVersion : bwcVersions.indexCompatible) { String baseName = "v${bwcVersion}" diff --git a/x-pack/qa/rolling-upgrade-basic/build.gradle b/x-pack/qa/rolling-upgrade-basic/build.gradle index 9367b74aae379..27c2b697438a7 100644 --- a/x-pack/qa/rolling-upgrade-basic/build.gradle +++ b/x-pack/qa/rolling-upgrade-basic/build.gradle @@ -14,25 +14,6 @@ tasks.register("bwcTest") { group = 'verification' } -configurations { - restSpec -} - -dependencies { - restSpec project(':rest-api-spec') -} - -processTestResources { - dependsOn configurations.restSpec - from({ zipTree(configurations.restSpec.singleFile) }) { - include 'rest-api-spec/api/**' - } - from(project(xpackProject('plugin').path).sourceSets.test.resources) { - include 'rest-api-spec/api/**' - } -} - - for (Version bwcVersion : bwcVersions.wireCompatible) { String baseName = "v${bwcVersion}" diff --git a/x-pack/qa/rolling-upgrade-multi-cluster/build.gradle b/x-pack/qa/rolling-upgrade-multi-cluster/build.gradle index bba1d1fd96e24..c28e8cfd8baae 100644 --- a/x-pack/qa/rolling-upgrade-multi-cluster/build.gradle +++ b/x-pack/qa/rolling-upgrade-multi-cluster/build.gradle @@ -14,24 +14,6 @@ tasks.register("bwcTest") { group = 'verification' } -configurations { - restSpec -} - -dependencies { - restSpec project(':rest-api-spec') -} - -processTestResources { - dependsOn configurations.restSpec - from({ zipTree(configurations.restSpec.singleFile) }) { - include 'rest-api-spec/api/**' - } - from(project(xpackProject('plugin').path).sourceSets.test.resources) { - include 'rest-api-spec/api/**' - } -} - for (Version bwcVersion : bwcVersions.wireCompatible) { String baseName = "v${bwcVersion}" diff --git a/x-pack/qa/rolling-upgrade/build.gradle b/x-pack/qa/rolling-upgrade/build.gradle index 1cd40dd7856b0..c4656cde92809 100644 --- a/x-pack/qa/rolling-upgrade/build.gradle +++ b/x-pack/qa/rolling-upgrade/build.gradle @@ -23,24 +23,6 @@ tasks.register("bwcTest") { group = 'verification' } -configurations { - restSpec -} - -dependencies { - restSpec project(':rest-api-spec') -} - -processTestResources { - dependsOn configurations.restSpec - from({ zipTree(configurations.restSpec.singleFile) }) { - include 'rest-api-spec/api/**' - } - from(project(xpackProject('plugin').path).sourceSets.test.resources) { - include 'rest-api-spec/api/**' - } -} - task copyTestNodeKeyMaterial(type: Copy) { from project(':x-pack:plugin:core').files('src/test/resources/org/elasticsearch/xpack/security/transport/ssl/certs/simple/testnode.pem', 'src/test/resources/org/elasticsearch/xpack/security/transport/ssl/certs/simple/testnode.crt')