Move setting test properties to instrumentation.gradle (from AgentTestRunner)
I think that they might have been not noticed by the javaagent when set in the AgentTestRunner
MODIFY
gradle/instrumentation.gradle
gradle/instrumentation.gradle
@@ -111,6 +111,11 @@ tasks.withType(Test).configureEach {
jvmArgs "-javaagent:${project(":testing:agent-for-testing").tasks.shadowJar.archiveFile.get().asFile.absolutePath}"
jvmArgs "-Dotel.initializer.jar=${shadowJar.archiveFile.get().asFile.absolutePath}"
jvmArgs "-Dinternal.testing.disable.global.library.ignores=true"
+ // always run with the thread propagation debugger to help track down sporadic test failures
+ jvmArgs "-Dotel.threadPropagationDebugger=true"
+ jvmArgs "-Dotel.internal.failOnContextLeak=true"
+ // always print muzzle warnings
+ jvmArgs "-Dio.opentelemetry.javaagent.slf4j.simpleLogger.log.muzzleMatcher=warn"
dependsOn shadowJar
dependsOn ":testing:agent-for-testing:shadowJar"

MODIFY
testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/AgentTestRunner.java
testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/AgentTestRunner.java
@@ -18,15 +18,6 @@ import io.opentelemetry.javaagent.testing.common.TestAgentListenerAccess;
import org.slf4j.LoggerFactory;
public final class AgentTestRunner {
-
- static {
- // always run with the thread propagation debugger to help track down sporadic test failures
- System.setProperty("otel.threadPropagationDebugger", "true");
- System.setProperty("otel.internal.failOnContextLeak", "true");
- // always print muzzle warnings
- System.setProperty("io.opentelemetry.javaagent.slf4j.simpleLogger.log.muzzleMatcher", "warn");
- }
-
/**
* For test runs, agent's global tracer will report to this list writer.
*

Move setting test properties to instrumentation.gradle (from AgentTestRunner) (#2205)

I think that they might have been not noticed by the javaagent when set in the AgentTestRunner