Skip to content

Commit cda55d5

Browse files
committed
Fix test selection logic with coverage
The way we called jacoco tasks for gradle will trigger tests outside those selected by `:baseTests` at al. Remove explicit calls to these tasks from CI, and use a `-PcheckCoverage` property instead. When combined with `:baseTests` et al., it will run jacoco tasks only for the selected tests. Remove legacy properties `-PskipInstTests`, `-PskipSmokeTests`, etc. These are now obsolete, and together with the above fix, they do not serve any purpose in CI anymore.
1 parent 529f893 commit cda55d5

File tree

6 files changed

+7
-25
lines changed

6 files changed

+7
-25
lines changed

.circleci/config.continue.yml.j2

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,7 +1057,7 @@ build_test_jobs: &build_test_jobs
10571057
name: z_test_<< matrix.testJvm >>_base
10581058
triggeredBy: *core_modules
10591059
gradleTarget: ":baseTest"
1060-
gradleParameters: "-PskipFlakyTests -PskipInstTests -PskipSmokeTests -PskipProfilingTests -PskipDebuggerTests"
1060+
gradleParameters: "-PskipFlakyTests"
10611061
stage: core
10621062
cacheType: base
10631063
parallelism: 4
@@ -1070,8 +1070,8 @@ build_test_jobs: &build_test_jobs
10701070
- ok_to_test
10711071
name: z_test_8_base
10721072
triggeredBy: *core_modules
1073-
gradleTarget: :baseTest jacocoTestReport jacocoTestCoverageVerification
1074-
gradleParameters: "-PskipFlakyTests -PskipInstTests -PskipSmokeTests -PskipProfilingTests -PskipDebuggerTests"
1073+
gradleTarget: :baseTest
1074+
gradleParameters: "-PskipFlakyTests -PcheckCoverage"
10751075
stage: core
10761076
cacheType: base
10771077
parallelism: 4
@@ -1209,7 +1209,7 @@ build_test_jobs: &build_test_jobs
12091209
name: test_<< matrix.testJvm >>_debugger
12101210
maxWorkers: 4
12111211
gradleTarget: ":debuggerTest"
1212-
gradleParameters: "-PskipFlakyTests"
1212+
gradleParameters: "-PskipFlakyTests -PcheckCoverage"
12131213
triggeredBy: *debugger_modules
12141214
stage: debugger
12151215
cacheType: base

build.gradle

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,9 @@ allprojects { project ->
165165
}
166166

167167

168-
def testAggregate(String baseTaskName, includePrefixes, excludePrefixes, boolean coverage = false) {
168+
def testAggregate(String baseTaskName, includePrefixes, excludePrefixes) {
169169
def createRootTask = { rootTaskName, subProjTaskName ->
170+
def coverage = rootProject.hasProperty("checkCoverage")? rootProject.checkCoverage : false
170171
tasks.register(rootTaskName) { aggTest ->
171172
subprojects { subproject ->
172173
if (subproject.property("activePartition") && includePrefixes.any { subproject.path.startsWith(it) } && !excludePrefixes.any { subproject.path.startsWith(it) }) {
@@ -197,7 +198,7 @@ def testAggregate(String baseTaskName, includePrefixes, excludePrefixes, boolean
197198
testAggregate("smoke", [":dd-smoke-tests"], [])
198199
testAggregate("instrumentation", [":dd-java-agent:instrumentation"], [])
199200
testAggregate("profiling", [":dd-java-agent:agent-profiling"], [])
200-
testAggregate("debugger", [":dd-java-agent:agent-debugger"], [], true)
201+
testAggregate("debugger", [":dd-java-agent:agent-debugger"], [])
201202
testAggregate("base", [":"], [
202203
":dd-java-agent:instrumentation",
203204
":dd-smoke-tests",

dd-java-agent/agent-debugger/build.gradle

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,6 @@ jar {
7373
from sourceSets.main.output
7474
}
7575

76-
tasks.withType(Test).configureEach {
77-
onlyIf { !project.rootProject.hasProperty("skipDebuggerTests") }
78-
}
79-
8076
// we want to test with no special reflective access (no --add-opens)
8177
ext.allowReflectiveAccessToJdk = false
8278

83-
subprojects { Project subProj ->
84-
subProj.tasks.withType(Test).configureEach { subTask ->
85-
onlyIf { !project.rootProject.hasProperty("skipDebuggerTests") }
86-
}
87-
}

dd-java-agent/agent-profiling/build.gradle

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,6 @@ dependencies {
3030
testImplementation libs.bundles.mockito
3131
}
3232

33-
subprojects { Project subProj ->
34-
subProj.tasks.withType(Test).configureEach { subTask ->
35-
onlyIf { !project.rootProject.hasProperty("skipProfilingTests") }
36-
}
37-
}
38-
3933
configurations {
4034
// exclude bootstrap dependencies from shadowJar
4135
runtime {

dd-java-agent/instrumentation/build.gradle

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,6 @@ subprojects { Project subProj ->
9797
useJUnit()
9898
}
9999

100-
onlyIf { !project.rootProject.hasProperty("skipInstTests") }
101-
102100
if (subTask.name in ['latestDepTest', 'latestDepForkedTest']) {
103101
subTask.jvmArgs '-Dtest.dd.latestDepTest=true'
104102
}

dd-smoke-tests/build.gradle

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ subprojects { Project subProj ->
1919
subProj.tasks.withType(Test).configureEach { subTask ->
2020
dependsOn project(':dd-java-agent').tasks.named("shadowJar")
2121

22-
onlyIf { !project.rootProject.hasProperty("skipSmokeTests") }
23-
2422
// Tests depend on this to know where to run things and what agent jar to use
2523
jvmArgs "-Ddatadog.smoketest.builddir=${buildDir}"
2624
jvmArgs "-Ddatadog.smoketest.agent.shadowJar.path=${project(':dd-java-agent').tasks.shadowJar.archiveFile.get()}"

0 commit comments

Comments
 (0)