Skip to content

Commit bb8e740

Browse files
committed
Merge remote-tracking branch 'upstream/main' into test-suites-gcp-auth
2 parents a892757 + 9226e87 commit bb8e740

File tree

1 file changed

+42
-27
lines changed

1 file changed

+42
-27
lines changed

runtime-attach/runtime-attach/build.gradle.kts

Lines changed: 42 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,48 @@ dependencies {
2424
testImplementation("org.assertj:assertj-core")
2525
}
2626

27+
testing {
28+
suites {
29+
val test by getting(JvmTestSuite::class) {
30+
targets.all {
31+
testTask.configure {
32+
setForkEvery(1) // One JVM by test class to avoid a test class launching a runtime attachment influences the behavior of another test class
33+
filter {
34+
excludeTestsMatching("AgentDisabledByEnvironmentVariableTest")
35+
excludeTestsMatching("AgentDisabledBySystemPropertyTest")
36+
}
37+
}
38+
}
39+
}
40+
41+
val testAgentDisabledByEnvironmentVariable by registering(JvmTestSuite::class) {
42+
targets.all {
43+
testTask.configure {
44+
setForkEvery(1)
45+
filter {
46+
includeTestsMatching("AgentDisabledByEnvironmentVariableTest")
47+
}
48+
include("**/AgentDisabledByEnvironmentVariableTest.*")
49+
environment("OTEL_JAVAAGENT_ENABLED", "false")
50+
}
51+
}
52+
}
53+
54+
val testAgentDisabledBySystemProperty by registering(JvmTestSuite::class) {
55+
targets.all {
56+
testTask.configure {
57+
setForkEvery(1)
58+
filter {
59+
includeTestsMatching("AgentDisabledBySystemPropertyTest")
60+
}
61+
include("**/AgentDisabledBySystemPropertyTest.*")
62+
jvmArgs("-Dotel.javaagent.enabled=false")
63+
}
64+
}
65+
}
66+
}
67+
}
68+
2769
tasks {
2870
jar {
2971
inputs.files(agent)
@@ -32,31 +74,4 @@ tasks {
3274
})
3375
rename("^(.*)\\.jar\$", "otel-agent.jar")
3476
}
35-
36-
withType<Test>().configureEach {
37-
setForkEvery(1) // One JVM by test class to avoid a test class launching a runtime attachment influences the behavior of another test class
38-
}
39-
40-
val testAgentDisabledByEnvironmentVariable by registering(Test::class) {
41-
filter {
42-
includeTestsMatching("AgentDisabledByEnvironmentVariableTest")
43-
}
44-
include("**/AgentDisabledByEnvironmentVariableTest.*")
45-
environment("OTEL_JAVAAGENT_ENABLED", "false")
46-
}
47-
48-
val testAgentDisabledBySystemProperty by registering(Test::class) {
49-
filter {
50-
includeTestsMatching("AgentDisabledBySystemPropertyTest")
51-
}
52-
include("**/AgentDisabledBySystemPropertyTest.*")
53-
jvmArgs("-Dotel.javaagent.enabled=false")
54-
}
55-
56-
test {
57-
filter {
58-
excludeTestsMatching("AgentDisabledByEnvironmentVariableTest")
59-
excludeTestsMatching("AgentDisabledBySystemPropertyTest")
60-
}
61-
}
6277
}

0 commit comments

Comments
 (0)