diff --git a/gradle/instrumentation.gradle b/gradle/instrumentation.gradle index a0357105e7..7d852d4fca 100644 --- a/gradle/instrumentation.gradle +++ b/gradle/instrumentation.gradle @@ -130,9 +130,13 @@ tasks.withType(Test).configureEach { if (file("$buildDir/resources/main").equals(it) || file("$buildDir/classes/java/main").equals(it)) { return false } - // If agent depends on library instrumentation, it will be packaged into the testing jar so we - // need to make sure to exclude from the test classpath. - if (it.absolutePath.startsWith(file("${projectDir.parent}/library/build/libs").absolutePath)) { + // If agent depends on some shared instrumentation module that is not a testing module, it will + // be packaged into the testing jar so we need to make sure to exclude from the test classpath. + String libPath = it.absolutePath + String instrumentationPath = file("${rootDir}/instrumentation/").absolutePath + if (libPath.startsWith(instrumentationPath) && + libPath.endsWith(".jar") && + !libPath.substring(instrumentationPath.size()).contains("testing")) { return false } return true diff --git a/instrumentation/spring/spring-webflux-5.0/javaagent/src/test/groovy/SpringWebfluxTest.groovy b/instrumentation/spring/spring-webflux-5.0/javaagent/src/test/groovy/SpringWebfluxTest.groovy index 13f13e6ce5..e43b0f382f 100644 --- a/instrumentation/spring/spring-webflux-5.0/javaagent/src/test/groovy/SpringWebfluxTest.groovy +++ b/instrumentation/spring/spring-webflux-5.0/javaagent/src/test/groovy/SpringWebfluxTest.groovy @@ -6,7 +6,6 @@ import static io.opentelemetry.api.trace.SpanKind.INTERNAL import static io.opentelemetry.api.trace.SpanKind.SERVER -import io.opentelemetry.instrumentation.api.config.Config import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification import io.opentelemetry.instrumentation.test.utils.OkHttpUtils import io.opentelemetry.semconv.trace.attributes.SemanticAttributes @@ -26,8 +25,6 @@ import server.TestController @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = [SpringWebFluxTestApplication, ForceNettyAutoConfiguration]) class SpringWebfluxTest extends AgentInstrumentationSpecification { - static Config previousConfig - @TestConfiguration static class ForceNettyAutoConfiguration { @Bean