diff --git a/instrumentation/log4j/log4j-context-data/log4j-context-data-2.17/javaagent/build.gradle.kts b/instrumentation/log4j/log4j-context-data/log4j-context-data-2.17/javaagent/build.gradle.kts index 7966456b327a..b8f7e18d8475 100644 --- a/instrumentation/log4j/log4j-context-data/log4j-context-data-2.17/javaagent/build.gradle.kts +++ b/instrumentation/log4j/log4j-context-data/log4j-context-data-2.17/javaagent/build.gradle.kts @@ -1,6 +1,5 @@ plugins { id("otel.javaagent-instrumentation") - id("org.unbroken-dome.test-sets") } muzzle { @@ -12,14 +11,6 @@ muzzle { } } -testSets { - // Very different codepaths when threadlocals are enabled or not so we check both. - // Regression test for https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/2403 - create("testDisableThreadLocals") { - dirName = "test" - } -} - dependencies { library("org.apache.logging.log4j:log4j-core:2.17.0") @@ -30,12 +21,33 @@ dependencies { testImplementation(project(":instrumentation:log4j:log4j-context-data:log4j-context-data-common:testing")) } -tasks { - val testDisableThreadLocals by existing(Test::class) { - jvmArgs("-Dlog4j2.is.webapp=false") - jvmArgs("-Dlog4j2.enable.threadlocals=false") +testing { + suites { + // Very different codepaths when threadlocals are enabled or not so we check both. + // Regression test for https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/2403 + val testDisableThreadLocals by registering(JvmTestSuite::class) { + sources { + groovy { + setSrcDirs(listOf("src/test/groovy")) + } + } + dependencies { + implementation(project(":instrumentation:log4j:log4j-context-data:log4j-context-data-common:testing")) + } + + targets { + all { + testTask.configure { + jvmArgs("-Dlog4j2.is.webapp=false") + jvmArgs("-Dlog4j2.enable.threadlocals=false") + } + } + } + } } +} +tasks { // Threadlocals are always false if is.webapp is true, so we make sure to override it because as of // now testing-common includes jetty / servlet. test { @@ -44,6 +56,6 @@ tasks { } named("check") { - dependsOn(testDisableThreadLocals) + dependsOn(testing.suites) } }