Skip to content

Commit 2b2a3f5

Browse files
authored
Replace usages RandomizedTestingTask with built-in Gradle Test (elastic#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
1 parent 75c5a8c commit 2b2a3f5

File tree

97 files changed

+666
-1552
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+666
-1552
lines changed

benchmarks/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ mainClassName = 'org.openjdk.jmh.Main'
2424
assemble.enabled = false
2525
archivesBaseName = 'elasticsearch-benchmarks'
2626

27-
unitTest.enabled = false
27+
test.enabled = false
2828

2929
dependencies {
3030
compile("org.elasticsearch:elasticsearch:${version}") {

buildSrc/build.gradle

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -199,24 +199,21 @@ if (project != rootProject) {
199199
into localDownloads
200200
}
201201

202-
unitTest {
202+
test {
203203
// The test task is configured to runtimeJava version, but build-tools doesn't support all of them, so test
204204
// with compiler instead on the ones that are too old.
205205
if (project.runtimeJavaVersion <= JavaVersion.VERSION_1_10) {
206-
jvm = "${project.compilerJavaHome}/bin/java"
206+
executable = "${project.compilerJavaHome}/bin/java"
207207
}
208208
}
209-
210-
// This can't be an RandomizedTestingTask because we can't yet reference it
209+
211210
task integTest(type: Test) {
212211
// integration test requires the local testing repo for example plugin builds
213212
dependsOn project.rootProject.allprojects.collect {
214213
it.tasks.matching { it.name == 'publishNebulaPublicationToLocalTestRepository'}
215214
}
216215
dependsOn setupLocalDownloads
217216
exclude "**/*Tests.class"
218-
testClassesDirs = sourceSets.test.output.classesDirs
219-
classpath = sourceSets.test.runtimeClasspath
220217
inputs.dir(file("src/testKit"))
221218
// tell BuildExamplePluginsIT where to find the example plugins
222219
systemProperty (
@@ -232,11 +229,7 @@ if (project != rootProject) {
232229
if (isLuceneSnapshot) {
233230
systemProperty 'test.lucene-snapshot-revision', isLuceneSnapshot[0][1]
234231
}
235-
String defaultParallel = System.getProperty('tests.jvms', project.rootProject.ext.defaultParallel)
236-
if (defaultParallel == "auto") {
237-
defaultParallel = Math.max(Runtime.getRuntime().availableProcessors(), 4)
238-
}
239-
maxParallelForks defaultParallel as Integer
232+
maxParallelForks System.getProperty('tests.jvms', project.rootProject.ext.defaultParallel.toString()) as Integer
240233
}
241234
check.dependsOn(integTest)
242235

buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/BalancersConfiguration.groovy

Lines changed: 0 additions & 53 deletions
This file was deleted.

buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/ListenersConfiguration.groovy

Lines changed: 0 additions & 25 deletions
This file was deleted.

buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/RandomizedTestingPlugin.groovy

Lines changed: 0 additions & 60 deletions
This file was deleted.

0 commit comments

Comments
 (0)