Merge test runner task into RestIntegTest (7.x backport) (#60600)

* Merge test runner task into RestIntegTest (#60261)
* Merge test runner task into RestIntegTest
* Reorganizing Standalone runner and RestIntegTest task
* Rework general test task configuration and extension
* Fix merge issues
* use former 7.x common test configuration
This commit is contained in:
Rene Groeschke 2020-08-04 14:46:32 +02:00 committed by GitHub
parent 859ad761bb
commit bdd7347bbf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
79 changed files with 585 additions and 526 deletions

View File

@ -0,0 +1,70 @@
/*
* 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
import org.elasticsearch.gradle.fixtures.AbstractGradleFuncTest
import org.gradle.testkit.runner.TaskOutcome
class ElasticsearchTestBasePluginFuncTest extends AbstractGradleFuncTest {
def "can configure nonInputProperties for test tasks"() {
given:
file("src/test/java/acme/SomeTests.java").text = """
public class SomeTests {
@org.junit.Test
public void testSysInput() {
org.junit.Assert.assertEquals("bar", System.getProperty("foo"));
}
}
"""
buildFile.text = """
plugins {
id 'java'
id 'elasticsearch.test-base'
}
repositories {
jcenter()
}
dependencies {
testImplementation 'junit:junit:4.12'
}
tasks.named('test').configure {
nonInputProperties.systemProperty("foo", project.getProperty('foo'))
}
"""
when:
def result = gradleRunner("test", '-Dtests.seed=default', '-Pfoo=bar').build()
then:
result.task(':test').outcome == TaskOutcome.SUCCESS
when:
result = gradleRunner("test", '-i', '-Dtests.seed=default', '-Pfoo=baz').build()
then:
result.task(':test').outcome == TaskOutcome.UP_TO_DATE
}
}

View File

@ -58,4 +58,10 @@ abstract class AbstractGradleFuncTest extends Specification{
return input.readLines().join("\n")
}
File file(String path) {
File newFile = new File(testProjectDir.root, path)
newFile.getParentFile().mkdirs()
newFile
}
}

View File

@ -26,6 +26,7 @@ import org.elasticsearch.gradle.VersionProperties
import org.elasticsearch.gradle.dependencies.CompileOnlyResolvePlugin
import org.elasticsearch.gradle.info.BuildParams
import org.elasticsearch.gradle.test.RestIntegTestTask
import org.elasticsearch.gradle.test.RestTestBasePlugin
import org.elasticsearch.gradle.testclusters.RunTask
import org.elasticsearch.gradle.testclusters.TestClustersPlugin
import org.elasticsearch.gradle.util.Util
@ -56,7 +57,7 @@ class PluginBuildPlugin implements Plugin<Project> {
@Override
void apply(Project project) {
project.pluginManager.apply(BuildPlugin)
project.pluginManager.apply(TestClustersPlugin)
project.pluginManager.apply(RestTestBasePlugin)
project.pluginManager.apply(CompileOnlyResolvePlugin.class);
PluginPropertiesExtension extension = project.extensions.create(PLUGIN_EXTENSION_NAME, PluginPropertiesExtension, project)

View File

@ -45,7 +45,7 @@ class RestTestPlugin implements Plugin<Project> {
+ 'requires either elasticsearch.build or '
+ 'elasticsearch.standalone-rest-test')
}
project.getPlugins().apply(RestTestBasePlugin.class);
project.pluginManager.apply(TestClustersPlugin)
RestIntegTestTask integTest = project.tasks.create('integTest', RestIntegTestTask.class)
integTest.description = 'Runs rest tests against an elasticsearch cluster.'

View File

@ -61,12 +61,13 @@ class StandaloneRestTestPlugin implements Plugin<Project> {
project.pluginManager.apply(JavaBasePlugin)
project.pluginManager.apply(TestClustersPlugin)
project.pluginManager.apply(RepositoriesSetupPlugin)
project.pluginManager.apply(RestTestBasePlugin)
project.getTasks().register("buildResources", ExportElasticsearchBuildResourcesTask)
ElasticsearchJavaPlugin.configureTestTasks(project)
ElasticsearchJavaPlugin.configureInputNormalization(project)
ElasticsearchJavaPlugin.configureCompile(project)
project.extensions.getByType(JavaPluginExtension).sourceCompatibility = BuildParams.minimumRuntimeVersion
project.extensions.getByType(JavaPluginExtension).targetCompatibility = BuildParams.minimumRuntimeVersion

View File

@ -22,7 +22,6 @@ package org.elasticsearch.gradle.test;
import org.elasticsearch.gradle.ExportElasticsearchBuildResourcesTask;
import org.elasticsearch.gradle.precommit.ForbiddenPatternsTask;
import org.elasticsearch.gradle.testclusters.ElasticsearchCluster;
import org.elasticsearch.gradle.testclusters.RestTestRunnerTask;
import org.elasticsearch.gradle.testclusters.TestClustersAware;
import org.elasticsearch.gradle.testclusters.TestClustersPlugin;
import org.elasticsearch.gradle.util.Util;
@ -57,7 +56,7 @@ public class TestWithSslPlugin implements Plugin<Project> {
// Tell the tests we're running with ssl enabled
project.getTasks()
.withType(RestTestRunnerTask.class)
.withType(RestIntegTestTask.class)
.configureEach(runner -> runner.systemProperty("tests.ssl.enabled", "true"));
});

View File

@ -19,12 +19,10 @@
package org.elasticsearch.gradle;
import com.github.jengelman.gradle.plugins.shadow.ShadowBasePlugin;
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar;
import nebula.plugin.info.InfoBrokerPlugin;
import org.elasticsearch.gradle.info.BuildParams;
import org.elasticsearch.gradle.info.GlobalBuildInfoPlugin;
import org.elasticsearch.gradle.test.ErrorReportingTestListener;
import org.elasticsearch.gradle.util.Util;
import org.gradle.api.Action;
import org.gradle.api.GradleException;
@ -36,20 +34,16 @@ import org.gradle.api.artifacts.Configuration;
import org.gradle.api.artifacts.ModuleDependency;
import org.gradle.api.artifacts.ProjectDependency;
import org.gradle.api.artifacts.ResolutionStrategy;
import org.gradle.api.file.FileCollection;
import org.gradle.api.plugins.BasePlugin;
import org.gradle.api.plugins.JavaLibraryPlugin;
import org.gradle.api.plugins.JavaPlugin;
import org.gradle.api.plugins.JavaPluginExtension;
import org.gradle.api.tasks.SourceSet;
import org.gradle.api.tasks.SourceSetContainer;
import org.gradle.api.tasks.TaskProvider;
import org.gradle.api.tasks.bundling.Jar;
import org.gradle.api.tasks.compile.CompileOptions;
import org.gradle.api.tasks.compile.GroovyCompile;
import org.gradle.api.tasks.compile.JavaCompile;
import org.gradle.api.tasks.javadoc.Javadoc;
import org.gradle.api.tasks.testing.Test;
import org.gradle.external.javadoc.CoreJavadocOptions;
import org.gradle.language.base.plugins.LifecycleBasePlugin;
@ -60,7 +54,6 @@ import java.util.Map;
import java.util.function.Consumer;
import java.util.function.Function;
import static org.elasticsearch.gradle.util.GradleUtils.maybeConfigure;
import static org.elasticsearch.gradle.util.Util.toStringable;
/**
@ -74,11 +67,11 @@ public class ElasticsearchJavaPlugin implements Plugin<Project> {
// common repositories setup
project.getPluginManager().apply(RepositoriesSetupPlugin.class);
project.getPluginManager().apply(JavaLibraryPlugin.class);
project.getPluginManager().apply(ElasticsearchTestBasePlugin.class);
configureConfigurations(project);
configureCompile(project);
configureInputNormalization(project);
configureTestTasks(project);
configureJars(project);
configureJarManifest(project);
configureJavadoc(project);
@ -206,174 +199,6 @@ public class ElasticsearchJavaPlugin implements Plugin<Project> {
project.getNormalization().getRuntimeClasspath().ignore("META-INF/MANIFEST.MF");
}
public static void configureTestTasks(Project project) {
// Default test task should run only unit tests
maybeConfigure(project.getTasks(), "test", Test.class, task -> task.include("**/*Tests.class"));
// none of this stuff is applicable to the `:buildSrc` project tests
if (project.getPath().equals(":build-tools")) {
return;
}
File heapdumpDir = new File(project.getBuildDir(), "heapdump");
project.getTasks().withType(Test.class).configureEach(test -> {
File testOutputDir = new File(test.getReports().getJunitXml().getDestination(), "output");
ErrorReportingTestListener listener = new ErrorReportingTestListener(test.getTestLogging(), test.getLogger(), testOutputDir);
test.getExtensions().add("errorReportingTestListener", listener);
test.addTestOutputListener(listener);
test.addTestListener(listener);
/*
* We use lazy-evaluated strings in order to configure system properties whose value will not be known until
* execution time (e.g. cluster port numbers). Adding these via the normal DSL doesn't work as these get treated
* as task inputs and therefore Gradle attempts to snapshot them before/after task execution. This fails due
* to the GStrings containing references to non-serializable objects.
*
* We bypass this by instead passing this system properties vi a CommandLineArgumentProvider. This has the added
* side-effect that these properties are NOT treated as inputs, therefore they don't influence things like the
* build cache key or up to date checking.
*/
SystemPropertyCommandLineArgumentProvider nonInputProperties = new SystemPropertyCommandLineArgumentProvider();
// We specifically use an anonymous inner class here because lambda task actions break Gradle cacheability
// See: https://docs.gradle.org/current/userguide/more_about_tasks.html#sec:how_does_it_work
test.doFirst(new Action<>() {
@Override
public void execute(Task t) {
project.mkdir(testOutputDir);
project.mkdir(heapdumpDir);
project.mkdir(test.getWorkingDir());
project.mkdir(test.getWorkingDir().toPath().resolve("temp"));
// TODO remove once jvm.options are added to test system properties
if (BuildParams.getRuntimeJavaVersion() == JavaVersion.VERSION_1_8) {
test.systemProperty("java.locale.providers", "SPI,JRE");
} else {
test.systemProperty("java.locale.providers", "SPI,COMPAT");
test.jvmArgs("--illegal-access=warn");
}
}
});
if (BuildParams.isInFipsJvm()) {
project.getDependencies().add("testRuntimeOnly", "org.bouncycastle:bc-fips:1.0.1");
project.getDependencies().add("testRuntimeOnly", "org.bouncycastle:bctls-fips:1.0.9");
}
test.getJvmArgumentProviders().add(nonInputProperties);
test.getExtensions().add("nonInputProperties", nonInputProperties);
test.setWorkingDir(project.file(project.getBuildDir() + "/testrun/" + test.getName()));
test.setMaxParallelForks(Integer.parseInt(System.getProperty("tests.jvms", BuildParams.getDefaultParallel().toString())));
test.exclude("**/*$*.class");
test.jvmArgs(
"-Xmx" + System.getProperty("tests.heap.size", "512m"),
"-Xms" + System.getProperty("tests.heap.size", "512m"),
"-XX:+HeapDumpOnOutOfMemoryError"
);
test.getJvmArgumentProviders().add(new SimpleCommandLineArgumentProvider("-XX:HeapDumpPath=" + heapdumpDir));
String argline = System.getProperty("tests.jvm.argline");
if (argline != null) {
test.jvmArgs((Object[]) argline.split(" "));
}
if (Util.getBooleanProperty("tests.asserts", true)) {
test.jvmArgs("-ea", "-esa");
}
Map<String, String> sysprops = Map.of(
"java.awt.headless",
"true",
"tests.gradle",
"true",
"tests.artifact",
project.getName(),
"tests.task",
test.getPath(),
"tests.security.manager",
"true",
"jna.nosys",
"true"
);
test.systemProperties(sysprops);
// ignore changing test seed when build is passed -Dignore.tests.seed for cacheability experimentation
if (System.getProperty("ignore.tests.seed") != null) {
nonInputProperties.systemProperty("tests.seed", BuildParams.getTestSeed());
} else {
test.systemProperty("tests.seed", BuildParams.getTestSeed());
}
// don't track these as inputs since they contain absolute paths and break cache relocatability
File gradleHome = project.getGradle().getGradleUserHomeDir();
String gradleVersion = project.getGradle().getGradleVersion();
nonInputProperties.systemProperty("gradle.dist.lib", new File(project.getGradle().getGradleHomeDir(), "lib"));
nonInputProperties.systemProperty(
"gradle.worker.jar",
gradleHome + "/caches/" + gradleVersion + "/workerMain/gradle-worker.jar"
);
nonInputProperties.systemProperty("gradle.user.home", gradleHome);
// we use 'temp' relative to CWD since this is per JVM and tests are forbidden from writing to CWD
nonInputProperties.systemProperty("java.io.tmpdir", test.getWorkingDir().toPath().resolve("temp"));
// TODO: remove setting logging level via system property
test.systemProperty("tests.logger.level", "WARN");
System.getProperties().entrySet().forEach(entry -> {
if ((entry.getKey().toString().startsWith("tests.") || entry.getKey().toString().startsWith("es."))) {
test.systemProperty(entry.getKey().toString(), entry.getValue());
}
});
// TODO: remove this once ctx isn't added to update script params in 7.0
test.systemProperty("es.scripting.update.ctx_in_params", "false");
// TODO: remove this property in 8.0
test.systemProperty("es.search.rewrite_sort", "true");
// TODO: remove this once cname is prepended to transport.publish_address by default in 8.0
test.systemProperty("es.transport.cname_in_publish_address", "true");
// Set netty system properties to the properties we configure in jvm.options
test.systemProperty("io.netty.noUnsafe", "true");
test.systemProperty("io.netty.noKeySetOptimization", "true");
test.systemProperty("io.netty.recycler.maxCapacityPerThread", "0");
test.testLogging(logging -> {
logging.setShowExceptions(true);
logging.setShowCauses(true);
logging.setExceptionFormat("full");
});
if (OS.current().equals(OS.WINDOWS) && System.getProperty("tests.timeoutSuite") == null) {
// override the suite timeout to 30 mins for windows, because it has the most inefficient filesystem known to man
test.systemProperty("tests.timeoutSuite", "1800000!");
}
/*
* If this project builds a shadow JAR than any unit tests should test against that artifact instead of
* compiled class output and dependency jars. This better emulates the runtime environment of consumers.
*/
project.getPluginManager().withPlugin("com.github.johnrengelman.shadow", p -> {
// Remove output class files and any other dependencies from the test classpath, since the shadow JAR includes these
FileCollection mainRuntime = project.getExtensions()
.getByType(SourceSetContainer.class)
.getByName(SourceSet.MAIN_SOURCE_SET_NAME)
.getRuntimeClasspath();
// Add any "shadow" dependencies. These are dependencies that are *not* bundled into the shadow JAR
Configuration shadowConfig = project.getConfigurations().getByName(ShadowBasePlugin.getCONFIGURATION_NAME());
// Add the shadow JAR artifact itself
FileCollection shadowJar = project.files(project.getTasks().named("shadowJar"));
test.setClasspath(test.getClasspath().minus(mainRuntime).plus(shadowConfig).plus(shadowJar));
});
});
}
/**
* Adds additional manifest info to jars
*/

View File

@ -0,0 +1,218 @@
/*
* 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;
import com.github.jengelman.gradle.plugins.shadow.ShadowBasePlugin;
import org.elasticsearch.gradle.info.BuildParams;
import org.elasticsearch.gradle.info.GlobalBuildInfoPlugin;
import org.elasticsearch.gradle.test.ErrorReportingTestListener;
import org.elasticsearch.gradle.util.Util;
import org.gradle.api.Action;
import org.gradle.api.JavaVersion;
import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.api.Task;
import org.gradle.api.artifacts.Configuration;
import org.gradle.api.file.FileCollection;
import org.gradle.api.tasks.SourceSet;
import org.gradle.api.tasks.SourceSetContainer;
import org.gradle.api.tasks.testing.Test;
import java.io.File;
import java.util.Map;
import static org.elasticsearch.gradle.util.GradleUtils.maybeConfigure;
/**
* Applies commonly used settings to all Test tasks in the project
*/
public class ElasticsearchTestBasePlugin implements Plugin<Project> {
@Override
public void apply(Project project) {
// for fips mode check
project.getRootProject().getPluginManager().apply(GlobalBuildInfoPlugin.class);
// Default test task should run only unit tests
maybeConfigure(project.getTasks(), "test", Test.class, task -> task.include("**/*Tests.class"));
// none of this stuff is applicable to the `:buildSrc` project tests
if (project.getPath().equals(":build-tools")) {
return;
}
File heapdumpDir = new File(project.getBuildDir(), "heapdump");
project.getTasks().withType(Test.class).configureEach(test -> {
File testOutputDir = new File(test.getReports().getJunitXml().getDestination(), "output");
ErrorReportingTestListener listener = new ErrorReportingTestListener(test.getTestLogging(), test.getLogger(), testOutputDir);
test.getExtensions().add("errorReportingTestListener", listener);
test.addTestOutputListener(listener);
test.addTestListener(listener);
/*
* We use lazy-evaluated strings in order to configure system properties whose value will not be known until
* execution time (e.g. cluster port numbers). Adding these via the normal DSL doesn't work as these get treated
* as task inputs and therefore Gradle attempts to snapshot them before/after task execution. This fails due
* to the GStrings containing references to non-serializable objects.
*
* We bypass this by instead passing this system properties vi a CommandLineArgumentProvider. This has the added
* side-effect that these properties are NOT treated as inputs, therefore they don't influence things like the
* build cache key or up to date checking.
*/
SystemPropertyCommandLineArgumentProvider nonInputProperties = new SystemPropertyCommandLineArgumentProvider();
// We specifically use an anonymous inner class here because lambda task actions break Gradle cacheability
// See: https://docs.gradle.org/current/userguide/more_about_tasks.html#sec:how_does_it_work
test.doFirst(new Action<>() {
@Override
public void execute(Task t) {
project.mkdir(testOutputDir);
project.mkdir(heapdumpDir);
project.mkdir(test.getWorkingDir());
project.mkdir(test.getWorkingDir().toPath().resolve("temp"));
// TODO remove once jvm.options are added to test system properties
if (BuildParams.getRuntimeJavaVersion() == JavaVersion.VERSION_1_8) {
test.systemProperty("java.locale.providers", "SPI,JRE");
} else {
test.systemProperty("java.locale.providers", "SPI,COMPAT");
test.jvmArgs("--illegal-access=warn");
}
}
});
if (BuildParams.isInFipsJvm()) {
project.getDependencies().add("testRuntimeOnly", "org.bouncycastle:bc-fips:1.0.1");
project.getDependencies().add("testRuntimeOnly", "org.bouncycastle:bctls-fips:1.0.9");
}
test.getJvmArgumentProviders().add(nonInputProperties);
test.getExtensions().add("nonInputProperties", nonInputProperties);
test.setWorkingDir(project.file(project.getBuildDir() + "/testrun/" + test.getName()));
test.setMaxParallelForks(Integer.parseInt(System.getProperty("tests.jvms", BuildParams.getDefaultParallel().toString())));
test.exclude("**/*$*.class");
test.jvmArgs(
"-Xmx" + System.getProperty("tests.heap.size", "512m"),
"-Xms" + System.getProperty("tests.heap.size", "512m"),
"-XX:+HeapDumpOnOutOfMemoryError"
);
test.getJvmArgumentProviders().add(new SimpleCommandLineArgumentProvider("-XX:HeapDumpPath=" + heapdumpDir));
String argline = System.getProperty("tests.jvm.argline");
if (argline != null) {
test.jvmArgs((Object[]) argline.split(" "));
}
if (Util.getBooleanProperty("tests.asserts", true)) {
test.jvmArgs("-ea", "-esa");
}
Map<String, String> sysprops = Map.of(
"java.awt.headless",
"true",
"tests.gradle",
"true",
"tests.artifact",
project.getName(),
"tests.task",
test.getPath(),
"tests.security.manager",
"true",
"jna.nosys",
"true"
);
test.systemProperties(sysprops);
// ignore changing test seed when build is passed -Dignore.tests.seed for cacheability experimentation
if (System.getProperty("ignore.tests.seed") != null) {
nonInputProperties.systemProperty("tests.seed", BuildParams.getTestSeed());
} else {
test.systemProperty("tests.seed", BuildParams.getTestSeed());
}
// don't track these as inputs since they contain absolute paths and break cache relocatability
File gradleHome = project.getGradle().getGradleUserHomeDir();
String gradleVersion = project.getGradle().getGradleVersion();
nonInputProperties.systemProperty("gradle.dist.lib", new File(project.getGradle().getGradleHomeDir(), "lib"));
nonInputProperties.systemProperty(
"gradle.worker.jar",
gradleHome + "/caches/" + gradleVersion + "/workerMain/gradle-worker.jar"
);
nonInputProperties.systemProperty("gradle.user.home", gradleHome);
// we use 'temp' relative to CWD since this is per JVM and tests are forbidden from writing to CWD
nonInputProperties.systemProperty("java.io.tmpdir", test.getWorkingDir().toPath().resolve("temp"));
// TODO: remove setting logging level via system property
test.systemProperty("tests.logger.level", "WARN");
System.getProperties().entrySet().forEach(entry -> {
if ((entry.getKey().toString().startsWith("tests.") || entry.getKey().toString().startsWith("es."))) {
test.systemProperty(entry.getKey().toString(), entry.getValue());
}
});
// TODO: remove this once ctx isn't added to update script params in 7.0
test.systemProperty("es.scripting.update.ctx_in_params", "false");
// TODO: remove this property in 8.0
test.systemProperty("es.search.rewrite_sort", "true");
// TODO: remove this once cname is prepended to transport.publish_address by default in 8.0
test.systemProperty("es.transport.cname_in_publish_address", "true");
// Set netty system properties to the properties we configure in jvm.options
test.systemProperty("io.netty.noUnsafe", "true");
test.systemProperty("io.netty.noKeySetOptimization", "true");
test.systemProperty("io.netty.recycler.maxCapacityPerThread", "0");
test.testLogging(logging -> {
logging.setShowExceptions(true);
logging.setShowCauses(true);
logging.setExceptionFormat("full");
});
if (OS.current().equals(OS.WINDOWS) && System.getProperty("tests.timeoutSuite") == null) {
// override the suite timeout to 30 mins for windows, because it has the most inefficient filesystem known to man
test.systemProperty("tests.timeoutSuite", "1800000!");
}
/*
* If this project builds a shadow JAR than any unit tests should test against that artifact instead of
* compiled class output and dependency jars. This better emulates the runtime environment of consumers.
*/
project.getPluginManager().withPlugin("com.github.johnrengelman.shadow", p -> {
// Remove output class files and any other dependencies from the test classpath, since the shadow JAR includes these
FileCollection mainRuntime = project.getExtensions()
.getByType(SourceSetContainer.class)
.getByName(SourceSet.MAIN_SOURCE_SET_NAME)
.getRuntimeClasspath();
// Add any "shadow" dependencies. These are dependencies that are *not* bundled into the shadow JAR
Configuration shadowConfig = project.getConfigurations().getByName(ShadowBasePlugin.getCONFIGURATION_NAME());
// Add the shadow JAR artifact itself
FileCollection shadowJar = project.files(project.getTasks().named("shadowJar"));
test.setClasspath(test.getClasspath().minus(mainRuntime).plus(shadowConfig).plus(shadowJar));
});
});
}
}

View File

@ -19,95 +19,13 @@
package org.elasticsearch.gradle.test;
import org.elasticsearch.gradle.SystemPropertyCommandLineArgumentProvider;
import org.elasticsearch.gradle.testclusters.ElasticsearchCluster;
import org.elasticsearch.gradle.testclusters.RestTestRunnerTask;
import org.elasticsearch.gradle.testclusters.TestClustersPlugin;
import org.gradle.api.Action;
import org.gradle.api.DefaultTask;
import org.gradle.api.NamedDomainObjectContainer;
import org.gradle.api.Project;
import org.gradle.api.Task;
import org.gradle.api.tasks.Internal;
import org.elasticsearch.gradle.testclusters.StandaloneRestIntegTestTask;
import org.gradle.api.tasks.CacheableTask;
public class RestIntegTestTask extends DefaultTask {
protected RestTestRunnerTask runner;
private static final String TESTS_REST_CLUSTER = "tests.rest.cluster";
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();
runner = project.getTasks().create(name + "Runner", RestTestRunnerTask.class);
super.dependsOn(runner);
@SuppressWarnings("unchecked")
NamedDomainObjectContainer<ElasticsearchCluster> testClusters = (NamedDomainObjectContainer<ElasticsearchCluster>) project
.getExtensions()
.getByName(TestClustersPlugin.EXTENSION_NAME);
ElasticsearchCluster cluster = testClusters.create(name);
runner.useCluster(cluster);
runner.include("**/*IT.class");
runner.systemProperty("tests.rest.load_packaged", Boolean.FALSE.toString());
if (System.getProperty(TESTS_REST_CLUSTER) == null) {
if (System.getProperty(TESTS_CLUSTER) != null || System.getProperty(TESTS_CLUSTER_NAME) != null) {
throw new IllegalArgumentException(
String.format("%s, %s, and %s must all be null or non-null", TESTS_REST_CLUSTER, TESTS_CLUSTER, TESTS_CLUSTER_NAME)
);
}
SystemPropertyCommandLineArgumentProvider runnerNonInputProperties = (SystemPropertyCommandLineArgumentProvider) runner
.getExtensions()
.getByName("nonInputProperties");
runnerNonInputProperties.systemProperty(TESTS_REST_CLUSTER, () -> String.join(",", cluster.getAllHttpSocketURI()));
runnerNonInputProperties.systemProperty(TESTS_CLUSTER, () -> String.join(",", cluster.getAllTransportPortURI()));
runnerNonInputProperties.systemProperty(TESTS_CLUSTER_NAME, cluster::getName);
} else {
if (System.getProperty(TESTS_CLUSTER) == null || System.getProperty(TESTS_CLUSTER_NAME) == null) {
throw new IllegalArgumentException(
String.format("%s, %s, and %s must all be null or non-null", TESTS_REST_CLUSTER, TESTS_CLUSTER, TESTS_CLUSTER_NAME)
);
}
}
// this must run after all projects have been configured, so we know any project
// references can be accessed as a fully configured
project.getGradle().projectsEvaluated(x -> {
if (isEnabled() == false) {
runner.setEnabled(false);
}
});
}
@Override
public Task dependsOn(Object... dependencies) {
runner.dependsOn(dependencies);
for (Object dependency : dependencies) {
if (dependency instanceof Fixture) {
runner.finalizedBy(((Fixture) dependency).getStopTask());
}
}
return this;
}
@Override
public void setDependsOn(Iterable<?> dependencies) {
runner.setDependsOn(dependencies);
for (Object dependency : dependencies) {
if (dependency instanceof Fixture) {
runner.finalizedBy(((Fixture) dependency).getStopTask());
}
}
}
public void runner(Action<? super RestTestRunnerTask> configure) {
configure.execute(runner);
}
@Internal
public RestTestRunnerTask getRunner() {
return runner;
}
}
/**
* Sub typed version of {@link StandaloneRestIntegTestTask} that is used to differentiate between plain standalone
* integ test tasks based on {@link StandaloneRestIntegTestTask} and
* conventional configured tasks of {@link RestIntegTestTask}
*/
@CacheableTask
public class RestIntegTestTask extends StandaloneRestIntegTestTask {}

View File

@ -0,0 +1,68 @@
/*
* 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;
import org.elasticsearch.gradle.ElasticsearchTestBasePlugin;
import org.elasticsearch.gradle.SystemPropertyCommandLineArgumentProvider;
import org.elasticsearch.gradle.testclusters.ElasticsearchCluster;
import org.elasticsearch.gradle.testclusters.TestClustersPlugin;
import org.gradle.api.NamedDomainObjectContainer;
import org.gradle.api.Plugin;
import org.gradle.api.Project;
public class RestTestBasePlugin implements Plugin<Project> {
private static final String TESTS_REST_CLUSTER = "tests.rest.cluster";
private static final String TESTS_CLUSTER = "tests.cluster";
private static final String TESTS_CLUSTER_NAME = "tests.clustername";
@Override
public void apply(Project project) {
project.getPluginManager().apply(TestClustersPlugin.class);
project.getPluginManager().apply(ElasticsearchTestBasePlugin.class);
project.getTasks().withType(RestIntegTestTask.class).configureEach(restIntegTestTask -> {
@SuppressWarnings("unchecked")
NamedDomainObjectContainer<ElasticsearchCluster> testClusters = (NamedDomainObjectContainer<ElasticsearchCluster>) project
.getExtensions()
.getByName(TestClustersPlugin.EXTENSION_NAME);
ElasticsearchCluster cluster = testClusters.create(restIntegTestTask.getName());
restIntegTestTask.useCluster(cluster);
restIntegTestTask.include("**/*IT.class");
restIntegTestTask.systemProperty("tests.rest.load_packaged", Boolean.FALSE.toString());
if (System.getProperty(TESTS_REST_CLUSTER) == null) {
if (System.getProperty(TESTS_CLUSTER) != null || System.getProperty(TESTS_CLUSTER_NAME) != null) {
throw new IllegalArgumentException(
String.format("%s, %s, and %s must all be null or non-null", TESTS_REST_CLUSTER, TESTS_CLUSTER, TESTS_CLUSTER_NAME)
);
}
SystemPropertyCommandLineArgumentProvider runnerNonInputProperties =
(SystemPropertyCommandLineArgumentProvider) restIntegTestTask.getExtensions().getByName("nonInputProperties");
runnerNonInputProperties.systemProperty(TESTS_REST_CLUSTER, () -> String.join(",", cluster.getAllHttpSocketURI()));
runnerNonInputProperties.systemProperty(TESTS_CLUSTER, () -> String.join(",", cluster.getAllTransportPortURI()));
runnerNonInputProperties.systemProperty(TESTS_CLUSTER_NAME, cluster::getName);
} else {
if (System.getProperty(TESTS_CLUSTER) == null || System.getProperty(TESTS_CLUSTER_NAME) == null) {
throw new IllegalArgumentException(
String.format("%s, %s, and %s must all be null or non-null", TESTS_REST_CLUSTER, TESTS_CLUSTER, TESTS_CLUSTER_NAME)
);
}
}
});
}
}

View File

@ -23,7 +23,6 @@ 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.gradle.api.Project;
import org.gradle.api.plugins.JavaBasePlugin;
import org.gradle.api.tasks.SourceSet;
@ -53,19 +52,18 @@ public class RestTestUtil {
/**
* Creates the runner task and configures the test clusters
*/
static RestTestRunnerTask setupRunnerTask(Project project, RestIntegTestTask testTask, SourceSet sourceSet) {
RestTestRunnerTask runner = testTask.getRunner();
runner.setTestClassesDirs(sourceSet.getOutput().getClassesDirs());
runner.setClasspath(sourceSet.getRuntimeClasspath());
static void setupRunnerTask(Project project, RestIntegTestTask testTask, SourceSet sourceSet) {
testTask.setTestClassesDirs(sourceSet.getOutput().getClassesDirs());
testTask.setClasspath(sourceSet.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");
testTask.dependsOn(bundle);
if (project.getPath().startsWith(":modules:")) {
runner.getClusters().forEach(c -> c.module(bundle.getArchiveFile()));
testTask.getClusters().forEach(c -> c.module(bundle.getArchiveFile()));
} else {
runner.getClusters().forEach(c -> c.plugin(project.getObjects().fileProperty().value(bundle.getArchiveFile())));
testTask.getClusters().forEach(c -> c.plugin(project.getObjects().fileProperty().value(bundle.getArchiveFile())));
}
});
@ -78,12 +76,11 @@ public class RestTestUtil {
if (extensionProject != null) { // extension plugin may be defined, but not required to be a module
Zip extensionBundle = (Zip) extensionProject.getTasks().getByName("bundlePlugin");
testTask.dependsOn(extensionBundle);
runner.getClusters().forEach(c -> c.module(extensionBundle.getArchiveFile()));
testTask.getClusters().forEach(c -> c.module(extensionBundle.getArchiveFile()));
}
});
}
});
return runner;
}
/**

View File

@ -21,6 +21,7 @@ package org.elasticsearch.gradle.test.rest;
import org.elasticsearch.gradle.ElasticsearchJavaPlugin;
import org.elasticsearch.gradle.test.RestIntegTestTask;
import org.elasticsearch.gradle.test.RestTestBasePlugin;
import org.elasticsearch.gradle.testclusters.TestClustersPlugin;
import org.elasticsearch.gradle.util.GradleUtils;
import org.gradle.api.Plugin;
@ -45,6 +46,7 @@ public class YamlRestTestPlugin implements Plugin<Project> {
project.getPluginManager().apply(ElasticsearchJavaPlugin.class);
project.getPluginManager().apply(TestClustersPlugin.class);
project.getPluginManager().apply(RestTestBasePlugin.class);
project.getPluginManager().apply(RestResourcesPlugin.class);
// create source set

View File

@ -18,7 +18,9 @@
*/
package org.elasticsearch.gradle.testclusters;
import org.elasticsearch.gradle.test.Fixture;
import org.elasticsearch.gradle.util.GradleUtils;
import org.gradle.api.Task;
import org.gradle.api.provider.Provider;
import org.gradle.api.services.internal.BuildServiceRegistryInternal;
import org.gradle.api.tasks.CacheableTask;
@ -42,11 +44,11 @@ import static org.elasticsearch.gradle.testclusters.TestClustersPlugin.THROTTLE_
* {@link Nested} inputs.
*/
@CacheableTask
public class RestTestRunnerTask extends Test implements TestClustersAware {
public class StandaloneRestIntegTestTask extends Test implements TestClustersAware {
private Collection<ElasticsearchCluster> clusters = new HashSet<>();
public RestTestRunnerTask() {
public StandaloneRestIntegTestTask() {
this.getOutputs()
.doNotCacheIf(
"Caching disabled for this task since it uses a cluster shared by other tasks",
@ -57,7 +59,7 @@ public class RestTestRunnerTask extends Test implements TestClustersAware {
* multiple tasks.
*/
t -> getProject().getTasks()
.withType(RestTestRunnerTask.class)
.withType(StandaloneRestIntegTestTask.class)
.stream()
.filter(task -> task != this)
.anyMatch(task -> Collections.disjoint(task.getClusters(), getClusters()) == false)
@ -90,4 +92,25 @@ public class RestTestRunnerTask extends Test implements TestClustersAware {
return Collections.unmodifiableList(locks);
}
@Override
public Task dependsOn(Object... dependencies) {
super.dependsOn(dependencies);
for (Object dependency : dependencies) {
if (dependency instanceof Fixture) {
finalizedBy(((Fixture) dependency).getStopTask());
}
}
return this;
}
@Override
public void setDependsOn(Iterable<?> dependencies) {
super.setDependsOn(dependencies);
for (Object dependency : dependencies) {
if (dependency instanceof Fixture) {
finalizedBy(((Fixture) dependency).getStopTask());
}
}
}
}

View File

@ -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.ElasticsearchTestBasePlugin

View File

@ -69,18 +69,16 @@ File nodeCert = file("./testnode.crt")
File nodeTrustStore = file("./testnode.jks")
File pkiTrustCert = file("./src/test/resources/org/elasticsearch/client/security/delegate_pki/testRootCA.crt")
integTest.runner {
integTest {
systemProperty 'tests.rest.async', 'false'
systemProperty 'tests.rest.cluster.username', System.getProperty('tests.rest.cluster.username', 'test_user')
systemProperty 'tests.rest.cluster.password', System.getProperty('tests.rest.cluster.password', 'test-password')
}
RestIntegTestTask asyncIntegTest = tasks.create("asyncIntegTest", RestIntegTestTask) {
runner {
systemProperty 'tests.rest.async', 'true'
systemProperty 'tests.rest.cluster.username', System.getProperty('tests.rest.cluster.username', 'test_user')
systemProperty 'tests.rest.cluster.password', System.getProperty('tests.rest.cluster.password', 'test-password')
}
}
check.dependsOn(asyncIntegTest)

View File

@ -341,11 +341,9 @@ configure(subprojects.findAll { it.name == 'integ-test-zip' }) {
integTest {
dependsOn assemble
runner {
if (Os.isFamily(Os.FAMILY_WINDOWS) && System.getProperty('tests.timeoutSuite') == null) {
// override the suite timeout to 30 mins for windows, because it has the most inefficient filesystem known to man
systemProperty 'tests.timeoutSuite', '1800000!'
}
if (Os.isFamily(Os.FAMILY_WINDOWS) && System.getProperty('tests.timeoutSuite') == null) {
// override the suite timeout to 30 mins for windows, because it has the most inefficient filesystem known to man
systemProperty 'tests.timeoutSuite', '1800000!'
}
}

View File

@ -17,7 +17,7 @@
* under the License.
*/
integTest.runner {
integTest {
/*
* There are two unique things going on here:
* 1. These tests can be run against an external cluster with

View File

@ -110,12 +110,12 @@ jdks {
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
logger.warn("Disabling reindex-from-old tests because we can't get the pid file on windows")
javaRestTest.runner {
javaRestTest {
systemProperty "tests.fromOld", "false"
}
} else if (rootProject.rootDir.toString().contains(" ")) {
logger.warn("Disabling reindex-from-old tests because Elasticsearch 1.7 won't start with spaces in the path")
javaRestTest.runner {
javaRestTest {
systemProperty "tests.fromOld", "false"
}
} else {
@ -158,13 +158,11 @@ if (Os.isFamily(Os.FAMILY_WINDOWS)) {
javaRestTest {
dependsOn fixture
runner {
systemProperty "tests.fromOld", "true"
/* Use a closure on the string to delay evaluation until right before we
* run the integration tests so that we can be sure that the file is
* ready. */
nonInputProperties.systemProperty "es${version}.port", "${-> fixture.addressAndPort}"
}
}
}
}

View File

@ -72,7 +72,7 @@ internalClusterTest {
systemProperty 'es.set.netty.runtime.available.processors', 'false'
}
javaRestTestRunner {
javaRestTest {
systemProperty 'es.set.netty.runtime.available.processors', 'false'
}
@ -93,13 +93,11 @@ TaskProvider<Test> pooledInternalClusterTest = tasks.register("pooledInternalClu
}
RestIntegTestTask pooledJavaRestTest = tasks.create("pooledJavaRestTest", RestIntegTestTask) {
runner {
systemProperty 'es.set.netty.runtime.available.processors', 'false'
SourceSetContainer sourceSets = project.getExtensions().getByType(SourceSetContainer.class);
SourceSet javaRestTestSourceSet = sourceSets.getByName(JavaRestTestPlugin.SOURCE_SET_NAME)
setTestClassesDirs(javaRestTestSourceSet.getOutput().getClassesDirs())
setClasspath(javaRestTestSourceSet.getRuntimeClasspath())
}
}
testClusters.pooledJavaRestTest {
systemProperty 'es.use_unpooled_allocator', 'false'

View File

@ -77,10 +77,8 @@ yamlRestTest.enabled = false
SourceSetContainer sourceSets = project.getExtensions().getByType(SourceSetContainer.class);
SourceSet yamlRestTestSourceSet = sourceSets.getByName(YamlRestTestPlugin.SOURCE_SET_NAME)
"yamlRestTest${action}" {
runner {
setTestClassesDirs(yamlRestTestSourceSet.getOutput().getClassesDirs())
setClasspath(yamlRestTestSourceSet.getRuntimeClasspath())
}
setTestClassesDirs(yamlRestTestSourceSet.getOutput().getClassesDirs())
setClasspath(yamlRestTestSourceSet.getRuntimeClasspath())
}
check.dependsOn("yamlRestTest${action}")

View File

@ -42,8 +42,6 @@ tasks.register("exampleFixture", org.elasticsearch.gradle.test.AntFixture) {
javaRestTest {
dependsOn exampleFixture
runner {
nonInputProperties.systemProperty 'external.address', "${-> exampleFixture.addressAndPort}"
}
nonInputProperties.systemProperty 'external.address', "${-> exampleFixture.addressAndPort}"
}

View File

@ -21,9 +21,7 @@ dependencies {
test.enabled = false
javaRestTest {
dependsOn buildZip
runner {
systemProperty 'tests.security.manager', 'false'
}
systemProperty 'tests.security.manager', 'false'
}
testClusters.javaRestTest {

View File

@ -298,12 +298,10 @@ task largeBlobYamlRestTest(type: RestIntegTestTask) {
if (useFixture) {
dependsOn createServiceAccountFile
}
runner {
SourceSetContainer sourceSets = project.getExtensions().getByType(SourceSetContainer.class);
SourceSet yamlRestTestSourceSet = sourceSets.getByName(YamlRestTestPlugin.SOURCE_SET_NAME)
setTestClassesDirs(yamlRestTestSourceSet.getOutput().getClassesDirs())
setClasspath(yamlRestTestSourceSet.getRuntimeClasspath())
}
}
check.dependsOn largeBlobYamlRestTest

View File

@ -163,7 +163,6 @@ for (String integTestTaskName : ['integTestHa', 'integTestSecure', 'integTestSec
}
}
runner {
onlyIf { BuildParams.inFipsJvm == false }
if (integTestTaskName.contains("Ha")) {
Path portsFile
@ -202,7 +201,6 @@ for (String integTestTaskName : ['integTestHa', 'integTestSecure', 'integTestSec
)
}
}
}
}
testClusters."${integTestTaskName}" {
@ -244,7 +242,7 @@ if (legalPath == false) {
// Always ignore HA integration tests in the normal integration test runner, they are included below as
// part of their own HA-specific integration test tasks.
integTest.runner {
integTest {
onlyIf { BuildParams.inFipsJvm == false }
exclude('**/Ha*TestSuiteIT.class')
}
@ -258,12 +256,12 @@ if (fixtureSupported) {
integTestHa.dependsOn haHdfsFixture
// The normal test runner only runs the standard hdfs rest tests
integTest.runner {
integTest {
systemProperty 'tests.rest.suite', 'hdfs_repository'
}
// Only include the HA integration tests for the HA test task
integTestHa.runner {
integTestHa {
setIncludes(['**/Ha*TestSuiteIT.class'])
}
} else {
@ -274,7 +272,7 @@ if (fixtureSupported) {
}
// The normal integration test runner will just test that the plugin loads
integTest.runner {
integTest {
systemProperty 'tests.rest.suite', 'hdfs_repository/10_basic'
}
// HA fixture is unsupported. Don't run them.
@ -284,15 +282,15 @@ if (fixtureSupported) {
check.dependsOn(integTestSecure, integTestSecureHa)
// Run just the secure hdfs rest test suite.
integTestSecure.runner {
integTestSecure {
systemProperty 'tests.rest.suite', 'secure_hdfs_repository'
}
// Ignore HA integration Tests. They are included below as part of integTestSecureHa test runner.
integTestSecure.runner {
integTestSecure {
exclude('**/Ha*TestSuiteIT.class')
}
// Only include the HA integration tests for the HA test task
integTestSecureHa.runner {
integTestSecureHa {
setIncludes(['**/Ha*TestSuiteIT.class'])
}

View File

@ -178,7 +178,6 @@ internalClusterTest {
}
yamlRestTest {
runner {
systemProperty 'tests.rest.blacklist', (
useFixture ?
['repository_s3/50_repository_ecs_credentials/*']
@ -189,7 +188,6 @@ yamlRestTest {
'repository_s3/50_repository_ecs_credentials/*'
]
).join(",")
}
}
testClusters.yamlRestTest {
@ -230,19 +228,17 @@ if (useFixture) {
task yamlRestTestMinio(type: RestIntegTestTask) {
description = "Runs REST tests using the Minio repository."
dependsOn tasks.bundlePlugin
runner {
SourceSetContainer sourceSets = project.getExtensions().getByType(SourceSetContainer.class);
SourceSet yamlRestTestSourceSet = sourceSets.getByName(YamlRestTestPlugin.SOURCE_SET_NAME)
setTestClassesDirs(yamlRestTestSourceSet.getOutput().getClassesDirs())
setClasspath(yamlRestTestSourceSet.getRuntimeClasspath())
SourceSetContainer sourceSets = project.getExtensions().getByType(SourceSetContainer.class);
SourceSet yamlRestTestSourceSet = sourceSets.getByName(YamlRestTestPlugin.SOURCE_SET_NAME)
setTestClassesDirs(yamlRestTestSourceSet.getOutput().getClassesDirs())
setClasspath(yamlRestTestSourceSet.getRuntimeClasspath())
// Minio only supports a single access key, see https://github.com/minio/minio/pull/5968
systemProperty 'tests.rest.blacklist', [
'repository_s3/30_repository_temporary_credentials/*',
'repository_s3/40_repository_ec2_credentials/*',
'repository_s3/50_repository_ecs_credentials/*'
].join(",")
}
// Minio only supports a single access key, see https://github.com/minio/minio/pull/5968
systemProperty 'tests.rest.blacklist', [
'repository_s3/30_repository_temporary_credentials/*',
'repository_s3/40_repository_ec2_credentials/*',
'repository_s3/50_repository_ecs_credentials/*'
].join(",")
}
check.dependsOn(yamlRestTestMinio)
@ -260,18 +256,16 @@ if (useFixture) {
task yamlRestTestECS(type: RestIntegTestTask.class) {
description = "Runs tests using the ECS repository."
dependsOn('bundlePlugin')
runner {
SourceSetContainer sourceSets = project.getExtensions().getByType(SourceSetContainer.class);
SourceSet yamlRestTestSourceSet = sourceSets.getByName(YamlRestTestPlugin.SOURCE_SET_NAME)
setTestClassesDirs(yamlRestTestSourceSet.getOutput().getClassesDirs())
setClasspath(yamlRestTestSourceSet.getRuntimeClasspath())
systemProperty 'tests.rest.blacklist', [
'repository_s3/10_basic/*',
'repository_s3/20_repository_permanent_credentials/*',
'repository_s3/30_repository_temporary_credentials/*',
'repository_s3/40_repository_ec2_credentials/*'
].join(",")
}
SourceSetContainer sourceSets = project.getExtensions().getByType(SourceSetContainer.class);
SourceSet yamlRestTestSourceSet = sourceSets.getByName(YamlRestTestPlugin.SOURCE_SET_NAME)
setTestClassesDirs(yamlRestTestSourceSet.getOutput().getClassesDirs())
setClasspath(yamlRestTestSourceSet.getRuntimeClasspath())
systemProperty 'tests.rest.blacklist', [
'repository_s3/10_basic/*',
'repository_s3/20_repository_permanent_credentials/*',
'repository_s3/30_repository_temporary_credentials/*',
'repository_s3/40_repository_ec2_credentials/*'
].join(",")
}
check.dependsOn(yamlRestTestECS)

View File

@ -27,7 +27,7 @@ esplugin {
classname 'org.elasticsearch.DieWithDignityPlugin'
}
integTest.runner {
integTest {
systemProperty 'tests.security.manager', 'false'
systemProperty 'tests.system_call_filter', 'false'
nonInputProperties.systemProperty 'log', "${-> testClusters.integTest.singleNode().getServerLog()}"

View File

@ -20,8 +20,7 @@
import org.elasticsearch.gradle.Version
import org.elasticsearch.gradle.info.BuildParams
import org.elasticsearch.gradle.testclusters.RestTestRunnerTask
import org.elasticsearch.gradle.testclusters.TestDistribution
import org.elasticsearch.gradle.testclusters.StandaloneRestIntegTestTask
apply plugin: 'elasticsearch.testclusters'
apply plugin: 'elasticsearch.standalone-test'
@ -41,7 +40,7 @@ for (Version bwcVersion : BuildParams.bwcVersions.indexCompatible) {
}
}
tasks.register("${baseName}#oldClusterTest", RestTestRunnerTask) {
tasks.register("${baseName}#oldClusterTest", StandaloneRestIntegTestTask) {
useCluster testClusters."${baseName}"
mustRunAfter(precommit)
doFirst {
@ -51,7 +50,7 @@ for (Version bwcVersion : BuildParams.bwcVersions.indexCompatible) {
systemProperty 'tests.is_old_cluster', 'true'
}
tasks.register("${baseName}#upgradedClusterTest", RestTestRunnerTask) {
tasks.register("${baseName}#upgradedClusterTest", StandaloneRestIntegTestTask) {
useCluster testClusters."${baseName}"
dependsOn "${baseName}#oldClusterTest"
doFirst {

View File

@ -30,7 +30,7 @@ testClusters.integTest {
extraConfigFile 'log4j2.properties', file('custom-log4j2.properties')
}
integTest.runner {
integTest {
nonInputProperties.systemProperty 'tests.logfile',
"${-> testClusters.integTest.singleNode().getServerLog().absolutePath.replaceAll(".json", ".log")}"
}

View File

@ -20,7 +20,7 @@
import org.elasticsearch.gradle.Version
import org.elasticsearch.gradle.VersionProperties
import org.elasticsearch.gradle.info.BuildParams
import org.elasticsearch.gradle.testclusters.RestTestRunnerTask
import org.elasticsearch.gradle.testclusters.StandaloneRestIntegTestTask
apply plugin: 'elasticsearch.testclusters'
apply plugin: 'elasticsearch.standalone-test'
@ -52,7 +52,7 @@ for (Version bwcVersion : BuildParams.bwcVersions.wireCompatible) {
}
}
tasks.register("${baseName}#mixedClusterTest", RestTestRunnerTask) {
tasks.register("${baseName}#mixedClusterTest", StandaloneRestIntegTestTask) {
useCluster testClusters."${baseName}"
mustRunAfter(precommit)
doFirst {

View File

@ -29,9 +29,7 @@ dependencies {
task 'remote-cluster'(type: RestIntegTestTask) {
mustRunAfter(precommit)
runner {
systemProperty 'tests.rest.suite', 'remote_cluster'
}
systemProperty 'tests.rest.suite', 'remote_cluster'
}
testClusters.'remote-cluster' {
@ -40,11 +38,9 @@ testClusters.'remote-cluster' {
}
task mixedClusterTest(type: RestIntegTestTask) {
runner {
useCluster testClusters.'remote-cluster'
dependsOn 'remote-cluster'
systemProperty 'tests.rest.suite', 'multi_cluster'
}
}
testClusters.mixedClusterTest {

View File

@ -19,7 +19,7 @@
import org.elasticsearch.gradle.Version
import org.elasticsearch.gradle.info.BuildParams
import org.elasticsearch.gradle.testclusters.RestTestRunnerTask
import org.elasticsearch.gradle.testclusters.StandaloneRestIntegTestTask
apply plugin: 'elasticsearch.testclusters'
apply plugin: 'elasticsearch.standalone-test'
@ -47,7 +47,7 @@ for (Version bwcVersion : BuildParams.bwcVersions.indexCompatible) {
"${newClusterName}" clusterSettings(project.version)
}
tasks.register("${baseName}#Step1OldClusterTest", RestTestRunnerTask) {
tasks.register("${baseName}#Step1OldClusterTest", StandaloneRestIntegTestTask) {
useCluster testClusters."${oldClusterName}"
mustRunAfter(precommit)
doFirst {
@ -56,19 +56,19 @@ for (Version bwcVersion : BuildParams.bwcVersions.indexCompatible) {
systemProperty 'tests.rest.suite', 'step1'
}
tasks.register("${baseName}#Step2NewClusterTest", RestTestRunnerTask) {
tasks.register("${baseName}#Step2NewClusterTest", StandaloneRestIntegTestTask) {
useCluster testClusters."${newClusterName}"
dependsOn "${baseName}#Step1OldClusterTest"
systemProperty 'tests.rest.suite', 'step2'
}
tasks.register("${baseName}#Step3OldClusterTest", RestTestRunnerTask) {
tasks.register("${baseName}#Step3OldClusterTest", StandaloneRestIntegTestTask) {
useCluster testClusters."${oldClusterName}"
dependsOn "${baseName}#Step2NewClusterTest"
systemProperty 'tests.rest.suite', 'step3'
}
tasks.register("${baseName}#Step4NewClusterTest", RestTestRunnerTask) {
tasks.register("${baseName}#Step4NewClusterTest", StandaloneRestIntegTestTask) {
useCluster testClusters."${newClusterName}"
dependsOn "${baseName}#Step3OldClusterTest"
systemProperty 'tests.rest.suite', 'step4'

View File

@ -19,7 +19,7 @@
import org.elasticsearch.gradle.Version
import org.elasticsearch.gradle.info.BuildParams
import org.elasticsearch.gradle.testclusters.RestTestRunnerTask
import org.elasticsearch.gradle.testclusters.StandaloneRestIntegTestTask
apply plugin: 'elasticsearch.testclusters'
apply plugin: 'elasticsearch.standalone-test'
@ -53,7 +53,7 @@ for (Version bwcVersion : BuildParams.bwcVersions.wireCompatible) {
}
}
tasks.register("${baseName}#oldClusterTest", RestTestRunnerTask) {
tasks.register("${baseName}#oldClusterTest", StandaloneRestIntegTestTask) {
dependsOn processTestResources
useCluster testClusters."${baseName}"
mustRunAfter(precommit)
@ -66,7 +66,7 @@ for (Version bwcVersion : BuildParams.bwcVersions.wireCompatible) {
nonInputProperties.systemProperty('tests.clustername', "${-> testClusters."${baseName}".getName()}")
}
tasks.register("${baseName}#oneThirdUpgradedTest", RestTestRunnerTask) {
tasks.register("${baseName}#oneThirdUpgradedTest", StandaloneRestIntegTestTask) {
dependsOn "${baseName}#oldClusterTest"
useCluster testClusters."${baseName}"
doFirst {
@ -79,7 +79,7 @@ for (Version bwcVersion : BuildParams.bwcVersions.wireCompatible) {
nonInputProperties.systemProperty('tests.clustername', "${-> testClusters."${baseName}".getName()}")
}
tasks.register("${baseName}#twoThirdsUpgradedTest", RestTestRunnerTask) {
tasks.register("${baseName}#twoThirdsUpgradedTest", StandaloneRestIntegTestTask) {
dependsOn "${baseName}#oneThirdUpgradedTest"
useCluster testClusters."${baseName}"
doFirst {
@ -92,7 +92,7 @@ for (Version bwcVersion : BuildParams.bwcVersions.wireCompatible) {
nonInputProperties.systemProperty('tests.clustername', "${-> testClusters."${baseName}".getName()}")
}
tasks.register("${baseName}#upgradedClusterTest", RestTestRunnerTask) {
tasks.register("${baseName}#upgradedClusterTest", StandaloneRestIntegTestTask) {
dependsOn "${baseName}#twoThirdsUpgradedTest"
doFirst {
testClusters."${baseName}".nextNodeToNextVersion()

View File

@ -27,7 +27,7 @@ dependencies {
testImplementation project(path: ':plugins:transport-nio') // for http
}
integTest.runner {
integTest {
/*
* We have to disable setting the number of available processors as tests in the same JVM randomize processors and will step on each
* other if we allow them to set the number of available processors as it's set-once in Netty.

View File

@ -34,7 +34,7 @@ testClusters.integTest {
setting 'path.repo', repo.absolutePath
}
integTest.runner {
integTest {
doFirst {
project.delete(repo)
repo.mkdirs()

View File

@ -20,8 +20,7 @@
import org.elasticsearch.gradle.Version
import org.elasticsearch.gradle.info.BuildParams
import org.elasticsearch.gradle.testclusters.RestTestRunnerTask
import org.elasticsearch.gradle.testclusters.TestDistribution
import org.elasticsearch.gradle.testclusters.StandaloneRestIntegTestTask
apply plugin: 'elasticsearch.testclusters'
apply plugin: 'elasticsearch.standalone-test'
@ -45,14 +44,14 @@ for (Version bwcVersion : BuildParams.bwcVersions.indexCompatible) {
}
}
tasks.register("${baseName}#Step1OldClusterTest", RestTestRunnerTask) {
tasks.register("${baseName}#Step1OldClusterTest", StandaloneRestIntegTestTask) {
useCluster testClusters."${baseName}"
mustRunAfter(precommit)
systemProperty 'tests.test_step', 'step1'
systemProperty 'tests.is_old_cluster', 'true'
}
tasks.register("${baseName}#Step2OldClusterTest", RestTestRunnerTask) {
tasks.register("${baseName}#Step2OldClusterTest", StandaloneRestIntegTestTask) {
useCluster testClusters."${baseName}"
dependsOn "${baseName}#Step1OldClusterTest"
doFirst {
@ -62,7 +61,7 @@ for (Version bwcVersion : BuildParams.bwcVersions.indexCompatible) {
systemProperty 'tests.is_old_cluster', 'true'
}
tasks.register("${baseName}#Step3NewClusterTest", RestTestRunnerTask) {
tasks.register("${baseName}#Step3NewClusterTest", StandaloneRestIntegTestTask) {
useCluster testClusters."${baseName}"
dependsOn "${baseName}#Step2OldClusterTest"
doFirst {
@ -72,7 +71,7 @@ for (Version bwcVersion : BuildParams.bwcVersions.indexCompatible) {
systemProperty 'tests.is_old_cluster', 'false'
}
tasks.register("${baseName}#Step4NewClusterTest", RestTestRunnerTask) {
tasks.register("${baseName}#Step4NewClusterTest", StandaloneRestIntegTestTask) {
useCluster testClusters."${baseName}"
dependsOn "${baseName}#Step3NewClusterTest"
doFirst {

View File

@ -27,7 +27,7 @@ testClusters.integTest {
nameCustomization = { null }
}
integTest.runner {
integTest {
nonInputProperties.systemProperty 'tests.logfile',
"${-> testClusters.integTest.singleNode().getServerLog()}"
}

View File

@ -20,7 +20,7 @@
import org.elasticsearch.gradle.Version
import org.elasticsearch.gradle.VersionProperties
import org.elasticsearch.gradle.info.BuildParams
import org.elasticsearch.gradle.testclusters.RestTestRunnerTask
import org.elasticsearch.gradle.testclusters.StandaloneRestIntegTestTask
apply plugin: 'elasticsearch.testclusters'
apply plugin: 'elasticsearch.standalone-test'
@ -36,7 +36,7 @@ for (Version bwcVersion : BuildParams.bwcVersions.indexCompatible) {
}
}
tasks.register("${baseName}#integTest", RestTestRunnerTask) {
tasks.register("${baseName}#integTest", StandaloneRestIntegTestTask) {
useCluster testClusters."${baseName}"
nonInputProperties.systemProperty('tests.rest.cluster', "${-> testClusters."${baseName}".allHttpSocketURI.join(",")}")
nonInputProperties.systemProperty('tests.clustername', "${-> testClusters."${baseName}".getName()}")

View File

@ -117,7 +117,7 @@ tasks.register("copyKeyCerts", Copy) {
sourceSets.test.resources.srcDir(keystoreDir)
processTestResources.dependsOn("copyKeyCerts")
integTest.runner {
integTest {
/*
* We have to disable setting the number of available processors as tests in the same JVM randomize processors and will step on each
* other if we allow them to set the number of available processors as it's set-once in Netty.

View File

@ -12,9 +12,7 @@ dependencies {
task "leader-cluster"(type: RestIntegTestTask) {
mustRunAfter(precommit)
runner {
systemProperty 'tests.target_cluster', 'leader'
}
systemProperty 'tests.target_cluster', 'leader'
}
testClusters."leader-cluster" {
testDistribution = 'DEFAULT'
@ -61,7 +59,6 @@ tasks.register("writeJavaPolicy") {
task "follow-cluster"(type: RestIntegTestTask) {
dependsOn 'writeJavaPolicy', "leader-cluster"
runner {
useCluster testClusters."leader-cluster"
if (BuildParams.inFipsJvm){
systemProperty 'java.security.policy', "=file://${policyFile}"
@ -71,7 +68,6 @@ task "follow-cluster"(type: RestIntegTestTask) {
systemProperty 'tests.target_cluster', 'follow'
nonInputProperties.systemProperty 'tests.leader_host', "${-> testClusters."leader-cluster".getAllHttpSocketURI().get(0)}"
nonInputProperties.systemProperty 'log', "${-> testClusters."follow-cluster".getFirstNode().getServerLog()}"
}
}
testClusters."follow-cluster" {

View File

@ -11,9 +11,7 @@ dependencies {
task "leader-cluster"(type: RestIntegTestTask) {
mustRunAfter(precommit)
runner {
systemProperty 'tests.target_cluster', 'leader'
}
systemProperty 'tests.target_cluster', 'leader'
}
testClusters."leader-cluster" {
@ -24,12 +22,10 @@ testClusters."leader-cluster" {
task "middle-cluster"(type: RestIntegTestTask) {
dependsOn "leader-cluster"
runner {
useCluster testClusters."leader-cluster"
systemProperty 'tests.target_cluster', 'middle'
nonInputProperties.systemProperty 'tests.leader_host',
"${-> testClusters."leader-cluster".getAllHttpSocketURI().get(0)}"
}
useCluster testClusters."leader-cluster"
systemProperty 'tests.target_cluster', 'middle'
nonInputProperties.systemProperty 'tests.leader_host',
"${-> testClusters."leader-cluster".getAllHttpSocketURI().get(0)}"
}
testClusters."middle-cluster" {
testDistribution = 'DEFAULT'
@ -40,7 +36,6 @@ testClusters."middle-cluster" {
task 'follow-cluster'(type: RestIntegTestTask) {
dependsOn "leader-cluster", "middle-cluster"
runner {
useCluster testClusters."leader-cluster"
useCluster testClusters."middle-cluster"
systemProperty 'tests.target_cluster', 'follow'
@ -48,7 +43,6 @@ task 'follow-cluster'(type: RestIntegTestTask) {
"${-> testClusters."leader-cluster".getAllHttpSocketURI().get(0)}"
nonInputProperties.systemProperty 'tests.middle_host',
"${-> testClusters."middle-cluster".getAllHttpSocketURI().get(0)}"
}
}
testClusters."follow-cluster" {

View File

@ -11,9 +11,7 @@ dependencies {
task 'leader-cluster'(type: RestIntegTestTask) {
mustRunAfter(precommit)
runner {
systemProperty 'tests.target_cluster', 'leader'
}
systemProperty 'tests.target_cluster', 'leader'
}
testClusters.'leader-cluster' {
testDistribution = 'DEFAULT'
@ -21,12 +19,10 @@ testClusters.'leader-cluster' {
task 'follow-cluster'(type: RestIntegTestTask) {
dependsOn 'leader-cluster'
runner {
useCluster testClusters.'leader-cluster'
systemProperty 'tests.target_cluster', 'follow'
nonInputProperties.systemProperty 'tests.leader_host',
{ "${testClusters.'follow-cluster'.getAllHttpSocketURI().get(0)}" }
}
useCluster testClusters.'leader-cluster'
systemProperty 'tests.target_cluster', 'follow'
nonInputProperties.systemProperty 'tests.leader_host',
{ "${testClusters.'follow-cluster'.getAllHttpSocketURI().get(0)}" }
}
testClusters.'follow-cluster' {
testDistribution = 'DEFAULT'

View File

@ -1,5 +1,5 @@
import org.elasticsearch.gradle.test.RestIntegTestTask
import org.elasticsearch.gradle.testclusters.RestTestRunnerTask
import org.elasticsearch.gradle.testclusters.StandaloneRestIntegTestTask
apply plugin: 'elasticsearch.testclusters'
apply plugin: 'elasticsearch.standalone-test'
@ -10,9 +10,7 @@ dependencies {
task 'leader-cluster'(type: RestIntegTestTask) {
mustRunAfter(precommit)
runner {
systemProperty 'tests.target_cluster', 'leader'
}
systemProperty 'tests.target_cluster', 'leader'
}
testClusters.'leader-cluster' {
testDistribution = 'DEFAULT'
@ -21,12 +19,10 @@ testClusters.'leader-cluster' {
task 'follow-cluster'(type: RestIntegTestTask) {
dependsOn 'leader-cluster'
runner {
useCluster testClusters.'leader-cluster'
systemProperty 'tests.target_cluster', 'follow'
nonInputProperties.systemProperty 'tests.leader_host',
"${-> testClusters.'leader-cluster'.getAllHttpSocketURI().get(0)}"
}
}
testClusters.'follow-cluster' {
testDistribution = 'DEFAULT'
@ -37,7 +33,7 @@ testClusters.'follow-cluster' {
nameCustomization = { 'follow' }
}
task followClusterRestartTest(type: RestTestRunnerTask) {
task followClusterRestartTest(type: StandaloneRestIntegTestTask) {
dependsOn tasks.'follow-cluster'
useCluster testClusters.'leader-cluster'
useCluster testClusters.'follow-cluster'

View File

@ -19,9 +19,7 @@ tasks.register("resolve") {
}
task 'leader-cluster'(type: RestIntegTestTask) {
mustRunAfter(precommit)
runner {
systemProperty 'tests.target_cluster', 'leader'
}
systemProperty 'tests.target_cluster', 'leader'
}
testClusters.'leader-cluster' {
@ -35,11 +33,9 @@ testClusters.'leader-cluster' {
task 'follow-cluster'(type: RestIntegTestTask) {
dependsOn 'leader-cluster'
runner {
useCluster testClusters.'leader-cluster'
systemProperty 'tests.target_cluster', 'follow'
nonInputProperties.systemProperty 'tests.leader_host', "${-> testClusters.'leader-cluster'.getAllHttpSocketURI().get(0)}"
}
useCluster testClusters.'leader-cluster'
systemProperty 'tests.target_cluster', 'follow'
nonInputProperties.systemProperty 'tests.leader_host', "${-> testClusters.'leader-cluster'.getAllHttpSocketURI().get(0)}"
}
testClusters.'follow-cluster' {

View File

@ -10,7 +10,7 @@ dependencies {
File repoDir = file("$buildDir/testclusters/repo")
integTest.runner {
integTest {
/* To support taking index snapshots, we have to set path.repo setting */
systemProperty 'tests.path.repo', repoDir
}

View File

@ -13,11 +13,9 @@ File repoDir = file("$buildDir/testclusters/repo")
task 'leader-cluster'(type: RestIntegTestTask) {
mustRunAfter(precommit)
runner {
systemProperty 'tests.target_cluster', 'leader'
/* To support taking index snapshots, we have to set path.repo setting */
systemProperty 'tests.path.repo', repoDir.absolutePath
}
}
testClusters.'leader-cluster' {
@ -33,7 +31,6 @@ testClusters.'leader-cluster' {
task 'follow-cluster'(type: RestIntegTestTask) {
dependsOn 'leader-cluster'
runner {
useCluster testClusters.'leader-cluster'
systemProperty 'tests.target_cluster', 'follow'
nonInputProperties.systemProperty 'tests.leader_host',
@ -42,7 +39,6 @@ task 'follow-cluster'(type: RestIntegTestTask) {
"${-> testClusters.'leader-cluster'.getAllTransportPortURI().get(0)}"
/* To support taking index snapshots, we have to set path.repo setting */
systemProperty 'tests.path.repo', repoDir.absolutePath
}
}
testClusters.'follow-cluster' {

View File

@ -11,7 +11,7 @@ dependencies {
File repoDir = file("$buildDir/testclusters/repo")
integTest.runner {
integTest {
/* To support taking index snapshots, we have to set path.repo setting */
systemProperty 'tests.path.repo', repoDir
}

View File

@ -21,10 +21,8 @@ def clusterCredentials = [username: System.getProperty('tests.rest.cluster.usern
task restTest(type: RestIntegTestTask) {
mustRunAfter(precommit)
runner {
systemProperty 'tests.rest.cluster.username', clusterCredentials.username
systemProperty 'tests.rest.cluster.password', clusterCredentials.password
}
systemProperty 'tests.rest.cluster.username', clusterCredentials.username
systemProperty 'tests.rest.cluster.password', clusterCredentials.password
}
testClusters.restTest {

View File

@ -11,10 +11,8 @@ def clusterCredentials = [username: System.getProperty('tests.rest.cluster.usern
password: System.getProperty('tests.rest.cluster.password', 'x-pack-test-password')]
integTest {
runner {
systemProperty 'tests.rest.cluster.username', clusterCredentials.username
systemProperty 'tests.rest.cluster.password', clusterCredentials.password
}
systemProperty 'tests.rest.cluster.username', clusterCredentials.username
systemProperty 'tests.rest.cluster.password', clusterCredentials.password
}
testClusters.integTest {

View File

@ -20,7 +20,7 @@ restResources {
}
}
integTest.runner {
integTest {
systemProperty 'tests.rest.blacklist', [
// Remove this test because it doesn't call an ML endpoint and we don't want
// to grant extra permissions to the users used in this test suite

View File

@ -28,13 +28,11 @@ tasks.named("processTestResources").configure { dependsOn("copyKeyCerts") }
integTest {
dependsOn "copyKeyCerts"
runner {
/*
* We have to disable setting the number of available processors as tests in the same JVM randomize processors and will step on each
* other if we allow them to set the number of available processors as it's set-once in Netty.
*/
systemProperty 'es.set.netty.runtime.available.processors', 'false'
}
/*
* We have to disable setting the number of available processors as tests in the same JVM randomize processors and will step on each
* other if we allow them to set the number of available processors as it's set-once in Netty.
*/
systemProperty 'es.set.netty.runtime.available.processors', 'false'
}
testClusters.integTest {

View File

@ -44,10 +44,8 @@ if (useFixture) {
integTest {
dependsOn repositoryPlugin.bundlePlugin
runner {
systemProperty 'test.azure.container', azureContainer
nonInputProperties.systemProperty 'test.azure.base_path', azureBasePath + "_searchable_snapshots_tests_" + BuildParams.testSeed
}
systemProperty 'test.azure.container', azureContainer
nonInputProperties.systemProperty 'test.azure.base_path', azureBasePath + "_searchable_snapshots_tests_" + BuildParams.testSeed
}
testClusters.integTest {

View File

@ -88,10 +88,8 @@ if (useFixture) {
integTest {
dependsOn repositoryPlugin.bundlePlugin
runner {
systemProperty 'test.gcs.bucket', gcsBucket
nonInputProperties.systemProperty 'test.gcs.base_path', gcsBasePath + "_searchable_snapshots_tests" + BuildParams.testSeed
}
systemProperty 'test.gcs.bucket', gcsBucket
nonInputProperties.systemProperty 'test.gcs.base_path', gcsBasePath + "_searchable_snapshots_tests" + BuildParams.testSeed
}
testClusters.integTest {

View File

@ -30,10 +30,8 @@ def fixtureAddress = {
integTest {
dependsOn repositoryPlugin.bundlePlugin
runner {
systemProperty 'test.minio.bucket', 'bucket'
systemProperty 'test.minio.base_path', 'searchable_snapshots_tests'
}
systemProperty 'test.minio.bucket', 'bucket'
systemProperty 'test.minio.base_path', 'searchable_snapshots_tests'
}
testClusters.integTest {

View File

@ -11,7 +11,7 @@ dependencies {
final File repoDir = file("$buildDir/testclusters/repo")
integTest.runner {
integTest {
systemProperty 'tests.path.repo', repoDir
}

View File

@ -44,10 +44,8 @@ if (useFixture) {
integTest {
dependsOn repositoryPlugin.bundlePlugin
runner {
systemProperty 'test.s3.bucket', s3Bucket
nonInputProperties.systemProperty 'test.s3.base_path', s3BasePath ? s3BasePath + "_searchable_snapshots_tests" + BuildParams.testSeed : 'base_path'
}
systemProperty 'test.s3.bucket', s3Bucket
nonInputProperties.systemProperty 'test.s3.base_path', s3BasePath ? s3BasePath + "_searchable_snapshots_tests" + BuildParams.testSeed : 'base_path'
}
testClusters.integTest {

View File

@ -1,4 +1,4 @@
import org.elasticsearch.gradle.testclusters.RestTestRunnerTask
import org.elasticsearch.gradle.testclusters.StandaloneRestIntegTestTask
apply plugin: 'elasticsearch.testclusters'
apply plugin: 'elasticsearch.standalone-rest-test'
@ -12,9 +12,7 @@ dependencies {
integTest {
description = "Run tests against a cluster that doesn't have security"
runner {
systemProperty 'tests.has_security', 'false'
}
systemProperty 'tests.has_security', 'false'
}
testClusters.integTest {
@ -25,7 +23,7 @@ testClusters.integTest {
setting 'xpack.security.enabled', 'false'
}
task integTestSecurity(type: RestTestRunnerTask) {
task integTestSecurity(type: StandaloneRestIntegTestTask) {
description = "Run tests against a cluster that has security"
useCluster testClusters.integTest
dependsOn integTest

View File

@ -64,10 +64,8 @@ subprojects {
}
integTest {
runner {
classpath += configurations.jdbcDriver
systemProperty 'jdbc.driver.version', VersionProperties.elasticsearch
}
}
// Configure compatibility testing tasks
@ -92,10 +90,8 @@ subprojects {
}
tasks.create(bwcTaskName(bwcVersion), RestIntegTestTask) {
runner {
classpath += driverConfiguration
systemProperty 'jdbc.driver.version', bwcVersion.toString()
}
}
}
}

View File

@ -1,4 +1,4 @@
import org.elasticsearch.gradle.testclusters.RestTestRunnerTask
import org.elasticsearch.gradle.test.RestIntegTestTask
dependencies {
testImplementation project(':x-pack:plugin:core')
@ -47,7 +47,7 @@ subprojects {
}
tasks.withType(RestTestRunnerTask).configureEach {
tasks.withType(RestIntegTestTask).configureEach {
dependsOn copyTestClasses
testClassesDirs += project.files(testArtifactsDir)
classpath += configurations.testArtifacts

View File

@ -1,6 +1,6 @@
import org.elasticsearch.gradle.testclusters.RestTestRunnerTask
import org.elasticsearch.gradle.test.RestIntegTestTask
tasks.withType(RestTestRunnerTask).configureEach {
tasks.withType(RestIntegTestTask).configureEach {
systemProperty 'tests.ssl.enabled', 'false'
}

View File

@ -47,7 +47,7 @@ subprojects {
into testArtifactsDir
}
integTest.runner {
integTest {
dependsOn copyTestClasses
testClassesDirs += project.files(testArtifactsDir)
classpath += configurations.testArtifacts

View File

@ -2,7 +2,7 @@ import org.elasticsearch.gradle.info.BuildParams
apply plugin: 'elasticsearch.test-with-ssl'
integTest.runner {
integTest {
onlyIf {
// Do not attempt to form a cluster in a FIPS JVM, as doing so with a JKS keystore will fail.
// TODO Revisit this when SQL CLI client can handle key/certificate instead of only Keystores.

View File

@ -1,4 +1,4 @@
integTest.runner {
integTest {
systemProperty 'tests.ssl.enabled', 'false'
}

View File

@ -21,10 +21,8 @@ def clusterCredentials = [username: System.getProperty('tests.rest.cluster.usern
task restTest(type: RestIntegTestTask) {
mustRunAfter(precommit)
runner {
systemProperty 'tests.rest.cluster.username', clusterCredentials.username
systemProperty 'tests.rest.cluster.password', clusterCredentials.password
}
systemProperty 'tests.rest.cluster.username', clusterCredentials.username
systemProperty 'tests.rest.cluster.password', clusterCredentials.password
}
testClusters.restTest {

View File

@ -14,7 +14,6 @@ restResources {
}
integTest {
runner {
systemProperty 'tests.rest.blacklist',
[
'index/10_with_id/Index with ID',
@ -23,7 +22,6 @@ integTest {
systemProperty 'tests.rest.cluster.username', System.getProperty('tests.rest.cluster.username', 'test_user')
systemProperty 'tests.rest.cluster.password', System.getProperty('tests.rest.cluster.password', 'x-pack-test-password')
}
}
testClusters.integTest {

View File

@ -1,6 +1,6 @@
import org.elasticsearch.gradle.Version
import org.elasticsearch.gradle.info.BuildParams
import org.elasticsearch.gradle.testclusters.RestTestRunnerTask
import org.elasticsearch.gradle.testclusters.StandaloneRestIntegTestTask
apply plugin: 'elasticsearch.testclusters'
apply plugin: 'elasticsearch.standalone-test'
@ -65,7 +65,7 @@ for (Version bwcVersion : BuildParams.bwcVersions.indexCompatible) {
}
}
tasks.register("${baseName}#oldClusterTest", RestTestRunnerTask) {
tasks.register("${baseName}#oldClusterTest", StandaloneRestIntegTestTask) {
mustRunAfter(precommit)
useCluster testClusters."${baseName}"
dependsOn copyTestNodeKeyMaterial
@ -79,7 +79,7 @@ for (Version bwcVersion : BuildParams.bwcVersions.indexCompatible) {
}
tasks.register("${baseName}#upgradedClusterTest", RestTestRunnerTask) {
tasks.register("${baseName}#upgradedClusterTest", StandaloneRestIntegTestTask) {
mustRunAfter(precommit)
useCluster testClusters."${baseName}"
dependsOn "${baseName}#oldClusterTest"

View File

@ -48,7 +48,7 @@ tasks.register("copyKeytabToGeneratedResources", Copy) {
}
String realm = "BUILD.ELASTIC.CO"
integTest.runner {
integTest {
Path peppaKeytab = Paths.get("${project.buildDir}", "generated-resources", "keytabs", "peppa.keytab")
nonInputProperties.systemProperty 'test.userkt', "peppa@${realm}"
nonInputProperties.systemProperty 'test.userkt.keytab', "${peppaKeytab}"

View File

@ -16,9 +16,7 @@ restResources {
task 'remote-cluster'(type: RestIntegTestTask) {
mustRunAfter(precommit)
runner {
systemProperty 'tests.rest.suite', 'remote_cluster'
}
systemProperty 'tests.rest.suite', 'remote_cluster'
}
testClusters.'remote-cluster' {
@ -35,10 +33,8 @@ testClusters.'remote-cluster' {
task 'mixed-cluster'(type: RestIntegTestTask) {
dependsOn 'remote-cluster'
runner {
useCluster testClusters.'remote-cluster'
systemProperty 'tests.rest.suite', 'multi_cluster'
}
useCluster testClusters.'remote-cluster'
systemProperty 'tests.rest.suite', 'multi_cluster'
}
testClusters.'mixed-cluster' {

View File

@ -17,9 +17,7 @@ restResources {
task 'remote-cluster'(type: RestIntegTestTask) {
mustRunAfter(precommit)
runner {
systemProperty 'tests.rest.suite', 'remote_cluster'
}
systemProperty 'tests.rest.suite', 'remote_cluster'
}
testClusters.'remote-cluster' {
@ -35,10 +33,8 @@ testClusters.'remote-cluster' {
task 'mixed-cluster'(type: RestIntegTestTask) {
dependsOn 'remote-cluster'
runner {
useCluster testClusters.'remote-cluster'
systemProperty 'tests.rest.suite', 'multi_cluster'
}
useCluster testClusters.'remote-cluster'
systemProperty 'tests.rest.suite', 'multi_cluster'
}
testClusters.'mixed-cluster' {

View File

@ -24,7 +24,7 @@ tasks.register("setupPorts") {
}
}
integTest.runner {
integTest {
dependsOn "setupPorts"
}

View File

@ -1,6 +1,6 @@
import org.elasticsearch.gradle.Version
import org.elasticsearch.gradle.info.BuildParams
import org.elasticsearch.gradle.testclusters.RestTestRunnerTask
import org.elasticsearch.gradle.testclusters.StandaloneRestIntegTestTask
apply plugin: 'elasticsearch.testclusters'
apply plugin: 'elasticsearch.standalone-test'
@ -27,7 +27,7 @@ for (Version bwcVersion : BuildParams.bwcVersions.wireCompatible) {
}
}
tasks.register("${baseName}#oldClusterTest", RestTestRunnerTask) {
tasks.register("${baseName}#oldClusterTest", StandaloneRestIntegTestTask) {
useCluster testClusters."${baseName}"
mustRunAfter(precommit)
systemProperty 'tests.rest.suite', 'old_cluster'
@ -37,7 +37,7 @@ for (Version bwcVersion : BuildParams.bwcVersions.wireCompatible) {
}
String oldVersion = bwcVersion.toString().replace('-SNAPSHOT', '')
tasks.register("${baseName}#oneThirdUpgradedTest", RestTestRunnerTask) {
tasks.register("${baseName}#oneThirdUpgradedTest", StandaloneRestIntegTestTask) {
dependsOn "${baseName}#oldClusterTest"
useCluster testClusters."${baseName}"
doFirst {
@ -50,7 +50,7 @@ for (Version bwcVersion : BuildParams.bwcVersions.wireCompatible) {
systemProperty 'tests.upgrade_from_version', oldVersion
}
tasks.register("${baseName}#twoThirdsUpgradedTest", RestTestRunnerTask) {
tasks.register("${baseName}#twoThirdsUpgradedTest", StandaloneRestIntegTestTask) {
dependsOn "${baseName}#oneThirdUpgradedTest"
useCluster testClusters."${baseName}"
doFirst {
@ -63,7 +63,7 @@ for (Version bwcVersion : BuildParams.bwcVersions.wireCompatible) {
systemProperty 'tests.upgrade_from_version', oldVersion
}
tasks.register("${baseName}#upgradedClusterTest", RestTestRunnerTask) {
tasks.register("${baseName}#upgradedClusterTest", StandaloneRestIntegTestTask) {
dependsOn "${baseName}#twoThirdsUpgradedTest"
useCluster testClusters."${baseName}"
doFirst {

View File

@ -1,6 +1,6 @@
import org.elasticsearch.gradle.Version
import org.elasticsearch.gradle.info.BuildParams
import org.elasticsearch.gradle.testclusters.RestTestRunnerTask
import org.elasticsearch.gradle.testclusters.StandaloneRestIntegTestTask
apply plugin: 'elasticsearch.testclusters'
apply plugin: 'elasticsearch.standalone-test'
@ -32,7 +32,7 @@ for (Version bwcVersion : BuildParams.bwcVersions.wireCompatible) {
setting 'xpack.license.self_generated.type', 'trial'
}
tasks.withType(RestTestRunnerTask).matching { it.name.startsWith("${baseName}#") }.all {
tasks.withType(StandaloneRestIntegTestTask).matching { it.name.startsWith("${baseName}#") }.all {
useCluster testClusters."${baseName}-leader"
useCluster testClusters."${baseName}-follower"
systemProperty 'tests.upgrade_from_version', bwcVersion.toString().replace('-SNAPSHOT', '')
@ -54,27 +54,27 @@ for (Version bwcVersion : BuildParams.bwcVersions.wireCompatible) {
for (kind in ["follower", "leader"]) {
// Attention!! Groovy trap: do not pass `kind` to a closure
tasks.register("${baseName}#${kind}#clusterTest", RestTestRunnerTask) {
tasks.register("${baseName}#${kind}#clusterTest", StandaloneRestIntegTestTask) {
systemProperty 'tests.rest.upgrade_state', 'none'
systemProperty 'tests.rest.cluster_name', kind
ext.kindExt = kind
}
tasks.register("${baseName}#${kind}#oneThirdUpgradedTest", RestTestRunnerTask) {
tasks.register("${baseName}#${kind}#oneThirdUpgradedTest", StandaloneRestIntegTestTask) {
systemProperty 'tests.rest.upgrade_state', 'one_third'
systemProperty 'tests.rest.cluster_name', kind
dependsOn "${baseName}#leader#clusterTest", "${baseName}#follower#clusterTest"
ext.kindExt = kind
}
tasks.register("${baseName}#${kind}#twoThirdsUpgradedTest", RestTestRunnerTask) {
tasks.register("${baseName}#${kind}#twoThirdsUpgradedTest", StandaloneRestIntegTestTask) {
systemProperty 'tests.rest.upgrade_state', 'two_third'
systemProperty 'tests.rest.cluster_name', kind
dependsOn "${baseName}#${kind}#oneThirdUpgradedTest"
ext.kindExt = kind
}
tasks.create("${baseName}#${kind}#upgradedClusterTest", RestTestRunnerTask) {
tasks.create("${baseName}#${kind}#upgradedClusterTest", StandaloneRestIntegTestTask) {
systemProperty 'tests.rest.upgrade_state', 'all'
systemProperty 'tests.rest.cluster_name', kind
dependsOn "${baseName}#${kind}#twoThirdsUpgradedTest"

View File

@ -1,6 +1,6 @@
import org.elasticsearch.gradle.Version
import org.elasticsearch.gradle.info.BuildParams
import org.elasticsearch.gradle.testclusters.RestTestRunnerTask
import org.elasticsearch.gradle.testclusters.StandaloneRestIntegTestTask
apply plugin: 'elasticsearch.testclusters'
apply plugin: 'elasticsearch.standalone-test'
@ -89,7 +89,7 @@ for (Version bwcVersion : BuildParams.bwcVersions.wireCompatible) {
}
String oldVersion = bwcVersion.toString().replace('-SNAPSHOT', '')
tasks.register("${baseName}#oldClusterTest", RestTestRunnerTask) {
tasks.register("${baseName}#oldClusterTest", StandaloneRestIntegTestTask) {
useCluster testClusters."${baseName}"
mustRunAfter(precommit)
dependsOn "copyTestNodeKeyMaterial"
@ -111,7 +111,7 @@ for (Version bwcVersion : BuildParams.bwcVersions.wireCompatible) {
}
}
tasks.register("${baseName}#oneThirdUpgradedTest", RestTestRunnerTask) {
tasks.register("${baseName}#oneThirdUpgradedTest", StandaloneRestIntegTestTask) {
dependsOn "${baseName}#oldClusterTest"
useCluster testClusters."${baseName}"
doFirst {
@ -142,7 +142,7 @@ for (Version bwcVersion : BuildParams.bwcVersions.wireCompatible) {
systemProperty 'tests.rest.blacklist', toBlackList.join(',')
}
tasks.register("${baseName}#twoThirdsUpgradedTest", RestTestRunnerTask) {
tasks.register("${baseName}#twoThirdsUpgradedTest", StandaloneRestIntegTestTask) {
dependsOn "${baseName}#oneThirdUpgradedTest"
useCluster testClusters."${baseName}"
doFirst {
@ -168,7 +168,7 @@ for (Version bwcVersion : BuildParams.bwcVersions.wireCompatible) {
systemProperty 'tests.upgrade_from_version', oldVersion
}
tasks.register("${baseName}#upgradedClusterTest", RestTestRunnerTask) {
tasks.register("${baseName}#upgradedClusterTest", StandaloneRestIntegTestTask) {
dependsOn "${baseName}#twoThirdsUpgradedTest"
useCluster testClusters."${baseName}"
doFirst {

View File

@ -38,8 +38,7 @@ tasks.register("setupPorts") {
}
}
integTest.runner.dependsOn "setupPorts"
integTest.dependsOn "setupPorts"
testClusters.integTest {
testDistribution = 'DEFAULT'

View File

@ -14,7 +14,7 @@ task copyXPackPluginProps(type: Copy) {
}
project.sourceSets.test.output.dir(outputDir, builtBy: copyXPackPluginProps)
integTest.runner {
integTest {
systemProperty 'tests.security.manager', 'false'
}

View File

@ -14,7 +14,7 @@ dependencies {
}
integTest.runner {
integTest {
dependsOn buildZip
systemProperty 'tests.security.manager', 'false'
}

View File

@ -22,7 +22,7 @@ testClusters.integTest {
}
}
integTest.runner {
integTest {
nonInputProperties.systemProperty 'tests.config.dir', "${-> testClusters.integTest.singleNode().getConfigDir()}"
}

View File

@ -8,7 +8,7 @@ dependencies {
testImplementation project(path: xpackModule('core'), configuration: 'testArtifacts')
}
integTest.runner {
integTest {
nonInputProperties.systemProperty 'tests.config.dir', "${-> testClusters.integTest.singleNode().getConfigDir()}"
systemProperty 'tests.security.manager', 'false'
}

View File

@ -39,7 +39,7 @@ def copyKeyCerts = tasks.register("copyKeyCerts", Copy) {
sourceSets.test.resources.srcDir(keystoreDir)
processTestResources.dependsOn(copyKeyCerts)
integTest.runner.dependsOn(copyKeyCerts)
integTest.dependsOn(copyKeyCerts)
def pluginsCount = 0
testClusters.integTest {

View File

@ -54,7 +54,7 @@ if (!jiraUrl && !jiraUser && !jiraPassword && !jiraProject) {
keystore 'xpack.notification.jira.account.test.secure_user', jiraUser
keystore 'xpack.notification.jira.account.test.secure_password', jiraPassword
}
integTest.runner.finalizedBy "cleanJira"
integTest.finalizedBy "cleanJira"
}
/** List all issues associated to a given Jira project **/