mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-30 20:08:29 +00:00
Prior to this commit Watcher explicitly copied test between two projects with a copy task. This commit removes the explicit copy in favor of adding the Watcher tests to the available restResources that may be copied between projects. This is how inter-project dependencies should be modeled. However, only Watcher is included here since it is (currently) the only project with inter-project test dependencies.
This commit is contained in:
parent
db3420d757
commit
cce60215d8
@ -114,7 +114,7 @@ public class CopyRestTestsTask extends DefaultTask {
|
|||||||
if (BuildParams.isInternal()) {
|
if (BuildParams.isInternal()) {
|
||||||
getLogger().debug("Rest tests for project [{}] will be copied to the test resources.", project.getPath());
|
getLogger().debug("Rest tests for project [{}] will be copied to the test resources.", project.getPath());
|
||||||
project.copy(c -> {
|
project.copy(c -> {
|
||||||
c.from(coreConfig.getSingleFile());
|
c.from(coreConfig.getAsFileTree());
|
||||||
c.into(getOutputDir());
|
c.into(getOutputDir());
|
||||||
c.include(corePatternSet.getIncludes());
|
c.include(corePatternSet.getIncludes());
|
||||||
});
|
});
|
||||||
@ -138,7 +138,7 @@ public class CopyRestTestsTask extends DefaultTask {
|
|||||||
if (includeXpack.get().isEmpty() == false) {
|
if (includeXpack.get().isEmpty() == false) {
|
||||||
getLogger().debug("X-pack rest tests for project [{}] will be copied to the test resources.", project.getPath());
|
getLogger().debug("X-pack rest tests for project [{}] will be copied to the test resources.", project.getPath());
|
||||||
project.copy(c -> {
|
project.copy(c -> {
|
||||||
c.from(xpackConfig.getSingleFile());
|
c.from(xpackConfig.getAsFileTree());
|
||||||
c.into(getOutputDir());
|
c.into(getOutputDir());
|
||||||
c.include(xpackPatternSet.getIncludes());
|
c.include(xpackPatternSet.getIncludes());
|
||||||
});
|
});
|
||||||
|
@ -22,6 +22,7 @@ import org.elasticsearch.gradle.VersionProperties;
|
|||||||
import org.elasticsearch.gradle.info.BuildParams;
|
import org.elasticsearch.gradle.info.BuildParams;
|
||||||
import org.gradle.api.Plugin;
|
import org.gradle.api.Plugin;
|
||||||
import org.gradle.api.Project;
|
import org.gradle.api.Project;
|
||||||
|
import org.gradle.api.artifacts.Configuration;
|
||||||
import org.gradle.api.artifacts.Dependency;
|
import org.gradle.api.artifacts.Dependency;
|
||||||
import org.gradle.api.provider.Provider;
|
import org.gradle.api.provider.Provider;
|
||||||
|
|
||||||
@ -86,21 +87,31 @@ public class RestResourcesPlugin implements Plugin<Project> {
|
|||||||
public void apply(Project project) {
|
public void apply(Project project) {
|
||||||
RestResourcesExtension extension = project.getExtensions().create(EXTENSION_NAME, RestResourcesExtension.class);
|
RestResourcesExtension extension = project.getExtensions().create(EXTENSION_NAME, RestResourcesExtension.class);
|
||||||
|
|
||||||
|
// tests
|
||||||
|
Configuration testConfig = project.getConfigurations().create("restTestConfig");
|
||||||
|
Configuration xpackTestConfig = project.getConfigurations().create("restXpackTest");
|
||||||
|
project.getConfigurations().create("restTests");
|
||||||
|
project.getConfigurations().create("restXpackTests");
|
||||||
Provider<CopyRestTestsTask> copyRestYamlTestTask = project.getTasks()
|
Provider<CopyRestTestsTask> copyRestYamlTestTask = project.getTasks()
|
||||||
.register("copyYamlTestsTask", CopyRestTestsTask.class, task -> {
|
.register("copyYamlTestsTask", CopyRestTestsTask.class, task -> {
|
||||||
task.includeCore.set(extension.restTests.getIncludeCore());
|
task.includeCore.set(extension.restTests.getIncludeCore());
|
||||||
task.includeXpack.set(extension.restTests.getIncludeXpack());
|
task.includeXpack.set(extension.restTests.getIncludeXpack());
|
||||||
task.coreConfig = project.getConfigurations().create("restTest");
|
task.coreConfig = testConfig;
|
||||||
if (BuildParams.isInternal()) {
|
if (BuildParams.isInternal()) {
|
||||||
|
// core
|
||||||
Dependency restTestdependency = project.getDependencies()
|
Dependency restTestdependency = project.getDependencies()
|
||||||
.project(Map.of("path", ":rest-api-spec", "configuration", "restTests"));
|
.project(Map.of("path", ":rest-api-spec", "configuration", "restTests"));
|
||||||
project.getDependencies().add(task.coreConfig.getName(), restTestdependency);
|
project.getDependencies().add(task.coreConfig.getName(), restTestdependency);
|
||||||
|
// x-pack
|
||||||
task.xpackConfig = project.getConfigurations().create("restXpackTest");
|
task.xpackConfig = xpackTestConfig;
|
||||||
Dependency restXPackTestdependency = project.getDependencies()
|
Dependency restXPackTestdependency = project.getDependencies()
|
||||||
.project(Map.of("path", ":x-pack:plugin", "configuration", "restXpackTests"));
|
.project(Map.of("path", ":x-pack:plugin", "configuration", "restXpackTests"));
|
||||||
project.getDependencies().add(task.xpackConfig.getName(), restXPackTestdependency);
|
project.getDependencies().add(task.xpackConfig.getName(), restXPackTestdependency);
|
||||||
task.dependsOn(task.xpackConfig);
|
task.dependsOn(task.xpackConfig);
|
||||||
|
// watcher
|
||||||
|
Dependency restWatcherTests = project.getDependencies()
|
||||||
|
.project(Map.of("path", ":x-pack:plugin:watcher:qa:rest", "configuration", "restXpackTests"));
|
||||||
|
project.getDependencies().add(task.xpackConfig.getName(), restWatcherTests);
|
||||||
} else {
|
} else {
|
||||||
Dependency dependency = project.getDependencies()
|
Dependency dependency = project.getDependencies()
|
||||||
.create("org.elasticsearch:rest-api-spec:" + VersionProperties.getElasticsearch());
|
.create("org.elasticsearch:rest-api-spec:" + VersionProperties.getElasticsearch());
|
||||||
@ -109,18 +120,22 @@ public class RestResourcesPlugin implements Plugin<Project> {
|
|||||||
task.dependsOn(task.coreConfig);
|
task.dependsOn(task.coreConfig);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// api
|
||||||
|
Configuration specConfig = project.getConfigurations().create("restSpec"); // name chosen for passivity
|
||||||
|
Configuration xpackSpecConfig = project.getConfigurations().create("restXpackSpec");
|
||||||
|
project.getConfigurations().create("restSpecs");
|
||||||
|
project.getConfigurations().create("restXpackSpecs");
|
||||||
Provider<CopyRestApiTask> copyRestYamlSpecTask = project.getTasks()
|
Provider<CopyRestApiTask> copyRestYamlSpecTask = project.getTasks()
|
||||||
.register("copyRestApiSpecsTask", CopyRestApiTask.class, task -> {
|
.register("copyRestApiSpecsTask", CopyRestApiTask.class, task -> {
|
||||||
task.includeCore.set(extension.restApi.getIncludeCore());
|
task.includeCore.set(extension.restApi.getIncludeCore());
|
||||||
task.includeXpack.set(extension.restApi.getIncludeXpack());
|
task.includeXpack.set(extension.restApi.getIncludeXpack());
|
||||||
task.dependsOn(copyRestYamlTestTask);
|
task.dependsOn(copyRestYamlTestTask);
|
||||||
task.coreConfig = project.getConfigurations().create("restSpec");
|
task.coreConfig = specConfig;
|
||||||
if (BuildParams.isInternal()) {
|
if (BuildParams.isInternal()) {
|
||||||
Dependency restSpecDependency = project.getDependencies()
|
Dependency restSpecDependency = project.getDependencies()
|
||||||
.project(Map.of("path", ":rest-api-spec", "configuration", "restSpecs"));
|
.project(Map.of("path", ":rest-api-spec", "configuration", "restSpecs"));
|
||||||
project.getDependencies().add(task.coreConfig.getName(), restSpecDependency);
|
project.getDependencies().add(task.coreConfig.getName(), restSpecDependency);
|
||||||
|
task.xpackConfig = xpackSpecConfig;
|
||||||
task.xpackConfig = project.getConfigurations().create("restXpackSpec");
|
|
||||||
Dependency restXpackSpecDependency = project.getDependencies()
|
Dependency restXpackSpecDependency = project.getDependencies()
|
||||||
.project(Map.of("path", ":x-pack:plugin", "configuration", "restXpackSpecs"));
|
.project(Map.of("path", ":x-pack:plugin", "configuration", "restXpackSpecs"));
|
||||||
project.getDependencies().add(task.xpackConfig.getName(), restXpackSpecDependency);
|
project.getDependencies().add(task.xpackConfig.getName(), restXpackSpecDependency);
|
||||||
|
@ -1,15 +1,11 @@
|
|||||||
apply plugin: 'elasticsearch.build'
|
apply plugin: 'elasticsearch.build'
|
||||||
apply plugin: 'nebula.maven-base-publish'
|
apply plugin: 'nebula.maven-base-publish'
|
||||||
apply plugin: 'nebula.maven-scm'
|
apply plugin: 'nebula.maven-scm'
|
||||||
|
apply plugin: 'elasticsearch.rest-resources'
|
||||||
|
|
||||||
test.enabled = false
|
test.enabled = false
|
||||||
jarHell.enabled = false
|
jarHell.enabled = false
|
||||||
|
|
||||||
configurations {
|
|
||||||
restSpecs
|
|
||||||
restTests
|
|
||||||
}
|
|
||||||
|
|
||||||
artifacts {
|
artifacts {
|
||||||
restSpecs(new File(projectDir, "src/main/resources/rest-api-spec/api"))
|
restSpecs(new File(projectDir, "src/main/resources/rest-api-spec/api"))
|
||||||
restTests(new File(projectDir, "src/main/resources/rest-api-spec/test"))
|
restTests(new File(projectDir, "src/main/resources/rest-api-spec/test"))
|
||||||
|
@ -65,8 +65,6 @@ subprojects {
|
|||||||
|
|
||||||
configurations {
|
configurations {
|
||||||
testArtifacts.extendsFrom testRuntime
|
testArtifacts.extendsFrom testRuntime
|
||||||
restXpackSpecs
|
|
||||||
restXpackTests
|
|
||||||
}
|
}
|
||||||
|
|
||||||
artifacts {
|
artifacts {
|
||||||
|
@ -17,6 +17,7 @@ task testJar(type: Jar) {
|
|||||||
|
|
||||||
artifacts {
|
artifacts {
|
||||||
testArtifacts testJar
|
testArtifacts testJar
|
||||||
|
restXpackTests(new File(projectDir, "src/test/resources/rest-api-spec/test"))
|
||||||
}
|
}
|
||||||
|
|
||||||
restResources {
|
restResources {
|
||||||
|
@ -7,21 +7,15 @@ dependencies {
|
|||||||
testCompile project(path: ':x-pack:plugin:watcher:qa:rest', configuration: 'testArtifacts')
|
testCompile project(path: ':x-pack:plugin:watcher:qa:rest', configuration: 'testArtifacts')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// bring in watcher rest test suite from the rest project
|
|
||||||
task copyWatcherRestTests(type: Copy) {
|
|
||||||
into project.sourceSets.test.output.resourcesDir
|
|
||||||
from project(xpackProject('plugin:watcher:qa:rest').path).sourceSets.test.resources.srcDirs
|
|
||||||
include 'rest-api-spec/test/watcher/**'
|
|
||||||
}
|
|
||||||
|
|
||||||
restResources {
|
restResources {
|
||||||
restApi {
|
restApi {
|
||||||
includeXpack 'watcher', 'security', 'xpack'
|
includeXpack 'watcher', 'security', 'xpack'
|
||||||
}
|
}
|
||||||
|
restTests {
|
||||||
|
includeXpack 'watcher'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
integTest.runner.dependsOn copyWatcherRestTests
|
|
||||||
testClusters.integTest {
|
testClusters.integTest {
|
||||||
testDistribution = 'DEFAULT'
|
testDistribution = 'DEFAULT'
|
||||||
setting 'xpack.ilm.enabled', 'false'
|
setting 'xpack.ilm.enabled', 'false'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user