Преглед изворни кода

Run check during testing and assemble during building (#5619)

Anuraag Agrawal пре 3 година
родитељ
комит
213057d057

+ 1 - 1
.github/workflows/build.yml

@@ -40,7 +40,7 @@ jobs:
           GE_CACHE_PASSWORD: ${{ secrets.GE_CACHE_PASSWORD }}
         with:
           # javadoc task fails sporadically fetching https://docs.oracle.com/javase/8/docs/api/
-          arguments: build -x javadoc ${{ inputs.no-build-cache && '--no-build-cache' || '' }}
+          arguments: assemble -x javadoc ${{ inputs.no-build-cache && '--no-build-cache' || '' }}
           cache-read-only: ${{ inputs.cache-read-only }}
 
       - name: Upload deadlock detector artifacts if any

+ 1 - 1
.github/workflows/test.yml

@@ -56,7 +56,7 @@ jobs:
           GE_CACHE_PASSWORD: ${{ secrets.GE_CACHE_PASSWORD }}
         uses: gradle/gradle-build-action@v2
         with:
-          arguments: test -PtestJavaVersion=${{ matrix.test-java-version }} -PtestJavaVM=${{ matrix.vm }} -Porg.gradle.java.installations.paths=${{ steps.setup-test-java.outputs.path }} -Porg.gradle.java.installations.auto-download=false ${{ inputs.no-build-cache && ' --no-build-cache' || '' }}
+          arguments: check -PtestJavaVersion=${{ matrix.test-java-version }} -PtestJavaVM=${{ matrix.vm }} -Porg.gradle.java.installations.paths=${{ steps.setup-test-java.outputs.path }} -Porg.gradle.java.installations.auto-download=false ${{ inputs.no-build-cache && ' --no-build-cache' || '' }}
           # only push cache for one matrix option since github action cache space is limited
           cache-read-only: ${{ inputs.cache-read-only || matrix.test-java-version != 11 || matrix.vm != 'hotspot' }}
 

+ 4 - 4
instrumentation-api/build.gradle.kts

@@ -50,21 +50,21 @@ tasks {
   val testStatementSanitizerConfig by registering(Test::class) {
     filter {
       includeTestsMatching("StatementSanitizationConfigTest")
-      isFailOnNoMatchingTests = false
     }
     include("**/StatementSanitizationConfigTest.*")
     jvmArgs("-Dotel.instrumentation.common.db-statement-sanitizer.enabled=false")
   }
 
   test {
-    dependsOn(testStatementSanitizerConfig)
-
     filter {
       excludeTestsMatching("StatementSanitizationConfigTest")
-      isFailOnNoMatchingTests = false
     }
   }
 
+  check {
+    dependsOn(testStatementSanitizerConfig)
+  }
+
   // TODO this should live in jmh-conventions
   named<JavaCompile>("jmhCompileGeneratedClasses") {
     options.errorprone {

+ 1 - 8
instrumentation/aws-sdk/aws-sdk-1.11/javaagent/build.gradle.kts

@@ -85,14 +85,7 @@ dependencies {
 }
 
 tasks {
-  val test_before_1_11_106 by existing(Test::class) {
-    filter {
-      // this is needed because "test.dependsOn test_before_1_11_106", and so without this,
-      // running a single test in the default test set will fail
-      setFailOnNoMatchingTests(false)
-    }
-  }
-
+  val test_before_1_11_106 by existing
   val testSqs by existing
 
   if (!(findProperty("testLatestDeps") as Boolean)) {

+ 5 - 5
instrumentation/external-annotations/javaagent/build.gradle.kts

@@ -37,7 +37,6 @@ tasks {
   val testIncludeProperty by registering(Test::class) {
     filter {
       includeTestsMatching("ConfiguredTraceAnnotationsTest")
-      isFailOnNoMatchingTests = false
     }
     include("**/ConfiguredTraceAnnotationsTest.*")
     jvmArgs("-Dotel.instrumentation.external-annotations.include=package.Class\$Name;OuterClass\$InterestingMethod")
@@ -46,19 +45,20 @@ tasks {
   val testExcludeMethodsProperty by registering(Test::class) {
     filter {
       includeTestsMatching("TracedMethodsExclusionTest")
-      isFailOnNoMatchingTests = false
     }
     include("**/TracedMethodsExclusionTest.*")
     jvmArgs("-Dotel.instrumentation.external-annotations.exclude-methods=TracedMethodsExclusionTest\$TestClass[excluded,annotatedButExcluded]")
   }
 
   test {
-    dependsOn(testIncludeProperty)
-    dependsOn(testExcludeMethodsProperty)
     filter {
       excludeTestsMatching("ConfiguredTraceAnnotationsTest")
       excludeTestsMatching("TracedMethodsExclusionTest")
-      isFailOnNoMatchingTests = false
     }
   }
+
+  check {
+    dependsOn(testIncludeProperty)
+    dependsOn(testExcludeMethodsProperty)
+  }
 }

+ 7 - 15
instrumentation/jms-1.1/javaagent/build.gradle.kts

@@ -27,37 +27,29 @@ tasks {
   val testReceiveSpansDisabled by registering(Test::class) {
     filter {
       includeTestsMatching("SpringListenerJms1SuppressReceiveSpansTest")
-      isFailOnNoMatchingTests = false
     }
     include("**/SpringListenerJms1SuppressReceiveSpansTest.*")
   }
 
   val jms2Test by existing(Test::class) {
-    filter {
-      // this is needed because "test.dependsOn jms2Test", and so without this,
-      // running a single test in the default test set will fail
-      isFailOnNoMatchingTests = false
-    }
     jvmArgs("-Dotel.instrumentation.messaging.experimental.receive-telemetry.enabled=true")
   }
 
-  val jms2TestReceiveSpansDisabled by existing(Test::class) {
-    filter {
-      isFailOnNoMatchingTests = false
-    }
-  }
+  val jms2TestReceiveSpansDisabled by existing
 
   test {
-    dependsOn(testReceiveSpansDisabled)
-    dependsOn(jms2Test)
-    dependsOn(jms2TestReceiveSpansDisabled)
     usesService(gradle.sharedServices.registrations["testcontainersBuildService"].getService())
     filter {
       excludeTestsMatching("SpringListenerJms1SuppressReceiveSpansTest")
-      isFailOnNoMatchingTests = false
     }
     jvmArgs("-Dotel.instrumentation.messaging.experimental.receive-telemetry.enabled=true")
   }
+
+  check {
+    dependsOn(testReceiveSpansDisabled)
+    dependsOn(jms2Test)
+    dependsOn(jms2TestReceiveSpansDisabled)
+  }
 }
 
 val versions: Map<String, String> by project

+ 5 - 5
instrumentation/kafka/kafka-clients/kafka-clients-0.11/javaagent/build.gradle.kts

@@ -35,7 +35,6 @@ tasks {
   val testPropagationDisabled by registering(Test::class) {
     filter {
       includeTestsMatching("KafkaClientPropagationDisabledTest")
-      isFailOnNoMatchingTests = false
     }
     include("**/KafkaClientPropagationDisabledTest.*")
     jvmArgs("-Dotel.instrumentation.kafka.client-propagation.enabled=false")
@@ -44,19 +43,20 @@ tasks {
   val testReceiveSpansDisabled by registering(Test::class) {
     filter {
       includeTestsMatching("KafkaClientSuppressReceiveSpansTest")
-      isFailOnNoMatchingTests = false
     }
     include("**/KafkaClientSuppressReceiveSpansTest.*")
   }
 
   test {
-    dependsOn(testPropagationDisabled)
-    dependsOn(testReceiveSpansDisabled)
     filter {
       excludeTestsMatching("KafkaClientPropagationDisabledTest")
       excludeTestsMatching("KafkaClientSuppressReceiveSpansTest")
-      isFailOnNoMatchingTests = false
     }
     jvmArgs("-Dotel.instrumentation.messaging.experimental.receive-telemetry.enabled=true")
   }
+
+  check {
+    dependsOn(testPropagationDisabled)
+    dependsOn(testReceiveSpansDisabled)
+  }
 }

+ 4 - 3
instrumentation/kafka/kafka-streams-0.11/javaagent/build.gradle.kts

@@ -34,17 +34,18 @@ tasks {
   val testReceiveSpansDisabled by registering(Test::class) {
     filter {
       includeTestsMatching("KafkaStreamsSuppressReceiveSpansTest")
-      isFailOnNoMatchingTests = false
     }
     include("**/KafkaStreamsSuppressReceiveSpansTest.*")
   }
 
   test {
-    dependsOn(testReceiveSpansDisabled)
     filter {
       excludeTestsMatching("KafkaStreamsSuppressReceiveSpansTest")
-      isFailOnNoMatchingTests = false
     }
     jvmArgs("-Dotel.instrumentation.messaging.experimental.receive-telemetry.enabled=true")
   }
+
+  check {
+    dependsOn(testReceiveSpansDisabled)
+  }
 }

+ 4 - 3
instrumentation/micrometer/micrometer-1.5/javaagent/build.gradle.kts

@@ -23,17 +23,18 @@ tasks {
   val testBaseTimeUnit by registering(Test::class) {
     filter {
       includeTestsMatching("*TimerSecondsTest")
-      isFailOnNoMatchingTests = false
     }
     include("**/*TimerSecondsTest.*")
     jvmArgs("-Dotel.instrumentation.micrometer.base-time-unit=seconds")
   }
 
   test {
-    dependsOn(testBaseTimeUnit)
     filter {
       excludeTestsMatching("*TimerSecondsTest")
-      isFailOnNoMatchingTests = false
     }
   }
+
+  check {
+    dependsOn(testBaseTimeUnit)
+  }
 }

+ 4 - 3
instrumentation/netty/netty-4.0/javaagent/build.gradle.kts

@@ -38,7 +38,6 @@ tasks {
     filter {
       includeTestsMatching("Netty40ConnectionSpanTest")
       includeTestsMatching("Netty40ClientSslTest")
-      isFailOnNoMatchingTests = false
     }
     include("**/Netty40ConnectionSpanTest.*", "**/Netty40ClientSslTest.*")
     jvmArgs("-Dotel.instrumentation.netty.always-create-connect-span=true")
@@ -46,13 +45,15 @@ tasks {
   }
 
   test {
-    dependsOn(testConnectionSpan)
     filter {
       excludeTestsMatching("Netty40ConnectionSpanTest")
       excludeTestsMatching("Netty40ClientSslTest")
-      isFailOnNoMatchingTests = false
     }
   }
+
+  check {
+    dependsOn(testConnectionSpan)
+  }
 }
 
 // We need to force the dependency to the earliest supported version because other libraries declare newer versions.

+ 4 - 3
instrumentation/netty/netty-4.1/javaagent/build.gradle.kts

@@ -43,7 +43,6 @@ tasks {
     filter {
       includeTestsMatching("Netty41ConnectionSpanTest")
       includeTestsMatching("Netty41ClientSslTest")
-      isFailOnNoMatchingTests = false
     }
     include("**/Netty41ConnectionSpanTest.*", "**/Netty41ClientSslTest.*")
     jvmArgs("-Dotel.instrumentation.netty.always-create-connect-span=true")
@@ -53,13 +52,15 @@ tasks {
   test {
     systemProperty("testLatestDeps", findProperty("testLatestDeps") as Boolean)
 
-    dependsOn(testConnectionSpan)
     filter {
       excludeTestsMatching("Netty41ConnectionSpanTest")
       excludeTestsMatching("Netty41ClientSslTest")
-      isFailOnNoMatchingTests = false
     }
   }
+
+  check {
+    dependsOn(testConnectionSpan)
+  }
 }
 
 if (!(findProperty("testLatestDeps") as Boolean)) {

+ 4 - 3
instrumentation/reactor/reactor-netty/reactor-netty-0.9/javaagent/build.gradle.kts

@@ -30,17 +30,18 @@ tasks {
   val testConnectionSpan by registering(Test::class) {
     filter {
       includeTestsMatching("ReactorNettyConnectionSpanTest")
-      isFailOnNoMatchingTests = false
     }
     include("**/ReactorNettyConnectionSpanTest.*")
     jvmArgs("-Dotel.instrumentation.netty.always-create-connect-span=true")
   }
 
   test {
-    dependsOn(testConnectionSpan)
     filter {
       excludeTestsMatching("ReactorNettyConnectionSpanTest")
-      isFailOnNoMatchingTests = false
     }
   }
+
+  check {
+    dependsOn(testConnectionSpan)
+  }
 }

+ 4 - 3
instrumentation/reactor/reactor-netty/reactor-netty-1.0/javaagent/build.gradle.kts

@@ -39,7 +39,6 @@ tasks {
     filter {
       includeTestsMatching("ReactorNettyConnectionSpanTest")
       includeTestsMatching("ReactorNettyClientSslTest")
-      isFailOnNoMatchingTests = false
     }
     include("**/ReactorNettyConnectionSpanTest.*", "**/ReactorNettyClientSslTest.*")
     jvmArgs("-Dotel.instrumentation.netty.ssl-telemetry.enabled=true")
@@ -47,11 +46,13 @@ tasks {
   }
 
   test {
-    dependsOn(testConnectionSpan)
     filter {
       excludeTestsMatching("ReactorNettyConnectionSpanTest")
       excludeTestsMatching("ReactorNettyClientSslTest")
-      isFailOnNoMatchingTests = false
     }
   }
+
+  check {
+    dependsOn(testConnectionSpan)
+  }
 }

+ 4 - 10
instrumentation/scala-fork-join-2.8/javaagent/build.gradle.kts

@@ -32,19 +32,13 @@ dependencies {
 
 // Run Slick library tests along with the rest of tests
 tasks {
-  val slickTest by existing(Test::class) {
-    filter {
-      // this is needed because "test.dependsOn slickTest", and so without this,
-      // running a single test in the default test set will fail
-      setFailOnNoMatchingTests(false)
-    }
+  val slickTest by existing
+
+  check {
+    dependsOn(slickTest)
   }
 
   named<GroovyCompile>("compileSlickTestGroovy") {
     classpath = classpath.plus(files(sourceSets["slickTest"].scala.classesDirectory))
   }
-
-  test {
-    dependsOn(slickTest)
-  }
 }

+ 5 - 5
instrumentation/spring/spring-batch-3.0/javaagent/build.gradle.kts

@@ -23,7 +23,6 @@ tasks {
   val testChunkRootSpan by registering(Test::class) {
     filter {
       includeTestsMatching("*ChunkRootSpanTest")
-      isFailOnNoMatchingTests = false
     }
     include("**/*ChunkRootSpanTest.*")
     jvmArgs("-Dotel.instrumentation.spring-batch.experimental.chunk.new-trace=true")
@@ -33,23 +32,24 @@ tasks {
     filter {
       includeTestsMatching("*ItemLevelSpanTest")
       includeTestsMatching("*CustomSpanEventTest")
-      isFailOnNoMatchingTests = false
     }
     include("**/*ItemLevelSpanTest.*", "**/*CustomSpanEventTest.*")
     jvmArgs("-Dotel.instrumentation.spring-batch.item.enabled=true")
   }
 
   test {
-    dependsOn(testChunkRootSpan)
-    dependsOn(testItemLevelSpan)
     filter {
       excludeTestsMatching("*ChunkRootSpanTest")
       excludeTestsMatching("*ItemLevelSpanTest")
       excludeTestsMatching("*CustomSpanEventTest")
-      isFailOnNoMatchingTests = false
     }
   }
 
+  check {
+    dependsOn(testChunkRootSpan)
+    dependsOn(testItemLevelSpan)
+  }
+
   withType<Test>().configureEach {
     systemProperty("testLatestDeps", findProperty("testLatestDeps"))
     jvmArgs("-Dotel.instrumentation.spring-batch.enabled=true")

+ 5 - 6
instrumentation/spring/spring-integration-4.1/javaagent/build.gradle.kts

@@ -38,7 +38,6 @@ tasks {
   val testWithRabbitInstrumentation by registering(Test::class) {
     filter {
       includeTestsMatching("SpringIntegrationAndRabbitTest")
-      isFailOnNoMatchingTests = false
     }
     include("**/SpringIntegrationAndRabbitTest.*")
     jvmArgs("-Dotel.instrumentation.rabbitmq.enabled=true")
@@ -48,7 +47,6 @@ tasks {
   val testWithProducerInstrumentation by registering(Test::class) {
     filter {
       includeTestsMatching("SpringCloudStreamProducerTest")
-      isFailOnNoMatchingTests = false
     }
     include("**/SpringCloudStreamProducerTest.*")
     jvmArgs("-Dotel.instrumentation.rabbitmq.enabled=false")
@@ -57,18 +55,19 @@ tasks {
   }
 
   test {
-    dependsOn(testWithRabbitInstrumentation)
-    dependsOn(testWithProducerInstrumentation)
-
     filter {
       excludeTestsMatching("SpringIntegrationAndRabbitTest")
       excludeTestsMatching("SpringCloudStreamProducerTest")
-      isFailOnNoMatchingTests = false
     }
     jvmArgs("-Dotel.instrumentation.rabbitmq.enabled=false")
     jvmArgs("-Dotel.instrumentation.spring-rabbit.enabled=false")
   }
 
+  check {
+    dependsOn(testWithRabbitInstrumentation)
+    dependsOn(testWithProducerInstrumentation)
+  }
+
   withType<Test>().configureEach {
     systemProperty("testLatestDeps", findProperty("testLatestDeps") as Boolean)
     usesService(gradle.sharedServices.registrations["testcontainersBuildService"].getService())

+ 4 - 4
instrumentation/spring/spring-integration-4.1/library/build.gradle.kts

@@ -20,21 +20,21 @@ tasks {
   val testWithProducerInstrumentation by registering(Test::class) {
     filter {
       includeTestsMatching("SpringCloudStreamProducerTest")
-      isFailOnNoMatchingTests = false
     }
     include("**/SpringCloudStreamProducerTest.*")
     jvmArgs("-Dotel.instrumentation.spring-integration.producer.enabled=true")
   }
 
   test {
-    dependsOn(testWithProducerInstrumentation)
-
     filter {
       excludeTestsMatching("SpringCloudStreamProducerTest")
-      isFailOnNoMatchingTests = false
     }
   }
 
+  check {
+    dependsOn(testWithProducerInstrumentation)
+  }
+
   withType<Test>().configureEach {
     systemProperty("testLatestDeps", findProperty("testLatestDeps") as Boolean)
     usesService(gradle.sharedServices.registrations["testcontainersBuildService"].getService())

+ 4 - 3
testing-common/integration-tests/build.gradle.kts

@@ -28,7 +28,6 @@ tasks {
   val testFieldInjectionDisabled by registering(Test::class) {
     filter {
       includeTestsMatching("context.FieldInjectionDisabledTest")
-      isFailOnNoMatchingTests = false
     }
     include("**/FieldInjectionDisabledTest.*")
     jvmArgs("-Dotel.javaagent.experimental.field-injection.enabled=false")
@@ -38,10 +37,8 @@ tasks {
   }
 
   test {
-    dependsOn(testFieldInjectionDisabled)
     filter {
       excludeTestsMatching("context.FieldInjectionDisabledTest")
-      isFailOnNoMatchingTests = false
     }
     // this is needed for AgentInstrumentationSpecificationTest
     jvmArgs("-Dotel.javaagent.exclude-classes=config.exclude.packagename.*,config.exclude.SomeClass,config.exclude.SomeClass\$NestedClass")
@@ -49,4 +46,8 @@ tasks {
     // internal-reflection needs to be disabled because it removes these fields from reflection results.
     jvmArgs("-Dotel.instrumentation.internal-reflection.enabled=false")
   }
+
+  check {
+    dependsOn(testFieldInjectionDisabled)
+  }
 }