Skip to content

Commit 640a4bd

Browse files
authored
Introduces a convention plugin for testing framework excludes (#9925)
* chore: Make the testing framework excludes a convention plugin * fix: PR review
1 parent 6a0c378 commit 640a4bd

File tree

17 files changed

+59
-47
lines changed

17 files changed

+59
-47
lines changed

buildSrc/src/main/kotlin/datadog.configure-tests.gradle.kts

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@ import org.gradle.api.plugins.jvm.JvmTestSuite
77
import java.time.Duration
88
import java.time.temporal.ChronoUnit
99

10-
val isTestingInstrumentation = providers.provider {
11-
project.findProperty("testingInstrumentation") as? Boolean ?: false
12-
}
13-
1410
// Need concrete implementation of BuildService in Kotlin
1511
abstract class ForkedTestLimit : BuildService<BuildServiceParameters.None>
1612
// Forked tests will fail with OOM if the memory is set too high. Gitlab allows at least a limit of 3.
@@ -43,25 +39,6 @@ tasks.withType<Test>().configureEach {
4339
!rootProject.providers.gradleProperty("rerun.tests.${project.name}").isPresent
4440
}
4541

46-
// Avoid executing classes used to test testing frameworks instrumentation
47-
if (isTestingInstrumentation.get()) {
48-
exclude("**/TestAssumption*", "**/TestSuiteSetUpAssumption*")
49-
exclude("**/TestDisableTestTrace*")
50-
exclude("**/TestError*")
51-
exclude("**/TestFactory*")
52-
exclude("**/TestFailed*")
53-
exclude("**/TestFailedWithSuccessPercentage*")
54-
exclude("**/TestInheritance*", "**/BaseTestInheritance*")
55-
exclude("**/TestParameterized*")
56-
exclude("**/TestRepeated*")
57-
exclude("**/TestSkipped*")
58-
exclude("**/TestSkippedClass*")
59-
exclude("**/TestSucceed*")
60-
exclude("**/TestTemplate*")
61-
exclude("**/TestUnskippable*")
62-
exclude("**/TestWithSetup*")
63-
}
64-
6542
// Split up tests that want to run forked in their own separate JVM for generated tasks
6643
if (name.startsWith("forkedTest") || name.endsWith("ForkedTest")) {
6744
setExcludes(emptyList())
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
plugins {
2+
java
3+
}
4+
5+
logger.info("Avoid executing classes used to test testing frameworks instrumentation")
6+
7+
tasks.withType<Test>().configureEach {
8+
exclude("**/TestAssumption*", "**/TestSuiteSetUpAssumption*")
9+
exclude("**/TestDisableTestTrace*")
10+
exclude("**/TestError*")
11+
exclude("**/TestFactory*")
12+
exclude("**/TestFailed*")
13+
exclude("**/TestFailedWithSuccessPercentage*")
14+
exclude("**/TestInheritance*", "**/BaseTestInheritance*")
15+
exclude("**/TestParameterized*")
16+
exclude("**/TestRepeated*")
17+
exclude("**/TestSkipped*")
18+
exclude("**/TestSkippedClass*")
19+
exclude("**/TestSucceed*")
20+
exclude("**/TestTemplate*")
21+
exclude("**/TestUnskippable*")
22+
exclude("**/TestWithSetup*")
23+
}

dd-java-agent/instrumentation/cucumber/build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
ext.testingInstrumentation = true
1+
plugins {
2+
id 'datadog.instrumentation.testing-framework-tests'
3+
}
24

35
apply from: "$rootDir/gradle/java.gradle"
46

dd-java-agent/instrumentation/junit/junit-4.10/build.gradle

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
33

44
plugins {
55
id 'org.jetbrains.kotlin.jvm'
6+
id 'datadog.instrumentation.testing-framework-tests'
67
}
78

8-
ext.testingInstrumentation = true
9-
109
apply from: "$rootDir/gradle/java.gradle"
1110
apply from: "$rootDir/gradle/test-with-kotlin.gradle"
1211

dd-java-agent/instrumentation/junit/junit-4.10/cucumber-junit-4/build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
ext.testingInstrumentation = true
1+
plugins {
2+
id 'datadog.instrumentation.testing-framework-tests'
3+
}
24

35
apply from: "$rootDir/gradle/java.gradle"
46

dd-java-agent/instrumentation/junit/junit-4.10/junit-4.13/build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
ext.testingInstrumentation = true
1+
plugins {
2+
id 'datadog.instrumentation.testing-framework-tests'
3+
}
24

35
apply from: "$rootDir/gradle/java.gradle"
46

dd-java-agent/instrumentation/junit/junit-4.10/munit-junit-4/build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
ext.testingInstrumentation = true
1+
plugins {
2+
id 'datadog.instrumentation.testing-framework-tests'
3+
}
24

35
apply from: "$rootDir/gradle/java.gradle"
46
apply plugin: 'scala'

dd-java-agent/instrumentation/junit/junit-5.3/build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
ext.testingInstrumentation = true
1+
plugins {
2+
id 'datadog.instrumentation.testing-framework-tests'
3+
}
24

35
apply from: "$rootDir/gradle/java.gradle"
46

dd-java-agent/instrumentation/junit/junit-5.3/cucumber-junit-5/build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
ext.testingInstrumentation = true
1+
plugins {
2+
id 'datadog.instrumentation.testing-framework-tests'
3+
}
24

35
apply from: "$rootDir/gradle/java.gradle"
46

dd-java-agent/instrumentation/junit/junit-5.3/junit-5.8/build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
ext.testingInstrumentation = true
1+
plugins {
2+
id 'datadog.instrumentation.testing-framework-tests'
3+
}
24

35
apply from: "$rootDir/gradle/java.gradle"
46

0 commit comments

Comments
 (0)