Skip to content

Commit 5ebffd4

Browse files
mark-vieiraGurkan Kaymak
authored and
Gurkan Kaymak
committed
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 c50c9fc commit 5ebffd4

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

+1-1
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

+4-11
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

-53
This file was deleted.

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

-25
This file was deleted.

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

-60
This file was deleted.

0 commit comments

Comments
 (0)