From 2f12bf599d77aadc76ec78acc2ced117277b3ac8 Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Thu, 9 Oct 2025 21:11:22 -0700 Subject: [PATCH 1/2] Convert runtime-attach to use test suites --- .../runtime-attach/build.gradle.kts | 72 +++++++++++-------- 1 file changed, 43 insertions(+), 29 deletions(-) diff --git a/runtime-attach/runtime-attach/build.gradle.kts b/runtime-attach/runtime-attach/build.gradle.kts index 27927a7f0..b4003ed3e 100644 --- a/runtime-attach/runtime-attach/build.gradle.kts +++ b/runtime-attach/runtime-attach/build.gradle.kts @@ -24,6 +24,48 @@ dependencies { testImplementation("org.assertj:assertj-core") } +testing { + suites { + val test by getting(JvmTestSuite::class) { + targets.all { + testTask.configure { + setForkEvery(1) // One JVM by test class to avoid a test class launching a runtime attachment influences the behavior of another test class + filter { + excludeTestsMatching("AgentDisabledByEnvironmentVariableTest") + excludeTestsMatching("AgentDisabledBySystemPropertyTest") + } + } + } + } + + val testAgentDisabledByEnvironmentVariable by registering(JvmTestSuite::class) { + targets.all { + testTask.configure { + setForkEvery(1) + filter { + includeTestsMatching("AgentDisabledByEnvironmentVariableTest") + } + include("**/AgentDisabledByEnvironmentVariableTest.*") + environment("OTEL_JAVAAGENT_ENABLED", "false") + } + } + } + + val testAgentDisabledBySystemProperty by registering(JvmTestSuite::class) { + targets.all { + testTask.configure { + setForkEvery(1) + filter { + includeTestsMatching("AgentDisabledBySystemPropertyTest") + } + include("**/AgentDisabledBySystemPropertyTest.*") + jvmArgs("-Dotel.javaagent.enabled=false") + } + } + } + } +} + tasks { jar { inputs.files(agent) @@ -33,35 +75,7 @@ tasks { rename("^(.*)\\.jar\$", "otel-agent.jar") } - withType().configureEach { - setForkEvery(1) // One JVM by test class to avoid a test class launching a runtime attachment influences the behavior of another test class - } - - val testAgentDisabledByEnvironmentVariable by registering(Test::class) { - filter { - includeTestsMatching("AgentDisabledByEnvironmentVariableTest") - } - include("**/AgentDisabledByEnvironmentVariableTest.*") - environment("OTEL_JAVAAGENT_ENABLED", "false") - } - - val testAgentDisabledBySystemProperty by registering(Test::class) { - filter { - includeTestsMatching("AgentDisabledBySystemPropertyTest") - } - include("**/AgentDisabledBySystemPropertyTest.*") - jvmArgs("-Dotel.javaagent.enabled=false") - } - - test { - filter { - excludeTestsMatching("AgentDisabledByEnvironmentVariableTest") - excludeTestsMatching("AgentDisabledBySystemPropertyTest") - } - } - check { - dependsOn(testAgentDisabledByEnvironmentVariable) - dependsOn(testAgentDisabledBySystemProperty) + dependsOn(testing.suites) } } From 2fdb5562bf877ad604cfd179e646d18768577567 Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Tue, 14 Oct 2025 11:45:16 -0700 Subject: [PATCH 2/2] fix merge --- runtime-attach/runtime-attach/build.gradle.kts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/runtime-attach/runtime-attach/build.gradle.kts b/runtime-attach/runtime-attach/build.gradle.kts index b4003ed3e..15cb3361a 100644 --- a/runtime-attach/runtime-attach/build.gradle.kts +++ b/runtime-attach/runtime-attach/build.gradle.kts @@ -74,8 +74,4 @@ tasks { }) rename("^(.*)\\.jar\$", "otel-agent.jar") } - - check { - dependsOn(testing.suites) - } }