Skip to content

Commit

Permalink
Replace usages RandomizedTestingTask with built-in Gradle Test (elast…
Browse files Browse the repository at this point in the history
…ic#40564)

This commit replaces the existing RandomizedTestingTask and supporting code with Gradle's built-in JUnit support via the Test task type. Additionally, the previous workaround to disable all tasks named "test" and create new unit testing tasks named "unitTest" has been removed such that the "test" task now runs unit tests as per the normal Gradle Java plugin conventions
  • Loading branch information
mark-vieira authored and Gurkan Kaymak committed May 27, 2019
1 parent c50c9fc commit 5ebffd4
Show file tree
Hide file tree
Showing 97 changed files with 666 additions and 1,552 deletions.
2 changes: 1 addition & 1 deletion benchmarks/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ mainClassName = 'org.openjdk.jmh.Main'
assemble.enabled = false
archivesBaseName = 'elasticsearch-benchmarks'

unitTest.enabled = false
test.enabled = false

dependencies {
compile("org.elasticsearch:elasticsearch:${version}") {
Expand Down
15 changes: 4 additions & 11 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -199,24 +199,21 @@ if (project != rootProject) {
into localDownloads
}

unitTest {
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.
if (project.runtimeJavaVersion <= JavaVersion.VERSION_1_10) {
jvm = "${project.compilerJavaHome}/bin/java"
executable = "${project.compilerJavaHome}/bin/java"
}
}

// This can't be an RandomizedTestingTask because we can't yet reference it

task integTest(type: Test) {
// integration test requires the local testing repo for example plugin builds
dependsOn project.rootProject.allprojects.collect {
it.tasks.matching { it.name == 'publishNebulaPublicationToLocalTestRepository'}
}
dependsOn setupLocalDownloads
exclude "**/*Tests.class"
testClassesDirs = sourceSets.test.output.classesDirs
classpath = sourceSets.test.runtimeClasspath
inputs.dir(file("src/testKit"))
// tell BuildExamplePluginsIT where to find the example plugins
systemProperty (
Expand All @@ -232,11 +229,7 @@ if (project != rootProject) {
if (isLuceneSnapshot) {
systemProperty 'test.lucene-snapshot-revision', isLuceneSnapshot[0][1]
}
String defaultParallel = System.getProperty('tests.jvms', project.rootProject.ext.defaultParallel)
if (defaultParallel == "auto") {
defaultParallel = Math.max(Runtime.getRuntime().availableProcessors(), 4)
}
maxParallelForks defaultParallel as Integer
maxParallelForks System.getProperty('tests.jvms', project.rootProject.ext.defaultParallel.toString()) as Integer
}
check.dependsOn(integTest)

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 5ebffd4

Please sign in to comment.