Converting randomized testing to create a separate unitTest task instead of replacing the builtin test task (#36311)

- Create a separate unitTest task instead of Gradle's built in 
- convert all configuration to use the new task 
- the  built in task is now disabled
This commit is contained in:
Alpar Torok 2018-12-19 08:25:20 +02:00 committed by GitHub
parent 8015560bd4
commit e9ef5bdce8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
67 changed files with 87 additions and 122 deletions

View file

@ -24,7 +24,7 @@ mainClassName = 'org.openjdk.jmh.Main'
assemble.enabled = false assemble.enabled = false
archivesBaseName = 'elasticsearch-benchmarks' archivesBaseName = 'elasticsearch-benchmarks'
test.enabled = false unitTest.enabled = false
dependencies { dependencies {
compile("org.elasticsearch:elasticsearch:${version}") { compile("org.elasticsearch:elasticsearch:${version}") {

View file

@ -179,9 +179,7 @@ if (project != rootProject) {
jarHell.enabled = false jarHell.enabled = false
thirdPartyAudit.enabled = false thirdPartyAudit.enabled = false
test { unitTest {
include "**/*Tests.class"
exclude "**/*IT.class"
// The test task is configured to runtimeJava version, but build-tools doesn't support all of them, so test // The test task is configured to runtimeJava version, but build-tools doesn't support all of them, so test
// with compiler instead on the ones that are too old. // with compiler instead on the ones that are too old.
if (project.runtimeJavaVersion <= JavaVersion.VERSION_1_10) { if (project.runtimeJavaVersion <= JavaVersion.VERSION_1_10) {

View file

@ -4,30 +4,14 @@ import com.carrotsearch.ant.tasks.junit4.JUnit4
import org.gradle.api.Plugin import org.gradle.api.Plugin
import org.gradle.api.Project import org.gradle.api.Project
import org.gradle.api.Task import org.gradle.api.Task
import org.gradle.api.UnknownTaskException
import org.gradle.api.plugins.JavaBasePlugin
import org.gradle.api.tasks.TaskContainer import org.gradle.api.tasks.TaskContainer
import org.gradle.api.tasks.TaskProvider
import org.gradle.api.tasks.testing.Test
class RandomizedTestingPlugin implements Plugin<Project> { class RandomizedTestingPlugin implements Plugin<Project> {
void apply(Project project) { void apply(Project project) {
setupSeed(project) setupSeed(project)
replaceTestTask(project.tasks) createUnitTestTask(project.tasks)
configureAnt(project.ant) configureAnt(project.ant)
configureSanityCheck(project)
}
private static void configureSanityCheck(Project project) {
// Check the task graph to confirm tasks were indeed replaced
// https://github.com/elastic/elasticsearch/issues/31324
project.rootProject.getGradle().getTaskGraph().whenReady {
Task test = project.getTasks().findByName("test")
if (test != null && (test instanceof RandomizedTestingTask) == false) {
throw new IllegalStateException("Test task was not replaced in project ${project.path}. Found ${test.getClass()}")
}
}
} }
/** /**
@ -57,35 +41,15 @@ class RandomizedTestingPlugin implements Plugin<Project> {
} }
} }
static void replaceTestTask(TaskContainer tasks) { static void createUnitTestTask(TaskContainer tasks) {
// Gradle 4.8 introduced lazy tasks, thus we deal both with the `test` task as well as it's provider // only create a unitTest task if the `test` task exists as some project don't make use of it.
// https://github.com/gradle/gradle/issues/5730#issuecomment-398822153 tasks.matching { it.name == "test" }.all {
// since we can't be sure if the task was ever realized, we remove both the provider and the task // We don't want to run any tests with the Gradle test runner since we add our own randomized runner
TaskProvider<Test> oldTestProvider it.enabled = false
try { RandomizedTestingTask unitTest = tasks.create('unitTest', RandomizedTestingTask)
oldTestProvider = tasks.named('test') unitTest.description = 'Runs unit tests with the randomized testing framework'
} catch (UnknownTaskException unused) { it.dependsOn unitTest
// no test task, ok, user will use testing task on their own
return
} }
Test oldTestTask = oldTestProvider.get()
// we still have to use replace here despite the remove above because the task container knows about the provider
// by the same name
RandomizedTestingTask newTestTask = tasks.replace('test', RandomizedTestingTask)
newTestTask.configure{
group = JavaBasePlugin.VERIFICATION_GROUP
description = 'Runs unit tests with the randomized testing framework'
dependsOn oldTestTask.dependsOn, 'testClasses'
classpath = oldTestTask.classpath
testClassesDirs = oldTestTask.project.sourceSets.test.output.classesDirs
}
// hack so check task depends on custom test
Task checkTask = tasks.getByName('check')
checkTask.dependsOn.remove(oldTestProvider)
checkTask.dependsOn.remove(oldTestTask)
checkTask.dependsOn.add(newTestTask)
} }
static void configureAnt(AntBuilder ant) { static void configureAnt(AntBuilder ant) {

View file

@ -40,6 +40,7 @@ import org.gradle.api.artifacts.ProjectDependency
import org.gradle.api.artifacts.ResolvedArtifact import org.gradle.api.artifacts.ResolvedArtifact
import org.gradle.api.artifacts.dsl.RepositoryHandler import org.gradle.api.artifacts.dsl.RepositoryHandler
import org.gradle.api.execution.TaskExecutionGraph import org.gradle.api.execution.TaskExecutionGraph
import org.gradle.api.plugins.JavaBasePlugin
import org.gradle.api.plugins.JavaPlugin import org.gradle.api.plugins.JavaPlugin
import org.gradle.api.publish.maven.MavenPublication import org.gradle.api.publish.maven.MavenPublication
import org.gradle.api.publish.maven.plugins.MavenPublishPlugin import org.gradle.api.publish.maven.plugins.MavenPublishPlugin
@ -888,15 +889,22 @@ class BuildPlugin implements Plugin<Project> {
parallelism System.getProperty('tests.jvms', project.rootProject.ext.defaultParallel) parallelism System.getProperty('tests.jvms', project.rootProject.ext.defaultParallel)
onNonEmptyWorkDirectory 'wipe' onNonEmptyWorkDirectory 'wipe'
leaveTemporary true leaveTemporary true
project.sourceSets.matching { it.name == "test" }.all { test ->
task.testClassesDirs = test.output.classesDirs
task.classpath = test.runtimeClasspath
}
group = JavaBasePlugin.VERIFICATION_GROUP
dependsOn 'testClasses'
// Make sure all test tasks are configured properly // Make sure all test tasks are configured properly
if (name != "test") { if (name != "test") {
project.tasks.matching { it.name == "test"}.all { testTask -> project.tasks.matching { it.name == "test"}.all { testTask ->
task.testClassesDirs = testTask.testClassesDirs
task.classpath = testTask.classpath
task.shouldRunAfter testTask task.shouldRunAfter testTask
} }
} }
if (name == "unitTest") {
include("**/*Tests.class")
}
// TODO: why are we not passing maxmemory to junit4? // TODO: why are we not passing maxmemory to junit4?
jvmArg '-Xmx' + System.getProperty('tests.heap.size', '512m') jvmArg '-Xmx' + System.getProperty('tests.heap.size', '512m')
@ -986,8 +994,6 @@ class BuildPlugin implements Plugin<Project> {
exclude '**/*$*.class' exclude '**/*$*.class'
dependsOn(project.tasks.testClasses)
project.plugins.withType(ShadowPlugin).whenPluginAdded { project.plugins.withType(ShadowPlugin).whenPluginAdded {
// Test against a shadow jar if we made one // Test against a shadow jar if we made one
classpath -= project.tasks.compileJava.outputs.files classpath -= project.tasks.compileJava.outputs.files

View file

@ -55,8 +55,6 @@ public class RestIntegTestTask extends DefaultTask {
super.dependsOn(runner) super.dependsOn(runner)
clusterInit = project.tasks.create(name: "${name}Cluster#init", dependsOn: project.testClasses) clusterInit = project.tasks.create(name: "${name}Cluster#init", dependsOn: project.testClasses)
runner.dependsOn(clusterInit) runner.dependsOn(clusterInit)
runner.classpath = project.sourceSets.test.runtimeClasspath
runner.testClassesDirs = project.sourceSets.test.output.classesDirs
clusterConfig = project.extensions.create("${name}Cluster", ClusterConfiguration.class, project) clusterConfig = project.extensions.create("${name}Cluster", ClusterConfiguration.class, project)
// override/add more for rest tests // override/add more for rest tests

View file

@ -27,7 +27,7 @@ forbiddenApisTest.enabled = false
// requires dependency on testing fw // requires dependency on testing fw
jarHell.enabled = false jarHell.enabled = false
// we don't have tests for now // we don't have tests for now
test.enabled = false unitTest.enabled = false
task hello { task hello {
doFirst { doFirst {

View file

@ -29,7 +29,7 @@ archivesBaseName = 'client-benchmarks'
mainClassName = 'org.elasticsearch.client.benchmark.BenchmarkMain' mainClassName = 'org.elasticsearch.client.benchmark.BenchmarkMain'
// never try to invoke tests on the benchmark project - there aren't any // never try to invoke tests on the benchmark project - there aren't any
test.enabled = false unitTest.enabled = false
dependencies { dependencies {
compile 'org.apache.commons:commons-math3:3.2' compile 'org.apache.commons:commons-math3:3.2'

View file

@ -36,5 +36,5 @@ dependenciesInfo.enabled = false
compileJava.options.compilerArgs << "-Xlint:-cast,-deprecation,-rawtypes,-try,-unchecked" compileJava.options.compilerArgs << "-Xlint:-cast,-deprecation,-rawtypes,-try,-unchecked"
// no unit tests // no unit tests
test.enabled = false unitTest.enabled = false
integTest.enabled = false integTest.enabled = false

View file

@ -55,4 +55,4 @@ namingConventions.enabled = false
//we aren't releasing this jar //we aren't releasing this jar
thirdPartyAudit.enabled = false thirdPartyAudit.enabled = false
test.enabled = false unitTest.enabled = false

View file

@ -39,7 +39,6 @@ bwcVersions.forPreviousUnreleased { VersionCollection.UnreleasedVersionInfo unre
apply plugin: 'distribution' apply plugin: 'distribution'
// Not published so no need to assemble // Not published so no need to assemble
assemble.enabled = false assemble.enabled = false
assemble.dependsOn.remove('buildBwcVersion')
File checkoutDir = file("${buildDir}/bwc/checkout-${bwcBranch}") File checkoutDir = file("${buildDir}/bwc/checkout-${bwcBranch}")

View file

@ -7,7 +7,7 @@ forbiddenApisMain {
replaceSignatureFiles 'jdk-signatures' replaceSignatureFiles 'jdk-signatures'
} }
test.enabled = false unitTest.enabled = false
namingConventions.enabled = false namingConventions.enabled = false
javadoc.enabled = false javadoc.enabled = false
loggerUsageCheck.enabled = false loggerUsageCheck.enabled = false

View file

@ -35,7 +35,7 @@ dependencyLicenses {
mapping from: /bc.*/, to: 'bouncycastle' mapping from: /bc.*/, to: 'bouncycastle'
} }
test { unitTest {
// TODO: find a way to add permissions for the tests in this module // TODO: find a way to add permissions for the tests in this module
systemProperty 'tests.security.manager', 'false' systemProperty 'tests.security.manager', 'false'
} }

View file

@ -26,7 +26,7 @@ dependencies {
compile "org.elasticsearch:elasticsearch-core:${version}" compile "org.elasticsearch:elasticsearch-core:${version}"
} }
test.enabled = false unitTest.enabled = false
// Since CLI does not depend on :server, it cannot run the jarHell task // Since CLI does not depend on :server, it cannot run the jarHell task
jarHell.enabled = false jarHell.enabled = false

View file

@ -17,7 +17,7 @@
* under the License. * under the License.
*/ */
test.enabled = false unitTest.enabled = false
// test depend on ES core... // test depend on ES core...
forbiddenApisMain.enabled = false forbiddenApisMain.enabled = false

View file

@ -37,7 +37,7 @@ dependencyLicenses {
mapping from: /asm-.*/, to: 'asm' mapping from: /asm-.*/, to: 'asm'
} }
test { unitTest {
jvmArg '-XX:-OmitStackTraceInFastThrow' jvmArg '-XX:-OmitStackTraceInFastThrow'
} }

View file

@ -37,4 +37,4 @@ dependencies {
} }
// no tests...yet? // no tests...yet?
test.enabled = false unitTest.enabled = false

View file

@ -45,7 +45,7 @@ run {
setting 'reindex.remote.whitelist', '127.0.0.1:*' setting 'reindex.remote.whitelist', '127.0.0.1:*'
} }
test { unitTest {
/* /*
* We have to disable setting the number of available processors as tests in the * 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 * same JVM randomize processors and will step on each other if we allow them to

View file

@ -47,7 +47,7 @@ dependencyLicenses {
mapping from: /netty-.*/, to: 'netty' mapping from: /netty-.*/, to: 'netty'
} }
test { unitTest {
/* /*
* We have to disable setting the number of available processors as tests in the same JVM randomize processors and will step on each * 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. * other if we allow them to set the number of available processors as it's set-once in Netty.

View file

@ -64,7 +64,7 @@ task writeTestJavaPolicy {
} }
} }
test { unitTest {
dependsOn writeTestJavaPolicy dependsOn writeTestJavaPolicy
// this is needed for insecure plugins, remove if possible! // this is needed for insecure plugins, remove if possible!
systemProperty 'tests.artifact', project.name systemProperty 'tests.artifact', project.name

View file

@ -31,7 +31,7 @@ check {
dependsOn 'qa:gce:check' dependsOn 'qa:gce:check'
} }
test { unitTest {
// this is needed for insecure plugins, remove if possible! // this is needed for insecure plugins, remove if possible!
systemProperty 'tests.artifact', project.name systemProperty 'tests.artifact', project.name
} }

View file

@ -32,4 +32,4 @@ integTestCluster {
} }
// this plugin has no unit tests, only rest tests // this plugin has no unit tests, only rest tests
tasks.test.enabled = false tasks.unitTest.enabled = false

View file

@ -35,4 +35,4 @@ if (System.getProperty('tests.distribution') == null) {
integTestCluster.distribution = 'oss-zip' integTestCluster.distribution = 'oss-zip'
} }
test.enabled = false unitTest.enabled = false

View file

@ -27,7 +27,7 @@ esplugin {
} }
// No unit tests in this example // No unit tests in this example
test.enabled = false unitTest.enabled = false
task exampleFixture(type: org.elasticsearch.gradle.test.AntFixture) { task exampleFixture(type: org.elasticsearch.gradle.test.AntFixture) {
dependsOn testClasses dependsOn testClasses

View file

@ -26,5 +26,5 @@ esplugin {
noticeFile rootProject.file('NOTICE.txt') noticeFile rootProject.file('NOTICE.txt')
} }
test.enabled = false unitTest.enabled = false

View file

@ -76,7 +76,7 @@ task testRepositoryCreds(type: RandomizedTestingTask) {
} }
project.check.dependsOn(testRepositoryCreds) project.check.dependsOn(testRepositoryCreds)
test { unitTest {
// these are tested explicitly in separate test tasks // these are tested explicitly in separate test tasks
exclude '**/*CredentialsTests.class' exclude '**/*CredentialsTests.class'
exclude '**/S3BlobStoreRepositoryTests.class' exclude '**/S3BlobStoreRepositoryTests.class'

View file

@ -32,6 +32,6 @@ integTestRunner {
systemProperty 'runtime.java.home', "${project.runtimeJavaHome}" systemProperty 'runtime.java.home', "${project.runtimeJavaHome}"
} }
test.enabled = false unitTest.enabled = false
check.dependsOn integTest check.dependsOn integTest

View file

@ -31,7 +31,7 @@ dependencies {
// TODO: give each evil test its own fresh JVM for more isolation. // TODO: give each evil test its own fresh JVM for more isolation.
test { unitTest {
systemProperty 'tests.security.manager', 'false' systemProperty 'tests.security.manager', 'false'
} }

View file

@ -93,7 +93,7 @@ for (Version version : bwcVersions.indexCompatible) {
} }
} }
test.enabled = false // no unit tests for rolling upgrades, only the rest integration test unitTest.enabled = false // no unit tests for rolling upgrades, only the rest integration test
// basic integ tests includes testing bwc against the most recent version // basic integ tests includes testing bwc against the most recent version
task integTest { task integTest {

View file

@ -60,7 +60,7 @@ for (Version version : bwcVersions.wireCompatible) {
} }
} }
test.enabled = false // no unit tests for rolling upgrades, only the rest integration test unitTest.enabled = false // no unit tests for rolling upgrades, only the rest integration test
// basic integ tests includes testing bwc against the most recent version // basic integ tests includes testing bwc against the most recent version
task integTest { task integTest {

View file

@ -53,6 +53,6 @@ task integTest {
dependsOn = [mixedClusterTest] dependsOn = [mixedClusterTest]
} }
test.enabled = false // no unit tests for multi-cluster-search, only the rest integration test unitTest.enabled = false // no unit tests for multi-cluster-search, only the rest integration test
check.dependsOn(integTest) check.dependsOn(integTest)

View file

@ -140,7 +140,7 @@ for (Version version : bwcVersions.wireCompatible) {
} }
} }
test.enabled = false // no unit tests for rolling upgrades, only the rest integration test unitTest.enabled = false // no unit tests for rolling upgrades, only the rest integration test
// basic integ tests includes testing bwc against the most recent version // basic integ tests includes testing bwc against the most recent version
task integTest { task integTest {

View file

@ -71,7 +71,7 @@ forbiddenApisMain {
} }
// we don't have additional tests for the tests themselves // we don't have additional tests for the tests themselves
tasks.test.enabled = false tasks.unitTest.enabled = false
// this project doesn't get published // this project doesn't get published
tasks.dependencyLicenses.enabled = false tasks.dependencyLicenses.enabled = false

View file

@ -53,7 +53,7 @@ for (Version version : bwcVersions.indexCompatible) {
bwcTest.dependsOn(versionBwcTest) bwcTest.dependsOn(versionBwcTest)
} }
test.enabled = false unitTest.enabled = false
task integTest { task integTest {
if (project.bwc_tests_enabled) { if (project.bwc_tests_enabled) {

View file

@ -211,7 +211,7 @@ if (!Os.isFamily(Os.FAMILY_WINDOWS)) {
check.dependsOn(integTest) check.dependsOn(integTest)
test.enabled = false unitTest.enabled = false
dependencyLicenses.enabled = false dependencyLicenses.enabled = false
dependenciesInfo.enabled = false dependenciesInfo.enabled = false

View file

@ -2,5 +2,5 @@ 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'
test.enabled = false unitTest.enabled = false
jarHell.enabled = false jarHell.enabled = false

View file

@ -322,7 +322,7 @@ if (isEclipse == false || project.path == ":server-tests") {
task integTest(type: RandomizedTestingTask, task integTest(type: RandomizedTestingTask,
group: JavaBasePlugin.VERIFICATION_GROUP, group: JavaBasePlugin.VERIFICATION_GROUP,
description: 'Multi-node tests', description: 'Multi-node tests',
dependsOn: test.dependsOn) { dependsOn: unitTest.dependsOn) {
include '**/*IT.class' include '**/*IT.class'
} }
check.dependsOn integTest check.dependsOn integTest

View file

@ -39,4 +39,4 @@ task hdfs(type: JavaExec) {
// just a test fixture: we aren't using jars in releases // just a test fixture: we aren't using jars in releases
thirdPartyAudit.enabled = false thirdPartyAudit.enabled = false
// TODO: add a simple HDFS client test for this fixture // TODO: add a simple HDFS client test for this fixture
test.enabled = false unitTest.enabled = false

View file

@ -74,7 +74,7 @@ task destroy(type: org.elasticsearch.gradle.vagrant.VagrantCommandTask) {
} }
thirdPartyAudit.enabled = false thirdPartyAudit.enabled = false
test.enabled = false unitTest.enabled = false
// installKDC uses tabs in it for the Kerberos ACL file. // installKDC uses tabs in it for the Kerberos ACL file.
// Ignore it for pattern checking. // Ignore it for pattern checking.

View file

@ -24,7 +24,7 @@ a "ports" file with the port on which Elasticsearch is running.
""" """
apply plugin: 'elasticsearch.build' apply plugin: 'elasticsearch.build'
test.enabled = false unitTest.enabled = false
dependencies { dependencies {
// Just for the constants.... // Just for the constants....

View file

@ -70,7 +70,7 @@ task namingConventionsMain(type: org.elasticsearch.gradle.precommit.NamingConven
} }
precommit.dependsOn namingConventionsMain precommit.dependsOn namingConventionsMain
test.configure { unitTest {
systemProperty 'tests.gradle_index_compat_versions', bwcVersions.indexCompatible.join(',') systemProperty 'tests.gradle_index_compat_versions', bwcVersions.indexCompatible.join(',')
systemProperty 'tests.gradle_wire_compat_versions', bwcVersions.wireCompatible.join(',') systemProperty 'tests.gradle_wire_compat_versions', bwcVersions.wireCompatible.join(',')
systemProperty 'tests.gradle_unreleased_versions', bwcVersions.unreleased.join(',') systemProperty 'tests.gradle_unreleased_versions', bwcVersions.unreleased.join(',')

View file

@ -23,7 +23,7 @@ compileTestJava.options.compilerArgs << "-Xlint:-try"
task internalClusterTest(type: RandomizedTestingTask, task internalClusterTest(type: RandomizedTestingTask,
group: JavaBasePlugin.VERIFICATION_GROUP, group: JavaBasePlugin.VERIFICATION_GROUP,
description: 'Java fantasy integration tests', description: 'Java fantasy integration tests',
dependsOn: test.dependsOn) { dependsOn: unitTest.dependsOn) {
include '**/*IT.class' include '**/*IT.class'
systemProperty 'es.set.netty.runtime.available.processors', 'false' systemProperty 'es.set.netty.runtime.available.processors', 'false'
} }

View file

@ -1,7 +1,7 @@
import org.elasticsearch.gradle.test.RestIntegTestTask import org.elasticsearch.gradle.test.RestIntegTestTask
apply plugin: 'elasticsearch.build' apply plugin: 'elasticsearch.build'
test.enabled = false unitTest.enabled = false
dependencies { dependencies {
compile project(':test:framework') compile project(':test:framework')

View file

@ -59,4 +59,4 @@ followClusterTestRunner {
} }
check.dependsOn followClusterTest check.dependsOn followClusterTest
test.enabled = false // no unit tests for multi-cluster-search, only the rest integration test unitTest.enabled = false // no unit tests for multi-cluster-search, only the rest integration test

View file

@ -61,4 +61,4 @@ followClusterTestRunner {
} }
check.dependsOn followClusterTest check.dependsOn followClusterTest
test.enabled = false // no unit tests for multi-cluster-search, only the rest integration test unitTest.enabled = false // no unit tests for multi-cluster-search, only the rest integration test

View file

@ -38,4 +38,4 @@ followClusterTestRunner {
} }
check.dependsOn followClusterTest check.dependsOn followClusterTest
test.enabled = false unitTest.enabled = false

View file

@ -33,4 +33,4 @@ restTestCluster {
} }
check.dependsOn restTest check.dependsOn restTest
test.enabled = false unitTest.enabled = false

View file

@ -73,4 +73,4 @@ followClusterTestRunner {
} }
check.dependsOn followClusterTest check.dependsOn followClusterTest
test.enabled = false // no unit tests for multi-cluster-search, only the rest integration test unitTest.enabled = false // no unit tests for multi-cluster-search, only the rest integration test

View file

@ -101,7 +101,7 @@ sourceSets.test.java {
srcDir '../../license-tools/src/main/java' srcDir '../../license-tools/src/main/java'
} }
test { unitTest {
/* /*
* We have to disable setting the number of available processors as tests in the same JVM randomize processors and will step on each * 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. * other if we allow them to set the number of available processors as it's set-once in Netty.

View file

@ -1,7 +1,7 @@
import org.elasticsearch.gradle.test.RestIntegTestTask import org.elasticsearch.gradle.test.RestIntegTestTask
apply plugin: 'elasticsearch.build' apply plugin: 'elasticsearch.build'
test.enabled = false unitTest.enabled = false
dependencies { dependencies {
compile project(':test:framework') compile project(':test:framework')

View file

@ -42,4 +42,4 @@ restTestCluster {
} }
check.dependsOn restTest check.dependsOn restTest
test.enabled = false unitTest.enabled = false

View file

@ -97,7 +97,7 @@ integTest.enabled = false
task internalClusterTest(type: RandomizedTestingTask, task internalClusterTest(type: RandomizedTestingTask,
group: JavaBasePlugin.VERIFICATION_GROUP, group: JavaBasePlugin.VERIFICATION_GROUP,
description: 'Multi-node tests', description: 'Multi-node tests',
dependsOn: test.dependsOn) { dependsOn: unitTest.dependsOn) {
include '**/*IT.class' include '**/*IT.class'
systemProperty 'es.set.netty.runtime.available.processors', 'false' systemProperty 'es.set.netty.runtime.available.processors', 'false'
} }

View file

@ -59,7 +59,7 @@ integTest.enabled = false
task internalClusterTest(type: RandomizedTestingTask, task internalClusterTest(type: RandomizedTestingTask,
group: JavaBasePlugin.VERIFICATION_GROUP, group: JavaBasePlugin.VERIFICATION_GROUP,
description: 'Multi-node tests', description: 'Multi-node tests',
dependsOn: test.dependsOn) { dependsOn: unitTest.dependsOn) {
include '**/*IT.class' include '**/*IT.class'
systemProperty 'es.set.netty.runtime.available.processors', 'false' systemProperty 'es.set.netty.runtime.available.processors', 'false'
} }

View file

@ -281,7 +281,7 @@ run {
plugin xpackModule('core') plugin xpackModule('core')
} }
test { unitTest {
/* /*
* We have to disable setting the number of available processors as tests in the same JVM randomize processors and will step on each * 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. * other if we allow them to set the number of available processors as it's set-once in Netty.

View file

@ -23,7 +23,7 @@ dependencyLicenses {
} }
if (project.inFipsJvm) { if (project.inFipsJvm) {
test.enabled = false tesunitTestt.enabled = false
// Forbiden APIs non-portable checks fail because bouncy castle classes being used from the FIPS JDK since those are // Forbiden APIs non-portable checks fail because bouncy castle classes being used from the FIPS JDK since those are
// not part of the Java specification - all of this is as designed, so we have to relax this check for FIPS. // not part of the Java specification - all of this is as designed, so we have to relax this check for FIPS.
tasks.withType(CheckForbiddenApis) { tasks.withType(CheckForbiddenApis) {

View file

@ -36,7 +36,7 @@ dependencyLicenses {
ignoreSha 'elasticsearch' ignoreSha 'elasticsearch'
} }
test { unitTest {
// don't use the shaded jar for tests // don't use the shaded jar for tests
classpath += project.tasks.compileJava.outputs.files classpath += project.tasks.compileJava.outputs.files
classpath -= project.tasks.shadowJar.outputs.files classpath -= project.tasks.shadowJar.outputs.files

View file

@ -21,7 +21,7 @@ dependencies {
/* disable unit tests because these are all integration tests used /* disable unit tests because these are all integration tests used
* other qa projects. */ * other qa projects. */
test.enabled = false unitTest.enabled = false
dependencyLicenses.enabled = false dependencyLicenses.enabled = false
dependenciesInfo.enabled = false dependenciesInfo.enabled = false

View file

@ -132,7 +132,7 @@ task runcli {
} }
// Use the jar for testing so we can get the proper version information // Use the jar for testing so we can get the proper version information
test { unitTest {
classpath -= compileJava.outputs.files classpath -= compileJava.outputs.files
classpath -= configurations.compile classpath -= configurations.compile
classpath -= configurations.runtime classpath -= configurations.runtime

View file

@ -32,7 +32,7 @@ integTest.enabled = false
task internalClusterTest(type: RandomizedTestingTask, task internalClusterTest(type: RandomizedTestingTask,
group: JavaBasePlugin.VERIFICATION_GROUP, group: JavaBasePlugin.VERIFICATION_GROUP,
description: 'Multi-node tests', description: 'Multi-node tests',
dependsOn: test.dependsOn) { dependsOn: unitTest.dependsOn) {
include '**/*IT.class' include '**/*IT.class'
systemProperty 'es.set.netty.runtime.available.processors', 'false' systemProperty 'es.set.netty.runtime.available.processors', 'false'
} }

View file

@ -103,7 +103,7 @@ run {
plugin xpackModule('core') plugin xpackModule('core')
} }
test { unitTest {
/* /*
* We have to disable setting the number of available processors as tests in the same JVM randomize processors and will step on each * 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. * other if we allow them to set the number of available processors as it's set-once in Netty.

View file

@ -5,7 +5,7 @@ dependencies {
testCompile project(path: xpackModule('security'), configuration: 'testArtifacts') testCompile project(path: xpackModule('security'), configuration: 'testArtifacts')
} }
test { unitTest {
systemProperty 'tests.security.manager', 'false' systemProperty 'tests.security.manager', 'false'
include '**/*Tests.class' include '**/*Tests.class'
} }

View file

@ -8,7 +8,7 @@ import java.util.regex.Matcher
// Apply the java plugin to this project so the sources can be edited in an IDE // Apply the java plugin to this project so the sources can be edited in an IDE
apply plugin: 'elasticsearch.build' apply plugin: 'elasticsearch.build'
test.enabled = false unitTest.enabled = false
dependencies { dependencies {
// "org.elasticsearch.plugin:x-pack-core:${version}" doesn't work with idea because the testArtifacts are also here // "org.elasticsearch.plugin:x-pack-core:${version}" doesn't work with idea because the testArtifacts are also here
@ -243,8 +243,8 @@ subprojects {
bwcTest.dependsOn(versionBwcTest) bwcTest.dependsOn(versionBwcTest)
} }
} }
test.enabled = false // no unit tests for full cluster restarts, only the rest integration test unitTest.enabled = false // no unit tests for full cluster restarts, only the rest integration test
// basic integ tests includes testing bwc against the most recent version // basic integ tests includes testing bwc against the most recent version
task integTest { task integTest {

View file

@ -75,5 +75,5 @@ task integTest {
dependsOn = [mixedClusterTest] dependsOn = [mixedClusterTest]
} }
test.enabled = false // no unit tests for multi-cluster-search, only the rest integration test unitTest.enabled = false // no unit tests for multi-cluster-search, only the rest integration test
check.dependsOn(integTest) check.dependsOn(integTest)

View file

@ -23,10 +23,10 @@ task copyIdpTrust(type: Copy) {
} }
if (project.rootProject.vagrantSupported) { if (project.rootProject.vagrantSupported) {
project.sourceSets.test.output.dir(outputDir, builtBy: copyIdpTrust) project.sourceSets.test.output.dir(outputDir, builtBy: copyIdpTrust)
test.dependsOn openLdapFixture unitTest.dependsOn openLdapFixture
test.finalizedBy idpFixtureProject.halt unitTest.finalizedBy idpFixtureProject.halt
} else { } else {
test.enabled = false unitTest.enabled = false
testingConventions.enabled = false testingConventions.enabled = false
} }

View file

@ -122,7 +122,7 @@ for (Version version : bwcVersions.wireCompatible) {
} }
} }
test.enabled = false // no unit tests for rolling upgrades, only the rest integration test unitTest.enabled = false // no unit tests for rolling upgrades, only the rest integration test
// basic integ tests includes testing bwc against the most recent version // basic integ tests includes testing bwc against the most recent version
task integTest { task integTest {

View file

@ -7,7 +7,7 @@ import java.util.regex.Matcher
// Apply the java plugin to this project so the sources can be edited in an IDE // Apply the java plugin to this project so the sources can be edited in an IDE
apply plugin: 'elasticsearch.build' apply plugin: 'elasticsearch.build'
test.enabled = false unitTest.enabled = false
dependencies { dependencies {
// "org.elasticsearch.plugin:x-pack-core:${version}" doesn't work with idea because the testArtifacts are also here // "org.elasticsearch.plugin:x-pack-core:${version}" doesn't work with idea because the testArtifacts are also here
@ -327,7 +327,7 @@ subprojects {
} }
} }
test.enabled = false // no unit tests for rolling upgrades, only the rest integration test unitTest.enabled = false // no unit tests for rolling upgrades, only the rest integration test
// basic integ tests includes testing bwc against the most recent version // basic integ tests includes testing bwc against the most recent version
task integTest { task integTest {

View file

@ -19,7 +19,7 @@ forbiddenPatterns {
exclude '**/*.der' exclude '**/*.der'
} }
test { unitTest {
/* /*
* We have to disable setting the number of available processors as tests in the same JVM randomize processors and will step on each * 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. * other if we allow them to set the number of available processors as it's set-once in Netty.

View file

@ -38,5 +38,5 @@ task destroy(type: org.elasticsearch.gradle.vagrant.VagrantCommandTask) {
} }
thirdPartyAudit.enabled = false thirdPartyAudit.enabled = false
test.enabled = false unitTest.enabled = false
jarHell.enabled = false jarHell.enabled = false