diff --git a/instrumentation-api-incubator/build.gradle.kts b/instrumentation-api-incubator/build.gradle.kts index c6e0eaa576ba..ac891987027a 100644 --- a/instrumentation-api-incubator/build.gradle.kts +++ b/instrumentation-api-incubator/build.gradle.kts @@ -28,6 +28,30 @@ dependencies { testImplementation("io.opentelemetry:opentelemetry-sdk-extension-incubator") } +testing { + suites { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database,code") + } + } + } + } + + val testBothSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database/dup,code/dup") + } + } + } + } + } +} + tasks { // exclude auto-generated code named("checkstyleMain") { @@ -45,16 +69,7 @@ tasks { dependsOn("generateJflex") } - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database,code") - } - - val testBothSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database/dup,code/dup") - } - check { - dependsOn(testStableSemconv) - dependsOn(testBothSemconv) + dependsOn(testing.suites) } } diff --git a/instrumentation/alibaba-druid-1.0/javaagent/build.gradle.kts b/instrumentation/alibaba-druid-1.0/javaagent/build.gradle.kts index f0f6141eb0b0..74d7f68924a3 100644 --- a/instrumentation/alibaba-druid-1.0/javaagent/build.gradle.kts +++ b/instrumentation/alibaba-druid-1.0/javaagent/build.gradle.kts @@ -21,19 +21,28 @@ dependencies { val collectMetadata = findProperty("collectMetadata")?.toString() ?: "false" -tasks { - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - - systemProperty("collectMetadata", collectMetadata) - systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database") +testing { + suites { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + systemProperty("collectMetadata", collectMetadata) + systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database") + } + } + } + } } +} +tasks { test { systemProperty("collectMetadata", collectMetadata) } check { - dependsOn(testStableSemconv) + dependsOn(testing.suites) } } diff --git a/instrumentation/alibaba-druid-1.0/library/build.gradle.kts b/instrumentation/alibaba-druid-1.0/library/build.gradle.kts index 6101530383e6..eabe5aaed0c3 100644 --- a/instrumentation/alibaba-druid-1.0/library/build.gradle.kts +++ b/instrumentation/alibaba-druid-1.0/library/build.gradle.kts @@ -9,12 +9,22 @@ dependencies { testImplementation(project(":instrumentation:alibaba-druid-1.0:testing")) } -tasks { - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") +testing { + suites { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + } + } + } + } } +} +tasks { check { - dependsOn(testStableSemconv) + dependsOn(testing.suites) } } diff --git a/instrumentation/apache-dbcp-2.0/javaagent/build.gradle.kts b/instrumentation/apache-dbcp-2.0/javaagent/build.gradle.kts index 708d2b7b1ae4..4b76fcd0b05a 100644 --- a/instrumentation/apache-dbcp-2.0/javaagent/build.gradle.kts +++ b/instrumentation/apache-dbcp-2.0/javaagent/build.gradle.kts @@ -21,19 +21,28 @@ dependencies { val collectMetadata = findProperty("collectMetadata")?.toString() ?: "false" -tasks { - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - - systemProperty("collectMetadata", collectMetadata) - systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database") +testing { + suites { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + systemProperty("collectMetadata", collectMetadata) + systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database") + } + } + } + } } +} +tasks { test { systemProperty("collectMetadata", collectMetadata) } check { - dependsOn(testStableSemconv) + dependsOn(testing.suites) } } diff --git a/instrumentation/apache-dbcp-2.0/library/build.gradle.kts b/instrumentation/apache-dbcp-2.0/library/build.gradle.kts index a662876a4782..661412dff52e 100644 --- a/instrumentation/apache-dbcp-2.0/library/build.gradle.kts +++ b/instrumentation/apache-dbcp-2.0/library/build.gradle.kts @@ -9,12 +9,22 @@ dependencies { testImplementation(project(":instrumentation:apache-dbcp-2.0:testing")) } -tasks { - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") +testing { + suites { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + } + } + } + } } +} +tasks { check { - dependsOn(testStableSemconv) + dependsOn(testing.suites) } } diff --git a/instrumentation/aws-sdk/aws-sdk-1.11/javaagent/build.gradle.kts b/instrumentation/aws-sdk/aws-sdk-1.11/javaagent/build.gradle.kts index 31e40dd3c8aa..17cc806954c5 100644 --- a/instrumentation/aws-sdk/aws-sdk-1.11/javaagent/build.gradle.kts +++ b/instrumentation/aws-sdk/aws-sdk-1.11/javaagent/build.gradle.kts @@ -128,6 +128,18 @@ testing { } } } + + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + systemProperty("collectMetadata", collectMetadata) + systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database") + } + } + } + } } } @@ -144,17 +156,6 @@ tasks { } } - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - - systemProperty("collectMetadata", collectMetadata) - systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database") - } - - check { - dependsOn(testStableSemconv) - } - test { usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service) systemProperty("collectMetadata", collectMetadata) diff --git a/instrumentation/aws-sdk/aws-sdk-1.11/library-autoconfigure/build.gradle.kts b/instrumentation/aws-sdk/aws-sdk-1.11/library-autoconfigure/build.gradle.kts index 3403f770cd17..ead9d66b493e 100644 --- a/instrumentation/aws-sdk/aws-sdk-1.11/library-autoconfigure/build.gradle.kts +++ b/instrumentation/aws-sdk/aws-sdk-1.11/library-autoconfigure/build.gradle.kts @@ -23,19 +23,29 @@ dependencies { latestDepTestLibrary("com.amazonaws:aws-java-sdk-sqs:1.12.583") // documented limitation } +testing { + suites { + val testReceiveSpansDisabled by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + filter { + includeTestsMatching("SqsSuppressReceiveSpansTest") + } + include("**/SqsSuppressReceiveSpansTest.*") + } + } + } + } + } +} + tasks { withType().configureEach { systemProperty("otel.instrumentation.aws-sdk.experimental-span-attributes", "true") systemProperty("otel.instrumentation.messaging.experimental.capture-headers", "Test-Message-Header") } - val testReceiveSpansDisabled by registering(Test::class) { - filter { - includeTestsMatching("SqsSuppressReceiveSpansTest") - } - include("**/SqsSuppressReceiveSpansTest.*") - } - test { filter { excludeTestsMatching("SqsSuppressReceiveSpansTest") @@ -44,7 +54,7 @@ tasks { } check { - dependsOn(testReceiveSpansDisabled) + dependsOn(testing.suites) } } diff --git a/instrumentation/aws-sdk/aws-sdk-1.11/library/build.gradle.kts b/instrumentation/aws-sdk/aws-sdk-1.11/library/build.gradle.kts index 8a3e396a43d8..b368bcc6b2e5 100644 --- a/instrumentation/aws-sdk/aws-sdk-1.11/library/build.gradle.kts +++ b/instrumentation/aws-sdk/aws-sdk-1.11/library/build.gradle.kts @@ -48,16 +48,21 @@ testing { implementation("com.amazonaws:aws-java-sdk-secretsmanager:$version") } } + + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + } + } + } + } } } tasks { - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - } - check { dependsOn(testing.suites) - dependsOn(testStableSemconv) } } diff --git a/instrumentation/aws-sdk/aws-sdk-2.2/javaagent/build.gradle.kts b/instrumentation/aws-sdk/aws-sdk-2.2/javaagent/build.gradle.kts index 79258da0e422..31ea08e06e31 100644 --- a/instrumentation/aws-sdk/aws-sdk-2.2/javaagent/build.gradle.kts +++ b/instrumentation/aws-sdk/aws-sdk-2.2/javaagent/build.gradle.kts @@ -171,21 +171,53 @@ testing { } } -tasks { - val testExperimentalSqs by registering(Test::class) { - filter { - excludeTestsMatching("Aws2SqsSuppressReceiveSpansTest") +testing { + suites { + val testExperimentalSqs by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + filter { + excludeTestsMatching("Aws2SqsSuppressReceiveSpansTest") + } + systemProperty("otel.instrumentation.aws-sdk.experimental-use-propagator-for-messaging", "true") + systemProperty("otel.instrumentation.messaging.experimental.receive-telemetry.enabled", "true") + } + } + } } - systemProperty("otel.instrumentation.aws-sdk.experimental-use-propagator-for-messaging", "true") - systemProperty("otel.instrumentation.messaging.experimental.receive-telemetry.enabled", "true") - } - val testReceiveSpansDisabled by registering(Test::class) { - filter { - includeTestsMatching("Aws2SqsSuppressReceiveSpansTest") + val testReceiveSpansDisabled by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + filter { + includeTestsMatching("Aws2SqsSuppressReceiveSpansTest") + } + include("**/Aws2SqsSuppressReceiveSpansTest.*") + } + } + } + } + + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + filter { + excludeTestsMatching("Aws2SqsSuppressReceiveSpansTest") + } + systemProperty("otel.instrumentation.messaging.experimental.receive-telemetry.enabled", "true") + jvmArgs("-Dotel.semconv-stability.opt-in=database") + systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database") + } + } + } } - include("**/Aws2SqsSuppressReceiveSpansTest.*") } +} + +tasks { test { filter { @@ -196,8 +228,6 @@ tasks { } check { - dependsOn(testExperimentalSqs) - dependsOn(testReceiveSpansDisabled) dependsOn(testing.suites) } @@ -214,18 +244,4 @@ tasks { include("software/amazon/awssdk/global/handlers/execution.interceptors") } } - - val testStableSemconv by registering(Test::class) { - filter { - excludeTestsMatching("Aws2SqsSuppressReceiveSpansTest") - } - systemProperty("otel.instrumentation.messaging.experimental.receive-telemetry.enabled", "true") - jvmArgs("-Dotel.semconv-stability.opt-in=database") - - systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database") - } - - check { - dependsOn(testStableSemconv) - } } diff --git a/instrumentation/aws-sdk/aws-sdk-2.2/library-autoconfigure/build.gradle.kts b/instrumentation/aws-sdk/aws-sdk-2.2/library-autoconfigure/build.gradle.kts index 38dd2cd78fbe..e3592e0c4a0f 100644 --- a/instrumentation/aws-sdk/aws-sdk-2.2/library-autoconfigure/build.gradle.kts +++ b/instrumentation/aws-sdk/aws-sdk-2.2/library-autoconfigure/build.gradle.kts @@ -24,6 +24,20 @@ dependencies { testLibrary("software.amazon.awssdk:sqs:2.2.0") } +testing { + suites { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + } + } + } + } + } +} + tasks { withType().configureEach { systemProperty("otel.instrumentation.aws-sdk.experimental-span-attributes", true) @@ -32,11 +46,7 @@ tasks { systemProperty("testLatestDeps", findProperty("testLatestDeps") as Boolean) } - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - } - check { - dependsOn(testStableSemconv) + dependsOn(testing.suites) } } diff --git a/instrumentation/aws-sdk/aws-sdk-2.2/library/build.gradle.kts b/instrumentation/aws-sdk/aws-sdk-2.2/library/build.gradle.kts index c832ee002c1e..296527cf53d7 100644 --- a/instrumentation/aws-sdk/aws-sdk-2.2/library/build.gradle.kts +++ b/instrumentation/aws-sdk/aws-sdk-2.2/library/build.gradle.kts @@ -66,6 +66,16 @@ testing { implementation("software.amazon.awssdk:bedrockruntime:$version") } } + + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + } + } + } + } } } @@ -77,12 +87,7 @@ tasks { systemProperty("testLatestDeps", findProperty("testLatestDeps") as Boolean) } - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - } - check { dependsOn(testing.suites) - dependsOn(testStableSemconv) } } diff --git a/instrumentation/c3p0-0.9/javaagent/build.gradle.kts b/instrumentation/c3p0-0.9/javaagent/build.gradle.kts index 509cd19804aa..532f5c1d6121 100644 --- a/instrumentation/c3p0-0.9/javaagent/build.gradle.kts +++ b/instrumentation/c3p0-0.9/javaagent/build.gradle.kts @@ -23,19 +23,28 @@ dependencies { val collectMetadata = findProperty("collectMetadata")?.toString() ?: "false" -tasks { - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - - systemProperty("collectMetadata", collectMetadata) - systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database") +testing { + suites { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + systemProperty("collectMetadata", collectMetadata) + systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database") + } + } + } + } } +} +tasks { test { systemProperty("collectMetadata", collectMetadata) } check { - dependsOn(testStableSemconv) + dependsOn(testing.suites) } } diff --git a/instrumentation/c3p0-0.9/library/build.gradle.kts b/instrumentation/c3p0-0.9/library/build.gradle.kts index a7b7f6a397ee..248eb45d9db8 100644 --- a/instrumentation/c3p0-0.9/library/build.gradle.kts +++ b/instrumentation/c3p0-0.9/library/build.gradle.kts @@ -9,12 +9,22 @@ dependencies { testImplementation(project(":instrumentation:c3p0-0.9:testing")) } -tasks { - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") +testing { + suites { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + } + } + } + } } +} +tasks { check { - dependsOn(testStableSemconv) + dependsOn(testing.suites) } } diff --git a/instrumentation/camel-2.20/javaagent/build.gradle.kts b/instrumentation/camel-2.20/javaagent/build.gradle.kts index d401d4f03f1b..640dabf884a6 100644 --- a/instrumentation/camel-2.20/javaagent/build.gradle.kts +++ b/instrumentation/camel-2.20/javaagent/build.gradle.kts @@ -67,6 +67,32 @@ dependencies { latestDepTestLibrary("org.apache.camel:camel-cassandraql:2.+") // documented limitation } +testing { + suites { + val testExperimental by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.instrumentation.camel.experimental-span-attributes=true") + systemProperty("metadataConfig", "otel.instrumentation.camel.experimental-span-attributes=true") + } + } + } + } + + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database") + } + } + } + } + } +} + tasks { withType().configureEach { jvmArgs("-Dotel.instrumentation.aws-sdk.experimental-span-attributes=true") @@ -83,18 +109,8 @@ tasks { systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false") } - val testExperimental by registering(Test::class) { - jvmArgs("-Dotel.instrumentation.camel.experimental-span-attributes=true") - systemProperty("metadataConfig", "otel.instrumentation.camel.experimental-span-attributes=true") - } - - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database") - } - check { - dependsOn(testStableSemconv, testExperimental) + dependsOn(testing.suites) } } diff --git a/instrumentation/cassandra/cassandra-3.0/javaagent/build.gradle.kts b/instrumentation/cassandra/cassandra-3.0/javaagent/build.gradle.kts index 7abc06528df7..16afb935a934 100644 --- a/instrumentation/cassandra/cassandra-3.0/javaagent/build.gradle.kts +++ b/instrumentation/cassandra/cassandra-3.0/javaagent/build.gradle.kts @@ -40,18 +40,28 @@ dependencies { // Requires old Guava. Can't use enforcedPlatform since predates BOM configurations.testRuntimeClasspath.get().resolutionStrategy.force("com.google.guava:guava:19.0") +testing { + suites { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database") + } + } + } + } + } +} + tasks { withType().configureEach { usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service) systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false") } - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database") - } - check { - dependsOn(testStableSemconv) + dependsOn(testing.suites) } } diff --git a/instrumentation/cassandra/cassandra-4.0/javaagent/build.gradle.kts b/instrumentation/cassandra/cassandra-4.0/javaagent/build.gradle.kts index b49f63d13fa1..69deb88d6439 100644 --- a/instrumentation/cassandra/cassandra-4.0/javaagent/build.gradle.kts +++ b/instrumentation/cassandra/cassandra-4.0/javaagent/build.gradle.kts @@ -23,18 +23,28 @@ dependencies { testInstrumentation(project(":instrumentation:cassandra:cassandra-4.4:javaagent")) } +testing { + suites { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database") + } + } + } + } + } +} + tasks { withType().configureEach { usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service) systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false") } - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database") - } - check { - dependsOn(testStableSemconv) + dependsOn(testing.suites) } } diff --git a/instrumentation/cassandra/cassandra-4.4/javaagent/build.gradle.kts b/instrumentation/cassandra/cassandra-4.4/javaagent/build.gradle.kts index 1c9ec282a5c6..a701a68d1aae 100644 --- a/instrumentation/cassandra/cassandra-4.4/javaagent/build.gradle.kts +++ b/instrumentation/cassandra/cassandra-4.4/javaagent/build.gradle.kts @@ -26,18 +26,28 @@ dependencies { testInstrumentation(project(":instrumentation:cassandra:cassandra-4.0:javaagent")) } +testing { + suites { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database") + } + } + } + } + } +} + tasks { withType().configureEach { usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service) systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false") } - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database") - } - check { - dependsOn(testStableSemconv) + dependsOn(testing.suites) } } diff --git a/instrumentation/cassandra/cassandra-4.4/library/build.gradle.kts b/instrumentation/cassandra/cassandra-4.4/library/build.gradle.kts index 19f0d3172cd5..891a5bfb4de0 100644 --- a/instrumentation/cassandra/cassandra-4.4/library/build.gradle.kts +++ b/instrumentation/cassandra/cassandra-4.4/library/build.gradle.kts @@ -11,16 +11,26 @@ dependencies { testImplementation(project(":instrumentation:cassandra:cassandra-4.4:testing")) } +testing { + suites { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + } + } + } + } + } +} + tasks { withType().configureEach { usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service) } - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - } - check { - dependsOn(testStableSemconv) + dependsOn(testing.suites) } } diff --git a/instrumentation/clickhouse-client-0.5/javaagent/build.gradle.kts b/instrumentation/clickhouse-client-0.5/javaagent/build.gradle.kts index cf36f4d1d23e..492158ee0dcc 100644 --- a/instrumentation/clickhouse-client-0.5/javaagent/build.gradle.kts +++ b/instrumentation/clickhouse-client-0.5/javaagent/build.gradle.kts @@ -24,20 +24,29 @@ dependencies { val collectMetadata = findProperty("collectMetadata")?.toString() ?: "false" +testing { + suites { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database") + systemProperty("collectMetadata", collectMetadata) + } + } + } + } + } +} + tasks { test { usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service) systemProperty("collectMetadata", collectMetadata) } - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - - systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database") - systemProperty("collectMetadata", collectMetadata) - } - check { - dependsOn(testStableSemconv) + dependsOn(testing.suites) } } diff --git a/instrumentation/couchbase/couchbase-2.0/javaagent/build.gradle.kts b/instrumentation/couchbase/couchbase-2.0/javaagent/build.gradle.kts index 76e51366e10a..3ec412aef20f 100644 --- a/instrumentation/couchbase/couchbase-2.0/javaagent/build.gradle.kts +++ b/instrumentation/couchbase/couchbase-2.0/javaagent/build.gradle.kts @@ -30,6 +30,21 @@ dependencies { latestDepTestLibrary("com.couchbase.client:java-client:2.5.+") // see couchbase-2.6 module } +testing { + suites { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database") + } + } + } + } + } +} + tasks { withType().configureEach { // required on jdk17 @@ -40,12 +55,7 @@ tasks { systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false") } - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database") - } - check { - dependsOn(testStableSemconv) + dependsOn(testing.suites) } } diff --git a/instrumentation/couchbase/couchbase-2.6/javaagent/build.gradle.kts b/instrumentation/couchbase/couchbase-2.6/javaagent/build.gradle.kts index 3e41596e7b8a..82efe330e18d 100644 --- a/instrumentation/couchbase/couchbase-2.6/javaagent/build.gradle.kts +++ b/instrumentation/couchbase/couchbase-2.6/javaagent/build.gradle.kts @@ -33,6 +33,32 @@ dependencies { latestDepTestLibrary("com.couchbase.client:java-client:2.+") // see couchbase-3.1 module } +testing { + suites { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database") + } + } + } + } + + val testExperimental by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.instrumentation.couchbase.experimental-span-attributes=true") + systemProperty("metadataConfig", "otel.instrumentation.couchbase.experimental-span-attributes=true") + } + } + } + } + } +} + tasks { withType().configureEach { // required on jdk17 @@ -42,17 +68,7 @@ tasks { systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false") } - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database") - } - - val testExperimental by registering(Test::class) { - jvmArgs("-Dotel.instrumentation.couchbase.experimental-span-attributes=true") - systemProperty("metadataConfig", "otel.instrumentation.couchbase.experimental-span-attributes=true") - } - check { - dependsOn(testStableSemconv, testExperimental) + dependsOn(testing.suites) } } diff --git a/instrumentation/couchbase/couchbase-3.1.6/javaagent/build.gradle.kts b/instrumentation/couchbase/couchbase-3.1.6/javaagent/build.gradle.kts index c0128fac5e38..ec47a67d443e 100644 --- a/instrumentation/couchbase/couchbase-3.1.6/javaagent/build.gradle.kts +++ b/instrumentation/couchbase/couchbase-3.1.6/javaagent/build.gradle.kts @@ -38,16 +38,26 @@ dependencies { latestDepTestLibrary("com.couchbase.client:java-client:3.1.+") // see couchbase-3.2 module } +testing { + suites { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + } + } + } + } + } +} + tasks { withType().configureEach { usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service) } - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - } - check { - dependsOn(testStableSemconv) + dependsOn(testing.suites) } } diff --git a/instrumentation/couchbase/couchbase-3.1/javaagent/build.gradle.kts b/instrumentation/couchbase/couchbase-3.1/javaagent/build.gradle.kts index 8efea0a3a21f..aab8adb7eaf5 100644 --- a/instrumentation/couchbase/couchbase-3.1/javaagent/build.gradle.kts +++ b/instrumentation/couchbase/couchbase-3.1/javaagent/build.gradle.kts @@ -39,16 +39,26 @@ dependencies { latestDepTestLibrary("com.couchbase.client:java-client:3.1.5") // see couchbase-3.1.6 module } +testing { + suites { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + } + } + } + } + } +} + tasks { withType().configureEach { usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service) } - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - } - check { - dependsOn(testStableSemconv) + dependsOn(testing.suites) } } diff --git a/instrumentation/couchbase/couchbase-3.2/javaagent/build.gradle.kts b/instrumentation/couchbase/couchbase-3.2/javaagent/build.gradle.kts index 333fdbdcfced..08f2594eacc0 100644 --- a/instrumentation/couchbase/couchbase-3.2/javaagent/build.gradle.kts +++ b/instrumentation/couchbase/couchbase-3.2/javaagent/build.gradle.kts @@ -36,17 +36,27 @@ dependencies { testImplementation("org.testcontainers:couchbase") } +testing { + suites { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + } + } + } + } + } +} + tasks { withType().configureEach { systemProperty("testLatestDeps", findProperty("testLatestDeps") as Boolean) usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service) } - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - } - check { - dependsOn(testStableSemconv) + dependsOn(testing.suites) } } diff --git a/instrumentation/elasticsearch/elasticsearch-api-client-7.16/javaagent/build.gradle.kts b/instrumentation/elasticsearch/elasticsearch-api-client-7.16/javaagent/build.gradle.kts index 231579a5c1c9..d2ba58a8e3ec 100644 --- a/instrumentation/elasticsearch/elasticsearch-api-client-7.16/javaagent/build.gradle.kts +++ b/instrumentation/elasticsearch/elasticsearch-api-client-7.16/javaagent/build.gradle.kts @@ -70,6 +70,17 @@ testing { } } } + + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database") + } + } + } + } } } @@ -81,13 +92,7 @@ tasks { systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false") } - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database") - } - check { dependsOn(testing.suites) - dependsOn(testStableSemconv) } } diff --git a/instrumentation/elasticsearch/elasticsearch-rest-5.0/javaagent/build.gradle.kts b/instrumentation/elasticsearch/elasticsearch-rest-5.0/javaagent/build.gradle.kts index b0b0af1321c3..28c6c0686260 100644 --- a/instrumentation/elasticsearch/elasticsearch-rest-5.0/javaagent/build.gradle.kts +++ b/instrumentation/elasticsearch/elasticsearch-rest-5.0/javaagent/build.gradle.kts @@ -35,6 +35,21 @@ dependencies { latestDepTestLibrary("org.elasticsearch.client:elasticsearch-rest-client:6.3.+") // see elasticsearch-rest-6.4 module } +testing { + suites { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database") + } + } + } + } + } +} + tasks { withType().configureEach { systemProperty("testLatestDeps", findProperty("testLatestDeps") as Boolean) @@ -43,12 +58,7 @@ tasks { systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false") } - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database") - } - check { - dependsOn(testStableSemconv) + dependsOn(testing.suites) } } diff --git a/instrumentation/elasticsearch/elasticsearch-rest-6.4/javaagent/build.gradle.kts b/instrumentation/elasticsearch/elasticsearch-rest-6.4/javaagent/build.gradle.kts index 1e53d35d09f0..1944cff02e07 100644 --- a/instrumentation/elasticsearch/elasticsearch-rest-6.4/javaagent/build.gradle.kts +++ b/instrumentation/elasticsearch/elasticsearch-rest-6.4/javaagent/build.gradle.kts @@ -35,18 +35,28 @@ dependencies { latestDepTestLibrary("org.elasticsearch.client:elasticsearch-rest-client:6.+") // see elasticsearch-rest-7.0 module } +testing { + suites { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database") + } + } + } + } + } +} + tasks { withType().configureEach { usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service) systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false") } - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database") - } - check { - dependsOn(testStableSemconv) + dependsOn(testing.suites) } } diff --git a/instrumentation/elasticsearch/elasticsearch-rest-7.0/javaagent/build.gradle.kts b/instrumentation/elasticsearch/elasticsearch-rest-7.0/javaagent/build.gradle.kts index 992f5c71e582..df312461fef3 100644 --- a/instrumentation/elasticsearch/elasticsearch-rest-7.0/javaagent/build.gradle.kts +++ b/instrumentation/elasticsearch/elasticsearch-rest-7.0/javaagent/build.gradle.kts @@ -38,6 +38,21 @@ dependencies { testImplementation("org.testcontainers:elasticsearch") } +testing { + suites { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database") + } + } + } + } + } +} + tasks { withType().configureEach { systemProperty("testLatestDeps", findProperty("testLatestDeps") as Boolean) @@ -46,12 +61,7 @@ tasks { systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false") } - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database") - } - check { - dependsOn(testStableSemconv) + dependsOn(testing.suites) } } diff --git a/instrumentation/elasticsearch/elasticsearch-transport-5.0/javaagent/build.gradle.kts b/instrumentation/elasticsearch/elasticsearch-transport-5.0/javaagent/build.gradle.kts index df0e3a7d4f36..3b63620de047 100644 --- a/instrumentation/elasticsearch/elasticsearch-transport-5.0/javaagent/build.gradle.kts +++ b/instrumentation/elasticsearch/elasticsearch-transport-5.0/javaagent/build.gradle.kts @@ -49,6 +49,32 @@ dependencies { latestDepTestLibrary("org.elasticsearch.client:transport:5.2.+") // see elasticsearch-transport-5.3 module } +testing { + suites { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database") + } + } + } + } + + val testExperimental by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.instrumentation.elasticsearch.experimental-span-attributes=true") + systemProperty("metadataConfig", "otel.instrumentation.elasticsearch.experimental-span-attributes=true") + } + } + } + } + } +} + tasks { withType().configureEach { // required on jdk17 @@ -57,17 +83,7 @@ tasks { systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false") } - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database") - } - - val testExperimental by registering(Test::class) { - jvmArgs("-Dotel.instrumentation.elasticsearch.experimental-span-attributes=true") - systemProperty("metadataConfig", "otel.instrumentation.elasticsearch.experimental-span-attributes=true") - } - check { - dependsOn(testStableSemconv, testExperimental) + dependsOn(testing.suites) } } diff --git a/instrumentation/elasticsearch/elasticsearch-transport-5.3/javaagent/build.gradle.kts b/instrumentation/elasticsearch/elasticsearch-transport-5.3/javaagent/build.gradle.kts index 33473220b647..f233caf54262 100644 --- a/instrumentation/elasticsearch/elasticsearch-transport-5.3/javaagent/build.gradle.kts +++ b/instrumentation/elasticsearch/elasticsearch-transport-5.3/javaagent/build.gradle.kts @@ -65,6 +65,32 @@ dependencies { latestDepTestLibrary("org.springframework.data:spring-data-elasticsearch:3.0.+") // see elasticsearch-transport-6.0 module } +testing { + suites { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database,code") + systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database") + } + } + } + } + + val testExperimental by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.instrumentation.elasticsearch.experimental-span-attributes=true") + systemProperty("metadataConfig", "otel.instrumentation.elasticsearch.experimental-span-attributes=true") + } + } + } + } + } +} + tasks { withType().configureEach { systemProperty("testLatestDeps", findProperty("testLatestDeps") as Boolean) @@ -76,17 +102,7 @@ tasks { systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false") } - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database,code") - systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database") - } - - val testExperimental by registering(Test::class) { - jvmArgs("-Dotel.instrumentation.elasticsearch.experimental-span-attributes=true") - systemProperty("metadataConfig", "otel.instrumentation.elasticsearch.experimental-span-attributes=true") - } - check { - dependsOn(testStableSemconv, testExperimental) + dependsOn(testing.suites) } } diff --git a/instrumentation/external-annotations/javaagent/build.gradle.kts b/instrumentation/external-annotations/javaagent/build.gradle.kts index 40241cf2c0ed..5e31e055aa11 100644 --- a/instrumentation/external-annotations/javaagent/build.gradle.kts +++ b/instrumentation/external-annotations/javaagent/build.gradle.kts @@ -34,25 +34,41 @@ dependencies { testCompileOnly("org.springframework:spring-core:4.3.30.RELEASE") } -tasks { - val testIncludeProperty by registering(Test::class) { - filter { - includeTestsMatching("ConfiguredTraceAnnotationsTest") +testing { + suites { + val testIncludeProperty by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + filter { + includeTestsMatching("ConfiguredTraceAnnotationsTest") + } + include("**/ConfiguredTraceAnnotationsTest.*") + jvmArgs("-Dotel.instrumentation.external-annotations.include=io.opentelemetry.javaagent.instrumentation.extannotations.OuterClass\$InterestingMethod") + } + } + } } - include("**/ConfiguredTraceAnnotationsTest.*") - jvmArgs("-Dotel.instrumentation.external-annotations.include=io.opentelemetry.javaagent.instrumentation.extannotations.OuterClass\$InterestingMethod") - } - val testExcludeMethodsProperty by registering(Test::class) { - filter { - includeTestsMatching("TracedMethodsExclusionTest") + val testExcludeMethodsProperty by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + filter { + includeTestsMatching("TracedMethodsExclusionTest") + } + include("**/TracedMethodsExclusionTest.*") + jvmArgs( + "-Dotel.instrumentation.external-annotations.exclude-methods=io.opentelemetry.javaagent.instrumentation.extannotations.TracedMethodsExclusionTest\$TestClass[excluded,annotatedButExcluded]" + ) + } + } + } } - include("**/TracedMethodsExclusionTest.*") - jvmArgs( - "-Dotel.instrumentation.external-annotations.exclude-methods=io.opentelemetry.javaagent.instrumentation.extannotations.TracedMethodsExclusionTest\$TestClass[excluded,annotatedButExcluded]" - ) } +} +tasks { test { filter { excludeTestsMatching("ConfiguredTraceAnnotationsTest") @@ -61,7 +77,6 @@ tasks { } check { - dependsOn(testIncludeProperty) - dependsOn(testExcludeMethodsProperty) + dependsOn(testing.suites) } } diff --git a/instrumentation/geode-1.4/javaagent/build.gradle.kts b/instrumentation/geode-1.4/javaagent/build.gradle.kts index 2367a9385f30..7b615208021d 100644 --- a/instrumentation/geode-1.4/javaagent/build.gradle.kts +++ b/instrumentation/geode-1.4/javaagent/build.gradle.kts @@ -19,19 +19,28 @@ dependencies { val collectMetadata = findProperty("collectMetadata")?.toString() ?: "false" -tasks { - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - - systemProperty("collectMetadata", collectMetadata) - systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database") +testing { + suites { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + systemProperty("collectMetadata", collectMetadata) + systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database") + } + } + } + } } +} +tasks { test { systemProperty("collectMetadata", collectMetadata) } check { - dependsOn(testStableSemconv) + dependsOn(testing.suites) } } diff --git a/instrumentation/graphql-java/graphql-java-20.0/javaagent/build.gradle.kts b/instrumentation/graphql-java/graphql-java-20.0/javaagent/build.gradle.kts index 12c0823a144a..fd8a66a0f6eb 100644 --- a/instrumentation/graphql-java/graphql-java-20.0/javaagent/build.gradle.kts +++ b/instrumentation/graphql-java/graphql-java-20.0/javaagent/build.gradle.kts @@ -23,19 +23,29 @@ dependencies { testImplementation(project(":instrumentation:graphql-java:graphql-java-common:testing")) } +testing { + suites { + val testDataFetcher by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.instrumentation.graphql.data-fetcher.enabled=true") + systemProperty("metadataConfig", "otel.instrumentation.graphql.data-fetcher.enabled=true") + } + } + } + } + } +} + tasks { withType().configureEach { jvmArgs("-Dotel.instrumentation.graphql.add-operation-name-to-span-name.enabled=true") systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false") } - val testDataFetcher by registering(Test::class) { - jvmArgs("-Dotel.instrumentation.graphql.data-fetcher.enabled=true") - systemProperty("metadataConfig", "otel.instrumentation.graphql.data-fetcher.enabled=true") - } - check { - dependsOn(testDataFetcher) + dependsOn(testing.suites) } } diff --git a/instrumentation/guava-10.0/javaagent/build.gradle.kts b/instrumentation/guava-10.0/javaagent/build.gradle.kts index 1dd1aa52d4b6..10cb75f3920f 100644 --- a/instrumentation/guava-10.0/javaagent/build.gradle.kts +++ b/instrumentation/guava-10.0/javaagent/build.gradle.kts @@ -32,18 +32,32 @@ dependencies { testImplementation("io.opentelemetry:opentelemetry-extension-annotations") } -tasks { - - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=code") - } - - val testBothSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=code/dup") +testing { + suites { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=code") + } + } + } + } + + val testBothSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=code/dup") + } + } + } + } } +} +tasks { check { - dependsOn(testStableSemconv) - dependsOn(testBothSemconv) + dependsOn(testing.suites) } } diff --git a/instrumentation/hibernate/hibernate-3.3/javaagent/build.gradle.kts b/instrumentation/hibernate/hibernate-3.3/javaagent/build.gradle.kts index f46f2d1bf8ec..404a97d538cb 100644 --- a/instrumentation/hibernate/hibernate-3.3/javaagent/build.gradle.kts +++ b/instrumentation/hibernate/hibernate-3.3/javaagent/build.gradle.kts @@ -48,6 +48,20 @@ if (findProperty("testLatestDeps") as Boolean) { } } +testing { + suites { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + } + } + } + } + } +} + tasks { withType().configureEach { // TODO run tests both with and without experimental span attributes @@ -57,11 +71,7 @@ tasks { jvmArgs("-XX:+IgnoreUnrecognizedVMOptions") } - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - } - check { - dependsOn(testStableSemconv) + dependsOn(testing.suites) } } diff --git a/instrumentation/hibernate/hibernate-4.0/javaagent/build.gradle.kts b/instrumentation/hibernate/hibernate-4.0/javaagent/build.gradle.kts index aa70c11f7a09..e2513ad662c6 100644 --- a/instrumentation/hibernate/hibernate-4.0/javaagent/build.gradle.kts +++ b/instrumentation/hibernate/hibernate-4.0/javaagent/build.gradle.kts @@ -68,6 +68,16 @@ testing { } } } + + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + } + } + } + } } } @@ -84,12 +94,7 @@ tasks { jvmArgs("-Dotel.instrumentation.common.experimental.controller-telemetry.enabled=true") } - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - } - check { dependsOn(testing.suites) - dependsOn(testStableSemconv) } } diff --git a/instrumentation/hibernate/hibernate-6.0/javaagent/build.gradle.kts b/instrumentation/hibernate/hibernate-6.0/javaagent/build.gradle.kts index e55b3d811672..0f4e63a66cce 100644 --- a/instrumentation/hibernate/hibernate-6.0/javaagent/build.gradle.kts +++ b/instrumentation/hibernate/hibernate-6.0/javaagent/build.gradle.kts @@ -62,6 +62,16 @@ testing { } } } + + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + } + } + } + } } } @@ -83,12 +93,7 @@ tasks { } } - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - } - check { - dependsOn(testStableSemconv) dependsOn(testing.suites) } } diff --git a/instrumentation/hibernate/hibernate-6.0/spring-testing/build.gradle.kts b/instrumentation/hibernate/hibernate-6.0/spring-testing/build.gradle.kts index 4a00fb6e5a56..d1a7e48ebb63 100644 --- a/instrumentation/hibernate/hibernate-6.0/spring-testing/build.gradle.kts +++ b/instrumentation/hibernate/hibernate-6.0/spring-testing/build.gradle.kts @@ -24,6 +24,20 @@ otelJava { minJavaVersionSupported.set(JavaVersion.VERSION_17) } +testing { + suites { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + } + } + } + } + } +} + tasks { withType().configureEach { jvmArgs("-javaagent:" + springAgent.singleFile.absolutePath) @@ -34,11 +48,7 @@ tasks { jvmArgs("-Dotel.instrumentation.common.experimental.controller-telemetry.enabled=true") } - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - } - check { - dependsOn(testStableSemconv) + dependsOn(testing.suites) } } diff --git a/instrumentation/hibernate/hibernate-procedure-call-4.3/javaagent/build.gradle.kts b/instrumentation/hibernate/hibernate-procedure-call-4.3/javaagent/build.gradle.kts index dbf4fd8ee5da..948f0b5fa23b 100644 --- a/instrumentation/hibernate/hibernate-procedure-call-4.3/javaagent/build.gradle.kts +++ b/instrumentation/hibernate/hibernate-procedure-call-4.3/javaagent/build.gradle.kts @@ -31,17 +31,27 @@ dependencies { latestDepTestLibrary("org.hibernate:hibernate-entitymanager:5.+") // documented limitation } +testing { + suites { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + } + } + } + } + } +} + tasks { withType().configureEach { // TODO run tests both with and without experimental span attributes jvmArgs("-Dotel.instrumentation.hibernate.experimental-span-attributes=true") } - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - } - check { - dependsOn(testStableSemconv) + dependsOn(testing.suites) } } diff --git a/instrumentation/hibernate/hibernate-reactive-1.0/javaagent/build.gradle.kts b/instrumentation/hibernate/hibernate-reactive-1.0/javaagent/build.gradle.kts index 8e60b78a15f3..eb56e53288f0 100644 --- a/instrumentation/hibernate/hibernate-reactive-1.0/javaagent/build.gradle.kts +++ b/instrumentation/hibernate/hibernate-reactive-1.0/javaagent/build.gradle.kts @@ -72,6 +72,16 @@ testing { compileOnly("io.vertx:vertx-codegen:4.4.2") } } + + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + } + } + } + } } } @@ -104,13 +114,8 @@ tasks { } } - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - } - check { dependsOn(testing.suites) - dependsOn(testStableSemconv) } } diff --git a/instrumentation/hikaricp-3.0/javaagent/build.gradle.kts b/instrumentation/hikaricp-3.0/javaagent/build.gradle.kts index 2ed1ce77f193..40ea6d8786c3 100644 --- a/instrumentation/hikaricp-3.0/javaagent/build.gradle.kts +++ b/instrumentation/hikaricp-3.0/javaagent/build.gradle.kts @@ -24,19 +24,28 @@ dependencies { val collectMetadata = findProperty("collectMetadata")?.toString() ?: "false" -tasks { - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - - systemProperty("collectMetadata", collectMetadata) - systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database") +testing { + suites { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + systemProperty("collectMetadata", collectMetadata) + systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database") + } + } + } + } } +} +tasks { test { systemProperty("collectMetadata", collectMetadata) } check { - dependsOn(testStableSemconv) + dependsOn(testing.suites) } } diff --git a/instrumentation/hikaricp-3.0/library/build.gradle.kts b/instrumentation/hikaricp-3.0/library/build.gradle.kts index 73fda349d202..4de9c1dbacb7 100644 --- a/instrumentation/hikaricp-3.0/library/build.gradle.kts +++ b/instrumentation/hikaricp-3.0/library/build.gradle.kts @@ -9,12 +9,22 @@ dependencies { testImplementation(project(":instrumentation:hikaricp-3.0:testing")) } -tasks { - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") +testing { + suites { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + } + } + } + } } +} +tasks { check { - dependsOn(testStableSemconv) + dependsOn(testing.suites) } } diff --git a/instrumentation/influxdb-2.4/javaagent/build.gradle.kts b/instrumentation/influxdb-2.4/javaagent/build.gradle.kts index 04909adbc594..4d2c924468f2 100644 --- a/instrumentation/influxdb-2.4/javaagent/build.gradle.kts +++ b/instrumentation/influxdb-2.4/javaagent/build.gradle.kts @@ -32,6 +32,16 @@ testing { implementation("org.testcontainers:testcontainers") } } + + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + } + } + } + } } } @@ -49,11 +59,7 @@ tasks { } } - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - } - check { - dependsOn(testStableSemconv) + dependsOn(testing.suites) } } diff --git a/instrumentation/jdbc/javaagent/build.gradle.kts b/instrumentation/jdbc/javaagent/build.gradle.kts index 894616e9cf9e..1798a74b716d 100644 --- a/instrumentation/jdbc/javaagent/build.gradle.kts +++ b/instrumentation/jdbc/javaagent/build.gradle.kts @@ -54,51 +54,76 @@ sourceSets { } } -tasks { - val testSlick by registering(Test::class) { - filter { - includeTestsMatching("SlickTest") +testing { + suites { + val testSlick by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + filter { + includeTestsMatching("SlickTest") + } + include("**/SlickTest.*") + } + } + } } - include("**/SlickTest.*") - } - test { - filter { - excludeTestsMatching("SlickTest") - excludeTestsMatching("PreparedStatementParametersTest") + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + filter { + excludeTestsMatching("SlickTest") + excludeTestsMatching("PreparedStatementParametersTest") + } + jvmArgs("-Dotel.instrumentation.jdbc-datasource.enabled=true") + jvmArgs("-Dotel.semconv-stability.opt-in=database") + } + } + } } - jvmArgs("-Dotel.instrumentation.jdbc-datasource.enabled=true") - } - val testStableSemconv by registering(Test::class) { - filter { - excludeTestsMatching("SlickTest") - excludeTestsMatching("PreparedStatementParametersTest") + val testSlickStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + filter { + includeTestsMatching("SlickTest") + } + include("**/SlickTest.*") + jvmArgs("-Dotel.semconv-stability.opt-in=database") + } + } + } } - jvmArgs("-Dotel.instrumentation.jdbc-datasource.enabled=true") - jvmArgs("-Dotel.semconv-stability.opt-in=database") - } - val testSlickStableSemconv by registering(Test::class) { - filter { - includeTestsMatching("SlickTest") + val testCaptureParameters by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + filter { + includeTestsMatching("PreparedStatementParametersTest") + } + jvmArgs("-Dotel.instrumentation.jdbc.experimental.capture-query-parameters=true") + } + } + } } - include("**/SlickTest.*") - jvmArgs("-Dotel.semconv-stability.opt-in=database") } +} - val testCaptureParameters by registering(Test::class) { +tasks { + test { filter { - includeTestsMatching("PreparedStatementParametersTest") + excludeTestsMatching("SlickTest") + excludeTestsMatching("PreparedStatementParametersTest") } - jvmArgs("-Dotel.instrumentation.jdbc.experimental.capture-query-parameters=true") + jvmArgs("-Dotel.instrumentation.jdbc-datasource.enabled=true") } check { - dependsOn(testSlick) - dependsOn(testStableSemconv) - dependsOn(testSlickStableSemconv) - dependsOn(testCaptureParameters) + dependsOn(testing.suites) } } diff --git a/instrumentation/jdbc/library/build.gradle.kts b/instrumentation/jdbc/library/build.gradle.kts index 03e0f372c10d..dd3e7e1d0eb0 100644 --- a/instrumentation/jdbc/library/build.gradle.kts +++ b/instrumentation/jdbc/library/build.gradle.kts @@ -15,6 +15,20 @@ dependencies { testImplementation(project(":instrumentation:jdbc:testing")) } +testing { + suites { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + } + } + } + } + } +} + tasks { // We cannot use "--release" javac option here because that will forbid using apis that were added // in later versions. In JDBC wrappers we wish to implement delegation for methods that are not @@ -51,12 +65,8 @@ tasks { include("io/opentelemetry/javaagent/bootstrap/**") } - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - } - check { - dependsOn(testStableSemconv) + dependsOn(testing.suites) } } diff --git a/instrumentation/jedis/jedis-1.4/javaagent/build.gradle.kts b/instrumentation/jedis/jedis-1.4/javaagent/build.gradle.kts index 22293482fb0a..10a86906362a 100644 --- a/instrumentation/jedis/jedis-1.4/javaagent/build.gradle.kts +++ b/instrumentation/jedis/jedis-1.4/javaagent/build.gradle.kts @@ -35,6 +35,16 @@ testing { implementation(project(":instrumentation:jedis:jedis-1.4:testing")) } } + + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + } + } + } + } } } @@ -43,12 +53,7 @@ tasks { usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service) } - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - } - check { dependsOn(testing.suites) - dependsOn(testStableSemconv) } } diff --git a/instrumentation/jedis/jedis-3.0/javaagent/build.gradle.kts b/instrumentation/jedis/jedis-3.0/javaagent/build.gradle.kts index 532a471e280b..323924da13d4 100644 --- a/instrumentation/jedis/jedis-3.0/javaagent/build.gradle.kts +++ b/instrumentation/jedis/jedis-3.0/javaagent/build.gradle.kts @@ -28,16 +28,26 @@ dependencies { latestDepTestLibrary("redis.clients:jedis:3.+") // see jedis-4.0 module } +testing { + suites { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + } + } + } + } + } +} + tasks { withType().configureEach { usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service) } - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - } - check { - dependsOn(testStableSemconv) + dependsOn(testing.suites) } } diff --git a/instrumentation/jedis/jedis-4.0/javaagent/build.gradle.kts b/instrumentation/jedis/jedis-4.0/javaagent/build.gradle.kts index 01afcaa36f52..12f7f754dfd3 100644 --- a/instrumentation/jedis/jedis-4.0/javaagent/build.gradle.kts +++ b/instrumentation/jedis/jedis-4.0/javaagent/build.gradle.kts @@ -24,6 +24,20 @@ dependencies { testInstrumentation(project(":instrumentation:jedis:jedis-3.0:javaagent")) } +testing { + suites { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + } + } + } + } + } +} + tasks { withType().configureEach { // latest dep test fails because peer ip is 0:0:0:0:0:0:0:1 instead of 127.0.0.1 @@ -31,11 +45,7 @@ tasks { usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service) } - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - } - check { - dependsOn(testStableSemconv) + dependsOn(testing.suites) } } diff --git a/instrumentation/jms/jms-1.1/javaagent/build.gradle.kts b/instrumentation/jms/jms-1.1/javaagent/build.gradle.kts index 8c769fd89f04..b19737506f65 100644 --- a/instrumentation/jms/jms-1.1/javaagent/build.gradle.kts +++ b/instrumentation/jms/jms-1.1/javaagent/build.gradle.kts @@ -45,6 +45,19 @@ testing { } } } + + val testReceiveSpansDisabled by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + filter { + includeTestsMatching("Jms1SuppressReceiveSpansTest") + } + include("**/Jms1SuppressReceiveSpansTest.*") + } + } + } + } } } @@ -53,13 +66,6 @@ tasks { usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service) } - val testReceiveSpansDisabled by registering(Test::class) { - filter { - includeTestsMatching("Jms1SuppressReceiveSpansTest") - } - include("**/Jms1SuppressReceiveSpansTest.*") - } - test { filter { excludeTestsMatching("Jms1SuppressReceiveSpansTest") @@ -69,7 +75,6 @@ tasks { check { dependsOn(testing.suites) - dependsOn(testReceiveSpansDisabled) } } diff --git a/instrumentation/jms/jms-3.0/javaagent/build.gradle.kts b/instrumentation/jms/jms-3.0/javaagent/build.gradle.kts index d52b6ce0be57..7295ffc65821 100644 --- a/instrumentation/jms/jms-3.0/javaagent/build.gradle.kts +++ b/instrumentation/jms/jms-3.0/javaagent/build.gradle.kts @@ -29,6 +29,23 @@ dependencies { testImplementation("org.apache.activemq:artemis-jakarta-client:2.27.1") } +testing { + suites { + val testReceiveSpansDisabled by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + filter { + includeTestsMatching("Jms3SuppressReceiveSpansTest") + } + include("**/Jms3SuppressReceiveSpansTest.*") + } + } + } + } + } +} + otelJava { minJavaVersionSupported.set(JavaVersion.VERSION_11) } @@ -38,13 +55,6 @@ tasks { usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service) } - val testReceiveSpansDisabled by registering(Test::class) { - filter { - includeTestsMatching("Jms3SuppressReceiveSpansTest") - } - include("**/Jms3SuppressReceiveSpansTest.*") - } - test { filter { excludeTestsMatching("Jms3SuppressReceiveSpansTest") @@ -53,6 +63,6 @@ tasks { } check { - dependsOn(testReceiveSpansDisabled) + dependsOn(testing.suites) } } diff --git a/instrumentation/kafka/kafka-clients/kafka-clients-0.11/javaagent/build.gradle.kts b/instrumentation/kafka/kafka-clients/kafka-clients-0.11/javaagent/build.gradle.kts index 96b8a675cc73..3ced86727f68 100644 --- a/instrumentation/kafka/kafka-clients/kafka-clients-0.11/javaagent/build.gradle.kts +++ b/instrumentation/kafka/kafka-clients/kafka-clients-0.11/javaagent/build.gradle.kts @@ -25,6 +25,37 @@ dependencies { testImplementation(project(":instrumentation:kafka:kafka-clients:kafka-clients-0.11:testing")) } +testing { + suites { + val testPropagationDisabled by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + filter { + includeTestsMatching("KafkaClientPropagationDisabledTest") + } + include("**/KafkaClientPropagationDisabledTest.*") + jvmArgs("-Dotel.instrumentation.kafka.producer-propagation.enabled=false") + } + } + } + } + + val testReceiveSpansDisabled by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + filter { + includeTestsMatching("KafkaClientSuppressReceiveSpansTest") + } + include("**/KafkaClientSuppressReceiveSpansTest.*") + } + } + } + } + } +} + tasks { withType().configureEach { usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service) @@ -35,21 +66,6 @@ tasks { jvmArgs("-Dotel.instrumentation.kafka.experimental-span-attributes=true") } - val testPropagationDisabled by registering(Test::class) { - filter { - includeTestsMatching("KafkaClientPropagationDisabledTest") - } - include("**/KafkaClientPropagationDisabledTest.*") - jvmArgs("-Dotel.instrumentation.kafka.producer-propagation.enabled=false") - } - - val testReceiveSpansDisabled by registering(Test::class) { - filter { - includeTestsMatching("KafkaClientSuppressReceiveSpansTest") - } - include("**/KafkaClientSuppressReceiveSpansTest.*") - } - test { filter { excludeTestsMatching("KafkaClientPropagationDisabledTest") @@ -59,7 +75,6 @@ tasks { } check { - dependsOn(testPropagationDisabled) - dependsOn(testReceiveSpansDisabled) + dependsOn(testing.suites) } } diff --git a/instrumentation/kafka/kafka-clients/kafka-clients-2.6/library/build.gradle.kts b/instrumentation/kafka/kafka-clients/kafka-clients-2.6/library/build.gradle.kts index b3d3a24ec8a8..8e4469bc0251 100644 --- a/instrumentation/kafka/kafka-clients/kafka-clients-2.6/library/build.gradle.kts +++ b/instrumentation/kafka/kafka-clients/kafka-clients-2.6/library/build.gradle.kts @@ -16,20 +16,30 @@ dependencies { testAnnotationProcessor("com.google.auto.value:auto-value") } +testing { + suites { + val testReceiveSpansDisabled by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + filter { + includeTestsMatching("InterceptorsSuppressReceiveSpansTest") + includeTestsMatching("WrapperSuppressReceiveSpansTest") + } + include("**/InterceptorsSuppressReceiveSpansTest.*", "**/WrapperSuppressReceiveSpansTest.*") + } + } + } + } + } +} + tasks { withType().configureEach { usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service) systemProperty("testLatestDeps", findProperty("testLatestDeps") as Boolean) } - val testReceiveSpansDisabled by registering(Test::class) { - filter { - includeTestsMatching("InterceptorsSuppressReceiveSpansTest") - includeTestsMatching("WrapperSuppressReceiveSpansTest") - } - include("**/InterceptorsSuppressReceiveSpansTest.*", "**/WrapperSuppressReceiveSpansTest.*") - } - test { filter { excludeTestsMatching("InterceptorsSuppressReceiveSpansTest") @@ -40,6 +50,6 @@ tasks { } check { - dependsOn(testReceiveSpansDisabled) + dependsOn(testing.suites) } } diff --git a/instrumentation/kafka/kafka-streams-0.11/javaagent/build.gradle.kts b/instrumentation/kafka/kafka-streams-0.11/javaagent/build.gradle.kts index 9483d0527bd1..cf5667447642 100644 --- a/instrumentation/kafka/kafka-streams-0.11/javaagent/build.gradle.kts +++ b/instrumentation/kafka/kafka-streams-0.11/javaagent/build.gradle.kts @@ -23,6 +23,23 @@ dependencies { testImplementation("org.testcontainers:kafka") } +testing { + suites { + val testReceiveSpansDisabled by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + filter { + includeTestsMatching("KafkaStreamsSuppressReceiveSpansTest") + } + include("**/KafkaStreamsSuppressReceiveSpansTest.*") + } + } + } + } + } +} + tasks { withType().configureEach { usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service) @@ -33,13 +50,6 @@ tasks { jvmArgs("-Dotel.instrumentation.kafka.experimental-span-attributes=true") } - val testReceiveSpansDisabled by registering(Test::class) { - filter { - includeTestsMatching("KafkaStreamsSuppressReceiveSpansTest") - } - include("**/KafkaStreamsSuppressReceiveSpansTest.*") - } - test { filter { excludeTestsMatching("KafkaStreamsSuppressReceiveSpansTest") @@ -48,6 +58,6 @@ tasks { } check { - dependsOn(testReceiveSpansDisabled) + dependsOn(testing.suites) } } diff --git a/instrumentation/lettuce/lettuce-4.0/javaagent/build.gradle.kts b/instrumentation/lettuce/lettuce-4.0/javaagent/build.gradle.kts index 97a05becb7c4..0a6ddcb93a63 100644 --- a/instrumentation/lettuce/lettuce-4.0/javaagent/build.gradle.kts +++ b/instrumentation/lettuce/lettuce-4.0/javaagent/build.gradle.kts @@ -17,6 +17,20 @@ dependencies { latestDepTestLibrary("biz.paluch.redis:lettuce:4.+") // see lettuce-5.0 module } +testing { + suites { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + } + } + } + } + } +} + tasks { withType().configureEach { // TODO run tests both with and without experimental span attributes @@ -25,11 +39,7 @@ tasks { usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service) } - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - } - check { - dependsOn(testStableSemconv) + dependsOn(testing.suites) } } diff --git a/instrumentation/lettuce/lettuce-5.0/javaagent/build.gradle.kts b/instrumentation/lettuce/lettuce-5.0/javaagent/build.gradle.kts index e9ac67e15dbc..890ab4b4eb94 100644 --- a/instrumentation/lettuce/lettuce-5.0/javaagent/build.gradle.kts +++ b/instrumentation/lettuce/lettuce-5.0/javaagent/build.gradle.kts @@ -24,6 +24,20 @@ dependencies { latestDepTestLibrary("io.lettuce:lettuce-core:5.0.+") // see lettuce-5.1 module } +testing { + suites { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + } + } + } + } + } +} + tasks { withType().configureEach { // TODO run tests both with and without experimental span attributes @@ -32,11 +46,7 @@ tasks { usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service) } - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - } - check { - dependsOn(testStableSemconv) + dependsOn(testing.suites) } } diff --git a/instrumentation/lettuce/lettuce-5.1/javaagent/build.gradle.kts b/instrumentation/lettuce/lettuce-5.1/javaagent/build.gradle.kts index 654a6172715d..ff9ff2cfedcc 100644 --- a/instrumentation/lettuce/lettuce-5.1/javaagent/build.gradle.kts +++ b/instrumentation/lettuce/lettuce-5.1/javaagent/build.gradle.kts @@ -23,17 +23,27 @@ dependencies { testInstrumentation(project(":instrumentation:reactor:reactor-3.1:javaagent")) } +testing { + suites { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + } + } + } + } + } +} + tasks { withType().configureEach { systemProperty("testLatestDeps", findProperty("testLatestDeps") as Boolean) usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service) } - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - } - check { - dependsOn(testStableSemconv) + dependsOn(testing.suites) } } diff --git a/instrumentation/lettuce/lettuce-5.1/library/build.gradle.kts b/instrumentation/lettuce/lettuce-5.1/library/build.gradle.kts index 1ea17a553d5d..79a61eb760fd 100644 --- a/instrumentation/lettuce/lettuce-5.1/library/build.gradle.kts +++ b/instrumentation/lettuce/lettuce-5.1/library/build.gradle.kts @@ -12,17 +12,27 @@ dependencies { testImplementation(project(":instrumentation:reactor:reactor-3.1:library")) } +testing { + suites { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + } + } + } + } + } +} + tasks { withType().configureEach { systemProperty("testLatestDeps", findProperty("testLatestDeps") as Boolean) usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service) } - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - } - check { - dependsOn(testStableSemconv) + dependsOn(testing.suites) } } diff --git a/instrumentation/log4j/log4j-appender-2.17/javaagent/build.gradle.kts b/instrumentation/log4j/log4j-appender-2.17/javaagent/build.gradle.kts index 23a8803c18b7..9bcc16c99cd3 100644 --- a/instrumentation/log4j/log4j-appender-2.17/javaagent/build.gradle.kts +++ b/instrumentation/log4j/log4j-appender-2.17/javaagent/build.gradle.kts @@ -45,13 +45,23 @@ tasks.withType().configureEach { systemProperty("testLatestDeps", testLatestDeps) } -tasks { - val testAsync by registering(Test::class) { - jvmArgs("-DLog4j2.contextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector") +testing { + suites { + val testAsync by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-DLog4j2.contextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector") + } + } + } + } } +} +tasks { check { - dependsOn(testAsync) + dependsOn(testing.suites) } } diff --git a/instrumentation/log4j/log4j-appender-2.17/library/build.gradle.kts b/instrumentation/log4j/log4j-appender-2.17/library/build.gradle.kts index e4aac90150d9..1bb4c588c9f2 100644 --- a/instrumentation/log4j/log4j-appender-2.17/library/build.gradle.kts +++ b/instrumentation/log4j/log4j-appender-2.17/library/build.gradle.kts @@ -17,27 +17,47 @@ dependencies { } } +testing { + suites { + val testAsyncLogger by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-DLog4j2.contextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector") + } + } + } + } + + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=code") + } + } + } + } + + val testBothSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=code/dup") + } + } + } + } + } +} + tasks { withType().configureEach { systemProperty("testLatestDeps", findProperty("testLatestDeps") as Boolean) jvmArgs("-Dotel.instrumentation.common.experimental.controller-telemetry.enabled=true") } - val testAsyncLogger by registering(Test::class) { - jvmArgs("-DLog4j2.contextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector") - } - - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=code") - } - - val testBothSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=code/dup") - } - check { - dependsOn(testAsyncLogger) - dependsOn(testStableSemconv) - dependsOn(testBothSemconv) + dependsOn(testing.suites) } } diff --git a/instrumentation/log4j/log4j-context-data/log4j-context-data-2.17/library-autoconfigure/build.gradle.kts b/instrumentation/log4j/log4j-context-data/log4j-context-data-2.17/library-autoconfigure/build.gradle.kts index b0f3d1a23c67..fb16efc3c51d 100644 --- a/instrumentation/log4j/log4j-context-data/log4j-context-data-2.17/library-autoconfigure/build.gradle.kts +++ b/instrumentation/log4j/log4j-context-data/log4j-context-data-2.17/library-autoconfigure/build.gradle.kts @@ -11,32 +11,47 @@ dependencies { testImplementation(project(":instrumentation:log4j:log4j-context-data:log4j-context-data-common:testing")) } -tasks { - test { - filter { - excludeTestsMatching("LibraryLog4j2BaggageTest") - excludeTestsMatching("LibraryLog4j2LoggingKeysTest") +testing { + suites { + val testAddBaggage by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + filter { + includeTestsMatching("LibraryLog4j2BaggageTest") + } + jvmArgs("-Dotel.instrumentation.log4j-context-data.add-baggage=true") + } + } + } } - } - val testAddBaggage by registering(Test::class) { - filter { - includeTestsMatching("LibraryLog4j2BaggageTest") + val testLoggingKeys by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + filter { + includeTestsMatching("LibraryLog4j2LoggingKeysTest") + } + jvmArgs("-Dotel.instrumentation.common.logging.trace-id=trace_id_test") + jvmArgs("-Dotel.instrumentation.common.logging.span-id=span_id_test") + jvmArgs("-Dotel.instrumentation.common.logging.trace-flags=trace_flags_test") + } + } + } } - jvmArgs("-Dotel.instrumentation.log4j-context-data.add-baggage=true") } +} - val testLoggingKeys by registering(Test::class) { +tasks { + test { filter { - includeTestsMatching("LibraryLog4j2LoggingKeysTest") + excludeTestsMatching("LibraryLog4j2BaggageTest") + excludeTestsMatching("LibraryLog4j2LoggingKeysTest") } - jvmArgs("-Dotel.instrumentation.common.logging.trace-id=trace_id_test") - jvmArgs("-Dotel.instrumentation.common.logging.span-id=span_id_test") - jvmArgs("-Dotel.instrumentation.common.logging.trace-flags=trace_flags_test") } named("check") { - dependsOn(testAddBaggage) - dependsOn(testLoggingKeys) + dependsOn(testing.suites) } } diff --git a/instrumentation/log4j/log4j-context-data/log4j-context-data-2.7/javaagent/build.gradle.kts b/instrumentation/log4j/log4j-context-data/log4j-context-data-2.7/javaagent/build.gradle.kts index 678322b8df6b..d2ccc1c9b609 100644 --- a/instrumentation/log4j/log4j-context-data/log4j-context-data-2.7/javaagent/build.gradle.kts +++ b/instrumentation/log4j/log4j-context-data/log4j-context-data-2.7/javaagent/build.gradle.kts @@ -21,33 +21,48 @@ dependencies { latestDepTestLibrary("org.apache.logging.log4j:log4j-core:2.16.+") // see log4j-context-data-2.17 module } -tasks { - test { - filter { - excludeTestsMatching("Log4j27BaggageTest") - excludeTestsMatching("Log4j27LoggingKeysTest") +testing { + suites { + val testAddBaggage by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + filter { + includeTestsMatching("Log4j27BaggageTest") + } + jvmArgs("-Dotel.instrumentation.log4j-context-data.add-baggage=true") + } + } + } } - jvmArgs("-Dotel.instrumentation.common.mdc.resource-attributes=service.name,telemetry.sdk.language") - } - val testAddBaggage by registering(Test::class) { - filter { - includeTestsMatching("Log4j27BaggageTest") + val testLoggingKeys by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + filter { + includeTestsMatching("Log4j27LoggingKeysTest") + } + jvmArgs("-Dotel.instrumentation.common.logging.trace-id=trace_id_test") + jvmArgs("-Dotel.instrumentation.common.logging.span-id=span_id_test") + jvmArgs("-Dotel.instrumentation.common.logging.trace-flags=trace_flags_test") + } + } + } } - jvmArgs("-Dotel.instrumentation.log4j-context-data.add-baggage=true") } +} - val testLoggingKeys by registering(Test::class) { +tasks { + test { filter { - includeTestsMatching("Log4j27LoggingKeysTest") + excludeTestsMatching("Log4j27BaggageTest") + excludeTestsMatching("Log4j27LoggingKeysTest") } - jvmArgs("-Dotel.instrumentation.common.logging.trace-id=trace_id_test") - jvmArgs("-Dotel.instrumentation.common.logging.span-id=span_id_test") - jvmArgs("-Dotel.instrumentation.common.logging.trace-flags=trace_flags_test") + jvmArgs("-Dotel.instrumentation.common.mdc.resource-attributes=service.name,telemetry.sdk.language") } named("check") { - dependsOn(testAddBaggage) - dependsOn(testLoggingKeys) + dependsOn(testing.suites) } } diff --git a/instrumentation/logback/logback-appender-1.0/library/build.gradle.kts b/instrumentation/logback/logback-appender-1.0/library/build.gradle.kts index fbc8cf09056a..c6d7dbe55bac 100644 --- a/instrumentation/logback/logback-appender-1.0/library/build.gradle.kts +++ b/instrumentation/logback/logback-appender-1.0/library/build.gradle.kts @@ -121,23 +121,33 @@ testing { } } } - } -} -tasks { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=code") + } + } + } + } - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=code") + val testBothSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=code/dup") + } + } + } + } } +} - val testBothSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=code/dup") - } +tasks { check { dependsOn(testing.suites) - dependsOn(testStableSemconv) - dependsOn(testBothSemconv) } } diff --git a/instrumentation/micrometer/micrometer-1.5/javaagent/build.gradle.kts b/instrumentation/micrometer/micrometer-1.5/javaagent/build.gradle.kts index 66ab5db32fdc..c7174bfecf3c 100644 --- a/instrumentation/micrometer/micrometer-1.5/javaagent/build.gradle.kts +++ b/instrumentation/micrometer/micrometer-1.5/javaagent/build.gradle.kts @@ -19,31 +19,53 @@ dependencies { testImplementation(project(":instrumentation:micrometer:micrometer-1.5:testing")) } -tasks { - val testPrometheusMode by registering(Test::class) { - filter { - includeTestsMatching("*PrometheusModeTest") +testing { + suites { + val testPrometheusMode by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + filter { + includeTestsMatching("*PrometheusModeTest") + } + include("**/*PrometheusModeTest.*") + jvmArgs("-Dotel.instrumentation.micrometer.prometheus-mode.enabled=true") + } + } + } } - include("**/*PrometheusModeTest.*") - jvmArgs("-Dotel.instrumentation.micrometer.prometheus-mode.enabled=true") - } - val testBaseTimeUnit by registering(Test::class) { - filter { - includeTestsMatching("*TimerMillisecondsTest") + val testBaseTimeUnit by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + filter { + includeTestsMatching("*TimerMillisecondsTest") + } + include("**/*TimerMillisecondsTest.*") + jvmArgs("-Dotel.instrumentation.micrometer.base-time-unit=milliseconds") + } + } + } } - include("**/*TimerMillisecondsTest.*") - jvmArgs("-Dotel.instrumentation.micrometer.base-time-unit=milliseconds") - } - val testHistogramGauges by registering(Test::class) { - filter { - includeTestsMatching("*HistogramGaugesTest") + val testHistogramGauges by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + filter { + includeTestsMatching("*HistogramGaugesTest") + } + include("**/*HistogramGaugesTest.*") + jvmArgs("-Dotel.instrumentation.micrometer.histogram-gauges.enabled=true") + } + } + } } - include("**/*HistogramGaugesTest.*") - jvmArgs("-Dotel.instrumentation.micrometer.histogram-gauges.enabled=true") } +} +tasks { test { filter { excludeTestsMatching("*TimerMillisecondsTest") @@ -53,9 +75,7 @@ tasks { } check { - dependsOn(testBaseTimeUnit) - dependsOn(testPrometheusMode) - dependsOn(testHistogramGauges) + dependsOn(testing.suites) } withType().configureEach { diff --git a/instrumentation/mongo/mongo-3.1/javaagent/build.gradle.kts b/instrumentation/mongo/mongo-3.1/javaagent/build.gradle.kts index 6d5716d02711..5ad0eb2b6faa 100644 --- a/instrumentation/mongo/mongo-3.1/javaagent/build.gradle.kts +++ b/instrumentation/mongo/mongo-3.1/javaagent/build.gradle.kts @@ -23,16 +23,26 @@ dependencies { testInstrumentation(project(":instrumentation:mongo:mongo-4.0:javaagent")) } +testing { + suites { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + } + } + } + } + } +} + tasks { withType().configureEach { usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service) } - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - } - check { - dependsOn(testStableSemconv) + dependsOn(testing.suites) } } diff --git a/instrumentation/mongo/mongo-3.1/library/build.gradle.kts b/instrumentation/mongo/mongo-3.1/library/build.gradle.kts index c0376f9c0f11..24b38f4f60d0 100644 --- a/instrumentation/mongo/mongo-3.1/library/build.gradle.kts +++ b/instrumentation/mongo/mongo-3.1/library/build.gradle.kts @@ -12,16 +12,26 @@ dependencies { testImplementation(project(":instrumentation:mongo:mongo-3.1:testing")) } +testing { + suites { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + } + } + } + } + } +} + tasks { withType().configureEach { usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service) } - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - } - check { - dependsOn(testStableSemconv) + dependsOn(testing.suites) } } diff --git a/instrumentation/mongo/mongo-3.7/javaagent/build.gradle.kts b/instrumentation/mongo/mongo-3.7/javaagent/build.gradle.kts index f6b3d3495eed..228534f3a67d 100644 --- a/instrumentation/mongo/mongo-3.7/javaagent/build.gradle.kts +++ b/instrumentation/mongo/mongo-3.7/javaagent/build.gradle.kts @@ -33,16 +33,26 @@ dependencies { testInstrumentation(project(":instrumentation:mongo:mongo-4.0:javaagent")) } +testing { + suites { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + } + } + } + } + } +} + tasks { withType().configureEach { usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service) } - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - } - check { - dependsOn(testStableSemconv) + dependsOn(testing.suites) } } diff --git a/instrumentation/mongo/mongo-4.0/javaagent/build.gradle.kts b/instrumentation/mongo/mongo-4.0/javaagent/build.gradle.kts index 969ed989247d..55e2e54048e6 100644 --- a/instrumentation/mongo/mongo-4.0/javaagent/build.gradle.kts +++ b/instrumentation/mongo/mongo-4.0/javaagent/build.gradle.kts @@ -29,16 +29,26 @@ dependencies { testInstrumentation(project(":instrumentation:mongo:mongo-3.7:javaagent")) } +testing { + suites { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + } + } + } + } + } +} + tasks { withType().configureEach { usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service) } - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - } - check { - dependsOn(testStableSemconv) + dependsOn(testing.suites) } } diff --git a/instrumentation/mongo/mongo-async-3.3/javaagent/build.gradle.kts b/instrumentation/mongo/mongo-async-3.3/javaagent/build.gradle.kts index d33c2ae01465..cfb88c02e4c0 100644 --- a/instrumentation/mongo/mongo-async-3.3/javaagent/build.gradle.kts +++ b/instrumentation/mongo/mongo-async-3.3/javaagent/build.gradle.kts @@ -24,16 +24,26 @@ dependencies { testInstrumentation(project(":instrumentation:mongo:mongo-4.0:javaagent")) } +testing { + suites { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + } + } + } + } + } +} + tasks { withType().configureEach { usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service) } - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - } - check { - dependsOn(testStableSemconv) + dependsOn(testing.suites) } } diff --git a/instrumentation/netty/netty-4.0/javaagent/build.gradle.kts b/instrumentation/netty/netty-4.0/javaagent/build.gradle.kts index ac89ed679b18..d96ebf442fc4 100644 --- a/instrumentation/netty/netty-4.0/javaagent/build.gradle.kts +++ b/instrumentation/netty/netty-4.0/javaagent/build.gradle.kts @@ -35,18 +35,27 @@ dependencies { latestDepTestLibrary("io.netty:netty-codec-http:4.0.+") // see netty-4.1 module } -tasks { - val testConnectionSpan by registering(Test::class) { - filter { - includeTestsMatching("Netty40ConnectionSpanTest") - includeTestsMatching("Netty40ClientSslTest") +testing { + suites { + val testConnectionSpan by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + filter { + includeTestsMatching("Netty40ConnectionSpanTest") + includeTestsMatching("Netty40ClientSslTest") + } + include("**/Netty40ConnectionSpanTest.*", "**/Netty40ClientSslTest.*") + jvmArgs("-Dotel.instrumentation.netty.connection-telemetry.enabled=true") + jvmArgs("-Dotel.instrumentation.netty.ssl-telemetry.enabled=true") + } + } + } } - include("**/Netty40ConnectionSpanTest.*", "**/Netty40ClientSslTest.*") - - jvmArgs("-Dotel.instrumentation.netty.connection-telemetry.enabled=true") - jvmArgs("-Dotel.instrumentation.netty.ssl-telemetry.enabled=true") } +} +tasks { test { systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false") @@ -57,7 +66,7 @@ tasks { } check { - dependsOn(testConnectionSpan) + dependsOn(testing.suites) } } diff --git a/instrumentation/netty/netty-4.1/javaagent/build.gradle.kts b/instrumentation/netty/netty-4.1/javaagent/build.gradle.kts index 048d21736923..f317a7f4c6db 100644 --- a/instrumentation/netty/netty-4.1/javaagent/build.gradle.kts +++ b/instrumentation/netty/netty-4.1/javaagent/build.gradle.kts @@ -42,18 +42,27 @@ dependencies { testCompileOnly("io.netty:netty-transport-native-kqueue:4.1.11.Final:osx-x86_64") } -tasks { - val testConnectionSpan by registering(Test::class) { - filter { - includeTestsMatching("Netty41ConnectionSpanTest") - includeTestsMatching("Netty41ClientSslTest") +testing { + suites { + val testConnectionSpan by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + filter { + includeTestsMatching("Netty41ConnectionSpanTest") + includeTestsMatching("Netty41ClientSslTest") + } + include("**/Netty41ConnectionSpanTest.*", "**/Netty41ClientSslTest.*") + jvmArgs("-Dotel.instrumentation.netty.connection-telemetry.enabled=true") + jvmArgs("-Dotel.instrumentation.netty.ssl-telemetry.enabled=true") + } + } + } } - include("**/Netty41ConnectionSpanTest.*", "**/Netty41ClientSslTest.*") - - jvmArgs("-Dotel.instrumentation.netty.connection-telemetry.enabled=true") - jvmArgs("-Dotel.instrumentation.netty.ssl-telemetry.enabled=true") } +} +tasks { test { systemProperty("testLatestDeps", findProperty("testLatestDeps") as Boolean) systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false") @@ -65,7 +74,7 @@ tasks { } check { - dependsOn(testConnectionSpan) + dependsOn(testing.suites) } } diff --git a/instrumentation/opensearch/opensearch-rest-1.0/javaagent/build.gradle.kts b/instrumentation/opensearch/opensearch-rest-1.0/javaagent/build.gradle.kts index d67ed6f01858..4ef485ec8f1b 100644 --- a/instrumentation/opensearch/opensearch-rest-1.0/javaagent/build.gradle.kts +++ b/instrumentation/opensearch/opensearch-rest-1.0/javaagent/build.gradle.kts @@ -39,16 +39,26 @@ dependencies { latestDepTestLibrary("org.opensearch.client:opensearch-rest-client:2.+") // see opensearch-rest-3.0 module } +testing { + suites { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + } + } + } + } + } +} + tasks { test { usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service) } - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - } - check { - dependsOn(testStableSemconv) + dependsOn(testing.suites) } } diff --git a/instrumentation/opensearch/opensearch-rest-3.0/javaagent/build.gradle.kts b/instrumentation/opensearch/opensearch-rest-3.0/javaagent/build.gradle.kts index 951deb88b4e9..57c49fe08b74 100644 --- a/instrumentation/opensearch/opensearch-rest-3.0/javaagent/build.gradle.kts +++ b/instrumentation/opensearch/opensearch-rest-3.0/javaagent/build.gradle.kts @@ -32,16 +32,26 @@ dependencies { testImplementation(project(":instrumentation:opensearch:opensearch-rest-common:testing")) } +testing { + suites { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + } + } + } + } + } +} + tasks { test { usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service) } - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - } - check { - dependsOn(testStableSemconv) + dependsOn(testing.suites) } } diff --git a/instrumentation/opentelemetry-instrumentation-api/javaagent/build.gradle.kts b/instrumentation/opentelemetry-instrumentation-api/javaagent/build.gradle.kts index 57a75a08004b..cb39f07e929c 100644 --- a/instrumentation/opentelemetry-instrumentation-api/javaagent/build.gradle.kts +++ b/instrumentation/opentelemetry-instrumentation-api/javaagent/build.gradle.kts @@ -41,6 +41,26 @@ testing { implementation(project(":instrumentation:opentelemetry-instrumentation-api:testing")) } } + + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=code") + } + } + } + } + + val testBothSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=code/dup") + } + } + } + } } } @@ -67,17 +87,7 @@ configurations.configureEach { tasks { - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=code") - } - - val testBothSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=code/dup") - } - check { dependsOn(testing.suites) - dependsOn(testStableSemconv) - dependsOn(testBothSemconv) } } diff --git a/instrumentation/oracle-ucp-11.2/javaagent/build.gradle.kts b/instrumentation/oracle-ucp-11.2/javaagent/build.gradle.kts index 9af1f2963c2b..adb2b57aad86 100644 --- a/instrumentation/oracle-ucp-11.2/javaagent/build.gradle.kts +++ b/instrumentation/oracle-ucp-11.2/javaagent/build.gradle.kts @@ -22,20 +22,29 @@ dependencies { val collectMetadata = findProperty("collectMetadata")?.toString() ?: "false" +testing { + suites { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + systemProperty("collectMetadata", collectMetadata) + systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database") + } + } + } + } + } +} + tasks { test { usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service) systemProperty("collectMetadata", collectMetadata) } - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - - systemProperty("collectMetadata", collectMetadata) - systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database") - } - check { - dependsOn(testStableSemconv) + dependsOn(testing.suites) } } diff --git a/instrumentation/oracle-ucp-11.2/library/build.gradle.kts b/instrumentation/oracle-ucp-11.2/library/build.gradle.kts index b9b6020e3e2d..c8faa16543fb 100644 --- a/instrumentation/oracle-ucp-11.2/library/build.gradle.kts +++ b/instrumentation/oracle-ucp-11.2/library/build.gradle.kts @@ -10,16 +10,26 @@ dependencies { testImplementation(project(":instrumentation:oracle-ucp-11.2:testing")) } +testing { + suites { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + } + } + } + } + } +} + tasks { test { usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service) } - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - } - check { - dependsOn(testStableSemconv) + dependsOn(testing.suites) } } diff --git a/instrumentation/oshi/javaagent/build.gradle.kts b/instrumentation/oshi/javaagent/build.gradle.kts index b8bf11ee38bd..564e16df464a 100644 --- a/instrumentation/oshi/javaagent/build.gradle.kts +++ b/instrumentation/oshi/javaagent/build.gradle.kts @@ -22,18 +22,28 @@ dependencies { testImplementation(project(":instrumentation:oshi:testing")) } +testing { + suites { + val testExperimental by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.instrumentation.oshi.experimental-metrics.enabled=true") + systemProperty("testExperimental", "true") + systemProperty("metadataConfig", "otel.instrumentation.oshi.experimental-metrics.enabled=true") + } + } + } + } + } +} + tasks { withType().configureEach { systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false") } - val testExperimental by registering(Test::class) { - jvmArgs("-Dotel.instrumentation.oshi.experimental-metrics.enabled=true") - systemProperty("testExperimental", "true") - systemProperty("metadataConfig", "otel.instrumentation.oshi.experimental-metrics.enabled=true") - } - check { - dependsOn(testExperimental) + dependsOn(testing.suites) } } diff --git a/instrumentation/pulsar/pulsar-2.8/javaagent/build.gradle.kts b/instrumentation/pulsar/pulsar-2.8/javaagent/build.gradle.kts index a0f01abb60b3..eda023403e6b 100644 --- a/instrumentation/pulsar/pulsar-2.8/javaagent/build.gradle.kts +++ b/instrumentation/pulsar/pulsar-2.8/javaagent/build.gradle.kts @@ -19,14 +19,24 @@ dependencies { testImplementation("org.apache.pulsar:pulsar-client-admin:2.8.0") } -tasks { - val testReceiveSpanDisabled by registering(Test::class) { - filter { - includeTestsMatching("PulsarClientSuppressReceiveSpansTest") +testing { + suites { + val testReceiveSpanDisabled by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + filter { + includeTestsMatching("PulsarClientSuppressReceiveSpansTest") + } + include("**/PulsarClientSuppressReceiveSpansTest.*") + } + } + } } - include("**/PulsarClientSuppressReceiveSpansTest.*") } +} +tasks { test { filter { excludeTestsMatching("PulsarClientSuppressReceiveSpansTest") @@ -35,7 +45,7 @@ tasks { } check { - dependsOn(testReceiveSpanDisabled) + dependsOn(testing.suites) } } diff --git a/instrumentation/r2dbc-1.0/javaagent/build.gradle.kts b/instrumentation/r2dbc-1.0/javaagent/build.gradle.kts index 6c80b8f7aa1c..6ad541ed8e1d 100644 --- a/instrumentation/r2dbc-1.0/javaagent/build.gradle.kts +++ b/instrumentation/r2dbc-1.0/javaagent/build.gradle.kts @@ -30,16 +30,26 @@ dependencies { testInstrumentation(project(":instrumentation:reactor:reactor-3.1:javaagent")) } +testing { + suites { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + } + } + } + } + } +} + tasks { withType().configureEach { usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service) } - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - } - check { - dependsOn(testStableSemconv) + dependsOn(testing.suites) } } diff --git a/instrumentation/r2dbc-1.0/library/build.gradle.kts b/instrumentation/r2dbc-1.0/library/build.gradle.kts index 729385252749..af66fb5dbe77 100644 --- a/instrumentation/r2dbc-1.0/library/build.gradle.kts +++ b/instrumentation/r2dbc-1.0/library/build.gradle.kts @@ -10,16 +10,26 @@ dependencies { testImplementation(project(":instrumentation:reactor:reactor-3.1:library")) } +testing { + suites { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + } + } + } + } + } +} + tasks { withType().configureEach { usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service) } - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - } - check { - dependsOn(testStableSemconv) + dependsOn(testing.suites) } } diff --git a/instrumentation/reactor/reactor-3.1/javaagent/build.gradle.kts b/instrumentation/reactor/reactor-3.1/javaagent/build.gradle.kts index 0fa3c63fd407..6c7a03cb85bd 100644 --- a/instrumentation/reactor/reactor-3.1/javaagent/build.gradle.kts +++ b/instrumentation/reactor/reactor-3.1/javaagent/build.gradle.kts @@ -53,22 +53,32 @@ testing { implementation("io.projectreactor:reactor-test:$version") } } - } -} -tasks { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=code") + } + } + } + } - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=code") + val testBothSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=code/dup") + } + } + } + } } +} - val testBothSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=code/dup") - } +tasks { check { dependsOn(testing.suites) - dependsOn(testStableSemconv) - dependsOn(testBothSemconv) } } diff --git a/instrumentation/reactor/reactor-netty/reactor-netty-0.9/javaagent/build.gradle.kts b/instrumentation/reactor/reactor-netty/reactor-netty-0.9/javaagent/build.gradle.kts index a5d9f62bc544..87e3337cdbd0 100644 --- a/instrumentation/reactor/reactor-netty/reactor-netty-0.9/javaagent/build.gradle.kts +++ b/instrumentation/reactor/reactor-netty/reactor-netty-0.9/javaagent/build.gradle.kts @@ -31,16 +31,26 @@ dependencies { latestDepTestLibrary("io.projectreactor.netty:reactor-netty:0.+") // see reactor-netty-1.0 modules } -tasks { - val testConnectionSpan by registering(Test::class) { - filter { - includeTestsMatching("ReactorNettyConnectionSpanTest") +testing { + suites { + val testConnectionSpan by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + filter { + includeTestsMatching("ReactorNettyConnectionSpanTest") + } + include("**/ReactorNettyConnectionSpanTest.*") + jvmArgs("-Dotel.instrumentation.netty.connection-telemetry.enabled=true") + jvmArgs("-Dotel.instrumentation.common.experimental.controller-telemetry.enabled=true") + } + } + } } - include("**/ReactorNettyConnectionSpanTest.*") - jvmArgs("-Dotel.instrumentation.netty.connection-telemetry.enabled=true") - jvmArgs("-Dotel.instrumentation.common.experimental.controller-telemetry.enabled=true") } +} +tasks { test { systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false") @@ -50,6 +60,6 @@ tasks { } check { - dependsOn(testConnectionSpan) + dependsOn(testing.suites) } } diff --git a/instrumentation/reactor/reactor-netty/reactor-netty-1.0/javaagent/build.gradle.kts b/instrumentation/reactor/reactor-netty/reactor-netty-1.0/javaagent/build.gradle.kts index c54a3abed42e..9458b6d2e18c 100644 --- a/instrumentation/reactor/reactor-netty/reactor-netty-1.0/javaagent/build.gradle.kts +++ b/instrumentation/reactor/reactor-netty/reactor-netty-1.0/javaagent/build.gradle.kts @@ -43,18 +43,28 @@ dependencies { testImplementation(project(":instrumentation-annotations")) } -tasks { - val testConnectionSpan by registering(Test::class) { - filter { - includeTestsMatching("ReactorNettyConnectionSpanTest") - includeTestsMatching("ReactorNettyClientSslTest") +testing { + suites { + val testConnectionSpan by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + filter { + includeTestsMatching("ReactorNettyConnectionSpanTest") + includeTestsMatching("ReactorNettyClientSslTest") + } + include("**/ReactorNettyConnectionSpanTest.*", "**/ReactorNettyClientSslTest.*") + jvmArgs("-Dotel.instrumentation.netty.ssl-telemetry.enabled=true") + jvmArgs("-Dotel.instrumentation.reactor-netty.connection-telemetry.enabled=true") + jvmArgs("-Dotel.instrumentation.common.experimental.controller-telemetry.enabled=true") + } + } + } } - include("**/ReactorNettyConnectionSpanTest.*", "**/ReactorNettyClientSslTest.*") - jvmArgs("-Dotel.instrumentation.netty.ssl-telemetry.enabled=true") - jvmArgs("-Dotel.instrumentation.reactor-netty.connection-telemetry.enabled=true") - jvmArgs("-Dotel.instrumentation.common.experimental.controller-telemetry.enabled=true") } +} +tasks { test { systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false") @@ -65,6 +75,6 @@ tasks { } check { - dependsOn(testConnectionSpan) + dependsOn(testing.suites) } } diff --git a/instrumentation/redisson/redisson-3.17/javaagent/build.gradle.kts b/instrumentation/redisson/redisson-3.17/javaagent/build.gradle.kts index 3eabc34c913b..d553e1cbc1b0 100644 --- a/instrumentation/redisson/redisson-3.17/javaagent/build.gradle.kts +++ b/instrumentation/redisson/redisson-3.17/javaagent/build.gradle.kts @@ -24,17 +24,27 @@ dependencies { testImplementation(project(":instrumentation:redisson:redisson-common:testing")) } +testing { + suites { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + } + } + } + } + } +} + tasks { withType().configureEach { systemProperty("testLatestDeps", findProperty("testLatestDeps") as Boolean) usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service) } - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - } - check { - dependsOn(testStableSemconv) + dependsOn(testing.suites) } } diff --git a/instrumentation/rocketmq/rocketmq-client/rocketmq-client-5.0/javaagent/build.gradle.kts b/instrumentation/rocketmq/rocketmq-client/rocketmq-client-5.0/javaagent/build.gradle.kts index bb76d29aa456..d0203cd66371 100644 --- a/instrumentation/rocketmq/rocketmq-client/rocketmq-client-5.0/javaagent/build.gradle.kts +++ b/instrumentation/rocketmq/rocketmq-client/rocketmq-client-5.0/javaagent/build.gradle.kts @@ -17,14 +17,24 @@ dependencies { testImplementation(project(":instrumentation:rocketmq:rocketmq-client:rocketmq-client-5.0:testing")) } -tasks { - val testReceiveSpanDisabled by registering(Test::class) { - filter { - includeTestsMatching("RocketMqClientSuppressReceiveSpanTest") +testing { + suites { + val testReceiveSpanDisabled by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + filter { + includeTestsMatching("RocketMqClientSuppressReceiveSpanTest") + } + include("**/RocketMqClientSuppressReceiveSpanTest.*") + } + } + } } - include("**/RocketMqClientSuppressReceiveSpanTest.*") } +} +tasks { test { filter { excludeTestsMatching("RocketMqClientSuppressReceiveSpanTest") @@ -34,6 +44,6 @@ tasks { } check { - dependsOn(testReceiveSpanDisabled) + dependsOn(testing.suites) } } diff --git a/instrumentation/runtime-telemetry/runtime-telemetry-java17/library/build.gradle.kts b/instrumentation/runtime-telemetry/runtime-telemetry-java17/library/build.gradle.kts index 71360a6a8ba7..55e550600d1f 100644 --- a/instrumentation/runtime-telemetry/runtime-telemetry-java17/library/build.gradle.kts +++ b/instrumentation/runtime-telemetry/runtime-telemetry-java17/library/build.gradle.kts @@ -11,6 +11,52 @@ dependencies { testImplementation("io.github.netmikey.logunit:logunit-jul:1.1.3") } +testing { + suites { + val testG1 by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + filter { + includeTestsMatching("*G1GcMemoryMetricTest*") + } + include("**/*G1GcMemoryMetricTest.*") + jvmArgs("-XX:+UseG1GC") + } + } + } + } + + val testPS by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + filter { + includeTestsMatching("*PsGcMemoryMetricTest*") + } + include("**/*PsGcMemoryMetricTest.*") + jvmArgs("-XX:+UseParallelGC") + } + } + } + } + + val testSerial by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + filter { + includeTestsMatching("*SerialGcMemoryMetricTest*") + } + include("**/*SerialGcMemoryMetricTest.*") + jvmArgs("-XX:+UseSerialGC") + } + } + } + } + } +} + tasks.register("generateDocs", JavaExec::class) { group = "build" description = "Generate table for README.md" @@ -20,30 +66,6 @@ tasks.register("generateDocs", JavaExec::class) { } tasks { - val testG1 by registering(Test::class) { - filter { - includeTestsMatching("*G1GcMemoryMetricTest*") - } - include("**/*G1GcMemoryMetricTest.*") - jvmArgs("-XX:+UseG1GC") - } - - val testPS by registering(Test::class) { - filter { - includeTestsMatching("*PsGcMemoryMetricTest*") - } - include("**/*PsGcMemoryMetricTest.*") - jvmArgs("-XX:+UseParallelGC") - } - - val testSerial by registering(Test::class) { - filter { - includeTestsMatching("*SerialGcMemoryMetricTest*") - } - include("**/*SerialGcMemoryMetricTest.*") - jvmArgs("-XX:+UseSerialGC") - } - test { filter { excludeTestsMatching("*G1GcMemoryMetricTest") @@ -53,9 +75,7 @@ tasks { } check { - dependsOn(testG1) - dependsOn(testPS) - dependsOn(testSerial) + dependsOn(testing.suites) } compileJava { diff --git a/instrumentation/spring/spring-batch-3.0/javaagent/build.gradle.kts b/instrumentation/spring/spring-batch-3.0/javaagent/build.gradle.kts index 521afc23385b..e3cd3a69872a 100644 --- a/instrumentation/spring/spring-batch-3.0/javaagent/build.gradle.kts +++ b/instrumentation/spring/spring-batch-3.0/javaagent/build.gradle.kts @@ -24,24 +24,40 @@ dependencies { latestDepTestLibrary("org.springframework.batch:spring-batch-core:4.+") // documented limitation } -tasks { - val testChunkRootSpan by registering(Test::class) { - filter { - includeTestsMatching("*ChunkRootSpanTest") +testing { + suites { + val testChunkRootSpan by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + filter { + includeTestsMatching("*ChunkRootSpanTest") + } + include("**/*ChunkRootSpanTest.*") + jvmArgs("-Dotel.instrumentation.spring-batch.experimental.chunk.new-trace=true") + } + } + } } - include("**/*ChunkRootSpanTest.*") - jvmArgs("-Dotel.instrumentation.spring-batch.experimental.chunk.new-trace=true") - } - val testItemLevelSpan by registering(Test::class) { - filter { - includeTestsMatching("*ItemLevelSpanTest") - includeTestsMatching("*CustomSpanEventTest") + val testItemLevelSpan by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + filter { + includeTestsMatching("*ItemLevelSpanTest") + includeTestsMatching("*CustomSpanEventTest") + } + include("**/*ItemLevelSpanTest.*", "**/*CustomSpanEventTest.*") + jvmArgs("-Dotel.instrumentation.spring-batch.item.enabled=true") + } + } + } } - include("**/*ItemLevelSpanTest.*", "**/*CustomSpanEventTest.*") - jvmArgs("-Dotel.instrumentation.spring-batch.item.enabled=true") } +} +tasks { test { filter { excludeTestsMatching("*ChunkRootSpanTest") @@ -54,8 +70,7 @@ tasks { } check { - dependsOn(testChunkRootSpan) - dependsOn(testItemLevelSpan) + dependsOn(testing.suites) } withType().configureEach { diff --git a/instrumentation/spring/spring-boot-autoconfigure/build.gradle.kts b/instrumentation/spring/spring-boot-autoconfigure/build.gradle.kts index 8ac5e0c57289..499d3e59dece 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/build.gradle.kts +++ b/instrumentation/spring/spring-boot-autoconfigure/build.gradle.kts @@ -174,6 +174,16 @@ testing { } } } + + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + } + } + } + } } } @@ -220,12 +230,7 @@ tasks { from(sourceSets["javaSpring3"].java) } - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - } - check { dependsOn(testing.suites) - dependsOn(testStableSemconv) } } diff --git a/instrumentation/spring/spring-data/spring-data-1.8/javaagent/build.gradle.kts b/instrumentation/spring/spring-data/spring-data-1.8/javaagent/build.gradle.kts index c6b29a675883..7a55cf62dc1b 100644 --- a/instrumentation/spring/spring-data/spring-data-1.8/javaagent/build.gradle.kts +++ b/instrumentation/spring/spring-data/spring-data-1.8/javaagent/build.gradle.kts @@ -45,6 +45,21 @@ dependencies { latestDepTestLibrary("org.springframework:spring-test:5.+") // see spring-data-3.0:testing module } +testing { + suites { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database") + } + } + } + } + } +} + tasks { withType().configureEach { jvmArgs("--add-opens=java.base/java.lang.invoke=ALL-UNNAMED") @@ -55,12 +70,7 @@ tasks { systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false") } - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database") - } - check { - dependsOn(testStableSemconv) + dependsOn(testing.suites) } } diff --git a/instrumentation/spring/spring-data/spring-data-3.0/testing/build.gradle.kts b/instrumentation/spring/spring-data/spring-data-3.0/testing/build.gradle.kts index ae7755f0fca2..59f657658f61 100644 --- a/instrumentation/spring/spring-data/spring-data-3.0/testing/build.gradle.kts +++ b/instrumentation/spring/spring-data/spring-data-3.0/testing/build.gradle.kts @@ -36,6 +36,16 @@ testing { implementation("com.h2database:h2:1.4.197") } } + + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + } + } + } + } } } @@ -47,12 +57,7 @@ tasks { jvmArgs("-Dotel.instrumentation.common.experimental.controller-telemetry.enabled=true") } - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - } - check { dependsOn(testing.suites) - dependsOn(testStableSemconv) } } diff --git a/instrumentation/spring/spring-integration-4.1/javaagent/build.gradle.kts b/instrumentation/spring/spring-integration-4.1/javaagent/build.gradle.kts index a08a119ae605..547a30cd9249 100644 --- a/instrumentation/spring/spring-integration-4.1/javaagent/build.gradle.kts +++ b/instrumentation/spring/spring-integration-4.1/javaagent/build.gradle.kts @@ -40,28 +40,44 @@ dependencies { latestDepTestLibrary("org.springframework.cloud:spring-cloud-stream-binder-rabbit:3.+") // documented limitation } -tasks { - val testWithRabbitInstrumentation by registering(Test::class) { - filter { - includeTestsMatching("SpringIntegrationAndRabbitTest") +testing { + suites { + val testWithRabbitInstrumentation by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + filter { + includeTestsMatching("SpringIntegrationAndRabbitTest") + } + include("**/SpringIntegrationAndRabbitTest.*") + jvmArgs("-Dotel.instrumentation.rabbitmq.enabled=true") + jvmArgs("-Dotel.instrumentation.spring-rabbit.enabled=true") + systemProperty("metadataConfig", "otel.instrumentation.spring-rabbit.enabled=true") + } + } + } } - include("**/SpringIntegrationAndRabbitTest.*") - jvmArgs("-Dotel.instrumentation.rabbitmq.enabled=true") - jvmArgs("-Dotel.instrumentation.spring-rabbit.enabled=true") - systemProperty("metadataConfig", "otel.instrumentation.spring-rabbit.enabled=true") - } - val testWithProducerInstrumentation by registering(Test::class) { - filter { - includeTestsMatching("SpringCloudStreamProducerTest") + val testWithProducerInstrumentation by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + filter { + includeTestsMatching("SpringCloudStreamProducerTest") + } + include("**/SpringCloudStreamProducerTest.*") + jvmArgs("-Dotel.instrumentation.rabbitmq.enabled=false") + jvmArgs("-Dotel.instrumentation.spring-rabbit.enabled=false") + jvmArgs("-Dotel.instrumentation.spring-integration.producer.enabled=true") + systemProperty("metadataConfig", "otel.instrumentation.spring-integration.producer.enabled=true") + } + } + } } - include("**/SpringCloudStreamProducerTest.*") - jvmArgs("-Dotel.instrumentation.rabbitmq.enabled=false") - jvmArgs("-Dotel.instrumentation.spring-rabbit.enabled=false") - jvmArgs("-Dotel.instrumentation.spring-integration.producer.enabled=true") - systemProperty("metadataConfig", "otel.instrumentation.spring-integration.producer.enabled=true") } +} +tasks { test { filter { excludeTestsMatching("SpringIntegrationAndRabbitTest") @@ -72,8 +88,7 @@ tasks { } check { - dependsOn(testWithRabbitInstrumentation) - dependsOn(testWithProducerInstrumentation) + dependsOn(testing.suites) } withType().configureEach { diff --git a/instrumentation/spring/spring-jms/spring-jms-6.0/javaagent/build.gradle.kts b/instrumentation/spring/spring-jms/spring-jms-6.0/javaagent/build.gradle.kts index fb2af9e1cc42..28e72db75356 100644 --- a/instrumentation/spring/spring-jms/spring-jms-6.0/javaagent/build.gradle.kts +++ b/instrumentation/spring/spring-jms/spring-jms-6.0/javaagent/build.gradle.kts @@ -34,19 +34,29 @@ otelJava { minJavaVersionSupported.set(JavaVersion.VERSION_17) } +testing { + suites { + val testReceiveSpansDisabled by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + filter { + includeTestsMatching("SpringListenerSuppressReceiveSpansTest") + } + include("**/SpringListenerSuppressReceiveSpansTest.*") + } + } + } + } + } +} + tasks { withType().configureEach { usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service) systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false") } - val testReceiveSpansDisabled by registering(Test::class) { - filter { - includeTestsMatching("SpringListenerSuppressReceiveSpansTest") - } - include("**/SpringListenerSuppressReceiveSpansTest.*") - } - test { filter { excludeTestsMatching("SpringListenerSuppressReceiveSpansTest") @@ -55,6 +65,6 @@ tasks { } check { - dependsOn(testReceiveSpansDisabled) + dependsOn(testing.suites) } } diff --git a/instrumentation/spring/spring-scheduling-3.1/javaagent/build.gradle.kts b/instrumentation/spring/spring-scheduling-3.1/javaagent/build.gradle.kts index c120df885619..f96eecb914a7 100644 --- a/instrumentation/spring/spring-scheduling-3.1/javaagent/build.gradle.kts +++ b/instrumentation/spring/spring-scheduling-3.1/javaagent/build.gradle.kts @@ -20,6 +20,21 @@ dependencies { testLibrary("org.springframework:spring-context:3.2.3.RELEASE") } +testing { + suites { + val testExperimental by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.instrumentation.spring-scheduling.experimental-span-attributes=true") + systemProperty("metadataConfig", "otel.instrumentation.spring-scheduling.experimental-span-attributes=true") + } + } + } + } + } +} + tasks { withType().configureEach { // required on jdk17 @@ -28,11 +43,6 @@ tasks { systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false") } - - val testExperimental by registering(Test::class) { - jvmArgs("-Dotel.instrumentation.spring-scheduling.experimental-span-attributes=true") - systemProperty("metadataConfig", "otel.instrumentation.spring-scheduling.experimental-span-attributes=true") - } } val latestDepTest = findProperty("testLatestDeps") as Boolean diff --git a/instrumentation/spring/spring-webmvc/spring-webmvc-3.1/javaagent/build.gradle.kts b/instrumentation/spring/spring-webmvc/spring-webmvc-3.1/javaagent/build.gradle.kts index 0c6ae9682ea2..706a38466ade 100644 --- a/instrumentation/spring/spring-webmvc/spring-webmvc-3.1/javaagent/build.gradle.kts +++ b/instrumentation/spring/spring-webmvc/spring-webmvc-3.1/javaagent/build.gradle.kts @@ -43,6 +43,21 @@ dependencies { latestDepTestLibrary("org.springframework.boot:spring-boot-starter-security:2.+") // see spring-webmvc-6.0 module } +testing { + suites { + val testExperimental by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + systemProperty("metadataConfig", "otel.instrumentation.spring-webmvc.experimental-span-attributes=true") + jvmArgs("-Dotel.instrumentation.spring-webmvc.experimental-span-attributes=true") + } + } + } + } + } +} + tasks { withType().configureEach { systemProperty("testLatestDeps", findProperty("testLatestDeps") as Boolean) @@ -56,13 +71,8 @@ tasks { jvmArgs("-Dotel.instrumentation.common.experimental.view-telemetry.enabled=true") } - val testExperimental by registering(Test::class) { - systemProperty("metadataConfig", "otel.instrumentation.spring-webmvc.experimental-span-attributes=true") - jvmArgs("-Dotel.instrumentation.spring-webmvc.experimental-span-attributes=true") - } - check { - dependsOn(testExperimental) + dependsOn(testing.suites) } } diff --git a/instrumentation/spring/spring-webmvc/spring-webmvc-6.0/javaagent/build.gradle.kts b/instrumentation/spring/spring-webmvc/spring-webmvc-6.0/javaagent/build.gradle.kts index 640dc885e125..26975f21b724 100644 --- a/instrumentation/spring/spring-webmvc/spring-webmvc-6.0/javaagent/build.gradle.kts +++ b/instrumentation/spring/spring-webmvc/spring-webmvc-6.0/javaagent/build.gradle.kts @@ -44,6 +44,21 @@ otelJava { minJavaVersionSupported.set(JavaVersion.VERSION_17) } +testing { + suites { + val testExperimental by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + systemProperty("metadataConfig", "otel.instrumentation.spring-webmvc.experimental-span-attributes=true") + jvmArgs("-Dotel.instrumentation.spring-webmvc.experimental-span-attributes=true") + } + } + } + } + } +} + tasks { withType().configureEach { // required on jdk17 @@ -56,12 +71,7 @@ tasks { systemProperty("testLatestDeps", findProperty("testLatestDeps") as Boolean) } - val testExperimental by registering(Test::class) { - systemProperty("metadataConfig", "otel.instrumentation.spring-webmvc.experimental-span-attributes=true") - jvmArgs("-Dotel.instrumentation.spring-webmvc.experimental-span-attributes=true") - } - check { - dependsOn(testExperimental) + dependsOn(testing.suites) } } diff --git a/instrumentation/spymemcached-2.12/javaagent/build.gradle.kts b/instrumentation/spymemcached-2.12/javaagent/build.gradle.kts index 0f3c5a4ff953..a9b6ac8947fb 100644 --- a/instrumentation/spymemcached-2.12/javaagent/build.gradle.kts +++ b/instrumentation/spymemcached-2.12/javaagent/build.gradle.kts @@ -20,6 +20,20 @@ dependencies { testImplementation("com.google.guava:guava") } +testing { + suites { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + } + } + } + } + } +} + tasks { withType().configureEach { // TODO run tests both with and without experimental span attributes @@ -27,11 +41,7 @@ tasks { usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service) } - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - } - check { - dependsOn(testStableSemconv) + dependsOn(testing.suites) } } diff --git a/instrumentation/tomcat/tomcat-jdbc/javaagent/build.gradle.kts b/instrumentation/tomcat/tomcat-jdbc/javaagent/build.gradle.kts index 0bc199140cd1..1a70024f7716 100644 --- a/instrumentation/tomcat/tomcat-jdbc/javaagent/build.gradle.kts +++ b/instrumentation/tomcat/tomcat-jdbc/javaagent/build.gradle.kts @@ -18,19 +18,28 @@ dependencies { val collectMetadata = findProperty("collectMetadata")?.toString() ?: "false" -tasks { - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - - systemProperty("collectMetadata", collectMetadata) - systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database") +testing { + suites { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + systemProperty("collectMetadata", collectMetadata) + systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database") + } + } + } + } } +} +tasks { test { systemProperty("collectMetadata", collectMetadata) } check { - dependsOn(testStableSemconv) + dependsOn(testing.suites) } } diff --git a/instrumentation/vertx/vertx-redis-client-4.0/javaagent/build.gradle.kts b/instrumentation/vertx/vertx-redis-client-4.0/javaagent/build.gradle.kts index 64fe65fce14b..96fe679baf0e 100644 --- a/instrumentation/vertx/vertx-redis-client-4.0/javaagent/build.gradle.kts +++ b/instrumentation/vertx/vertx-redis-client-4.0/javaagent/build.gradle.kts @@ -22,20 +22,29 @@ dependencies { val collectMetadata = findProperty("collectMetadata")?.toString() ?: "false" +testing { + suites { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + systemProperty("collectMetadata", collectMetadata) + systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database") + } + } + } + } + } +} + tasks { withType().configureEach { usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service) systemProperty("collectMetadata", collectMetadata) } - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - - systemProperty("collectMetadata", collectMetadata) - systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database") - } - check { - dependsOn(testStableSemconv) + dependsOn(testing.suites) } } diff --git a/instrumentation/vertx/vertx-sql-client/vertx-sql-client-4.0/javaagent/build.gradle.kts b/instrumentation/vertx/vertx-sql-client/vertx-sql-client-4.0/javaagent/build.gradle.kts index 082cd49cadd7..3d416d5eba1b 100644 --- a/instrumentation/vertx/vertx-sql-client/vertx-sql-client-4.0/javaagent/build.gradle.kts +++ b/instrumentation/vertx/vertx-sql-client/vertx-sql-client-4.0/javaagent/build.gradle.kts @@ -30,20 +30,29 @@ dependencies { val collectMetadata = findProperty("collectMetadata")?.toString() ?: "false" +testing { + suites { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database") + } + } + } + } + } +} + tasks { withType().configureEach { usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service) systemProperty("collectMetadata", collectMetadata) } - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - - systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database") - } - check { - dependsOn(testStableSemconv) + dependsOn(testing.suites) } } diff --git a/instrumentation/vertx/vertx-sql-client/vertx-sql-client-5.0/javaagent/build.gradle.kts b/instrumentation/vertx/vertx-sql-client/vertx-sql-client-5.0/javaagent/build.gradle.kts index 4fa02754e0df..281d539cc241 100644 --- a/instrumentation/vertx/vertx-sql-client/vertx-sql-client-5.0/javaagent/build.gradle.kts +++ b/instrumentation/vertx/vertx-sql-client/vertx-sql-client-5.0/javaagent/build.gradle.kts @@ -30,19 +30,28 @@ dependencies { val collectMetadata = findProperty("collectMetadata")?.toString() ?: "false" +testing { + suites { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database") + } + } + } + } + } +} + tasks { withType().configureEach { usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service) systemProperty("collectMetadata", collectMetadata) } - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - - systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database") - } - check { - dependsOn(testStableSemconv) + dependsOn(testing.suites) } } diff --git a/instrumentation/vibur-dbcp-11.0/javaagent/build.gradle.kts b/instrumentation/vibur-dbcp-11.0/javaagent/build.gradle.kts index f2011616fb2d..fb3f35cab299 100644 --- a/instrumentation/vibur-dbcp-11.0/javaagent/build.gradle.kts +++ b/instrumentation/vibur-dbcp-11.0/javaagent/build.gradle.kts @@ -21,19 +21,28 @@ dependencies { val collectMetadata = findProperty("collectMetadata")?.toString() ?: "false" -tasks { - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") - - systemProperty("collectMetadata", collectMetadata) - systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database") +testing { + suites { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + systemProperty("collectMetadata", collectMetadata) + systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database") + } + } + } + } } +} +tasks { test { systemProperty("collectMetadata", collectMetadata) } check { - dependsOn(testStableSemconv) + dependsOn(testing.suites) } } diff --git a/instrumentation/vibur-dbcp-11.0/library/build.gradle.kts b/instrumentation/vibur-dbcp-11.0/library/build.gradle.kts index 9f0a4b44cb9c..56ad0a14327c 100644 --- a/instrumentation/vibur-dbcp-11.0/library/build.gradle.kts +++ b/instrumentation/vibur-dbcp-11.0/library/build.gradle.kts @@ -9,12 +9,22 @@ dependencies { testImplementation(project(":instrumentation:vibur-dbcp-11.0:testing")) } -tasks { - val testStableSemconv by registering(Test::class) { - jvmArgs("-Dotel.semconv-stability.opt-in=database") +testing { + suites { + val testStableSemconv by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + jvmArgs("-Dotel.semconv-stability.opt-in=database") + } + } + } + } } +} +tasks { check { - dependsOn(testStableSemconv) + dependsOn(testing.suites) } } diff --git a/testing-common/integration-tests/build.gradle.kts b/testing-common/integration-tests/build.gradle.kts index 067d71082b13..ba4772d422f3 100644 --- a/testing-common/integration-tests/build.gradle.kts +++ b/testing-common/integration-tests/build.gradle.kts @@ -27,28 +27,44 @@ dependencies { testImplementation("net.sf.jt400:jt400:6.1") } -tasks { - val testFieldInjectionDisabled by registering(Test::class) { - filter { - includeTestsMatching("context.FieldInjectionDisabledTest") +testing { + suites { + val testFieldInjectionDisabled by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + filter { + includeTestsMatching("context.FieldInjectionDisabledTest") + } + include("**/FieldInjectionDisabledTest.*") + jvmArgs("-Dotel.javaagent.experimental.field-injection.enabled=false") + } + } + } } - include("**/FieldInjectionDisabledTest.*") - jvmArgs("-Dotel.javaagent.experimental.field-injection.enabled=false") - } - val testFieldBackedImplementation by registering(Test::class) { - filter { - includeTestsMatching("context.FieldBackedImplementationTest") + val testFieldBackedImplementation by registering(JvmTestSuite::class) { + targets { + all { + testTask.configure { + filter { + includeTestsMatching("context.FieldBackedImplementationTest") + } + include("**/FieldBackedImplementationTest.*") + // this test uses reflection to access fields generated by FieldBackedProvider + // internal-reflection needs to be disabled because it removes these fields from reflection results. + jvmArgs("-Dotel.instrumentation.internal-reflection.enabled=false") + // required on jdk17 + jvmArgs("--add-opens=java.base/java.lang=ALL-UNNAMED") + jvmArgs("-XX:+IgnoreUnrecognizedVMOptions") + } + } + } } - include("**/FieldBackedImplementationTest.*") - // this test uses reflection to access fields generated by FieldBackedProvider - // internal-reflection needs to be disabled because it removes these fields from reflection results. - jvmArgs("-Dotel.instrumentation.internal-reflection.enabled=false") - // required on jdk17 - jvmArgs("--add-opens=java.base/java.lang=ALL-UNNAMED") - jvmArgs("-XX:+IgnoreUnrecognizedVMOptions") } +} +tasks { test { filter { excludeTestsMatching("context.FieldInjectionDisabledTest") @@ -59,7 +75,6 @@ tasks { } check { - dependsOn(testFieldInjectionDisabled) - dependsOn(testFieldBackedImplementation) + dependsOn(testing.suites) } }