From 7dfe5675b67583263401911fd1b6aee4cdf26828 Mon Sep 17 00:00:00 2001 From: Nikita Tkachenko Date: Fri, 31 Jan 2025 16:49:41 +0100 Subject: [PATCH 1/5] Implement quarantined tests tagging --- .../domain/TestFrameworkModule.java | 2 + .../trace/civisibility/domain/TestImpl.java | 6 +- .../domain/buildsystem/ProxyTestModule.java | 5 + .../domain/headless/HeadlessTestModule.java | 5 + .../events/NoOpTestEventsHandler.java | 1 + .../events/TestEventsHandlerImpl.java | 10 + .../trace/civisibility/execution/Regular.java | 5 + .../execution/RetryUntilSuccessful.java | 7 + .../civisibility/execution/RunNTimes.java | 7 + .../execution/RunOnceIgnoreOutcome.java | 5 + .../junit4/CucumberTracingListener.java | 11 +- .../src/test/groovy/CucumberTest.groovy | 20 +- .../test-quarantined-failed-atr/coverages.ftl | 36 ++ .../test-quarantined-failed-atr/events.ftl | 337 ++++++++++++++++ .../coverages.ftl | 0 .../events.ftl | 0 .../coverages.ftl | 0 .../events.ftl | 0 .../junit4/MUnitTracingListener.java | 12 +- .../src/test/groovy/MUnitTest.groovy | 14 +- .../coverages.ftl | 0 .../test-quarantined-failed-atr/events.ftl | 351 +++++++++++++++++ .../coverages.ftl | 0 .../events.ftl | 0 .../test-quarantined-failed}/coverages.ftl | 0 .../test-quarantined-failed/events.ftl | 151 ++++++++ .../junit4/JUnit4TracingListener.java | 11 +- .../src/test/groovy/JUnit4Test.groovy | 16 +- .../coverages.ftl | 0 .../test-quarantined-failed-atr/events.ftl | 356 +++++++++++++++++ .../coverages.ftl | 0 .../events.ftl | 0 .../coverages.ftl | 0 .../events.ftl | 0 .../test-quarantined-failed}/coverages.ftl | 0 .../test-quarantined-failed/events.ftl | 152 ++++++++ .../junit5/CucumberTracingListener.java | 1 + .../src/test/groovy/CucumberTest.groovy | 20 +- .../test-quarantined-failed-atr/coverages.ftl | 36 ++ .../test-quarantined-failed-atr/events.ftl | 337 ++++++++++++++++ .../coverages.ftl | 0 .../events.ftl | 0 .../test-quarantined-failed/coverages.ftl | 8 + .../test-quarantined-failed/events.ftl | 145 +++++++ .../junit5/SpockTracingListener.java | 1 + .../src/test/groovy/SpockTest.groovy | 16 +- .../coverages.ftl | 0 .../test-quarantined-failed-atr/events.ftl | 366 ++++++++++++++++++ .../coverages.ftl | 0 .../events.ftl | 0 .../coverages.ftl | 0 .../events.ftl | 0 .../test-quarantined-failed}/coverages.ftl | 0 .../test-quarantined-failed/events.ftl | 153 ++++++++ .../junit5/JUnitPlatformUtils.java | 5 + .../junit5/TracingListener.java | 1 + .../retry/JUnit5ExecutionInstrumentation.java | 18 +- .../junit5/retry/TestDescriptorHandle.java | 14 +- .../src/test/groovy/JUnit5Test.groovy | 16 +- .../test-quarantined-failed-atr/coverages.ftl | 1 + .../test-quarantined-failed-atr/events.ftl | 361 +++++++++++++++++ .../test-quarantined-failed-efd/coverages.ftl | 1 + .../events.ftl | 0 .../coverages.ftl | 1 + .../events.ftl | 0 .../test-quarantined-failed/coverages.ftl | 1 + .../test-quarantined-failed/events.ftl | 153 ++++++++ .../KarateExecutionInstrumentation.java | 3 + .../karate/KarateTracingHook.java | 3 + .../instrumentation/karate/KarateUtils.java | 2 + .../karate/src/test/groovy/KarateTest.groovy | 4 +- .../test-quarantined-failed/coverages.ftl | 1 + .../events.ftl | 0 .../scalatest/DatadogReporter.java | 5 +- .../src/test/groovy/ScalatestTest.groovy | 14 +- .../test-quarantined-failed-atr/coverages.ftl | 1 + .../test-quarantined-failed-atr/events.ftl | 346 +++++++++++++++++ .../test-quarantined-failed-efd/coverages.ftl | 1 + .../events.ftl | 0 .../test-quarantined-failed/coverages.ftl | 1 + .../test-quarantined-failed/events.ftl | 150 +++++++ .../testng/TracingListener.java | 12 +- .../testng/execution/RetryAnalyzer.java | 5 +- .../instrumentation/testng/TestNGTest.groovy | 16 +- .../test-quarantined-failed-7/coverages.ftl | 1 + .../test-quarantined-failed-7/events.ftl | 153 ++++++++ .../coverages.ftl | 1 + .../test-quarantined-failed-atr-7/events.ftl | 361 +++++++++++++++++ .../coverages.ftl | 1 + .../events.ftl | 341 ++++++++++++++++ .../test-quarantined-failed-efd/coverages.ftl | 1 + .../events.ftl | 0 .../coverages.ftl | 1 + .../test-quarantined-failed-latest/events.ftl | 141 +++++++ .../coverages.ftl | 1 + .../events.ftl | 0 .../weaver/DatadogWeaverReporter.java | 1 + .../events/TestEventsHandler.java | 3 + .../execution/TestExecutionPolicy.java | 6 + .../telemetry/CiVisibilityCountMetric.java | 16 +- .../telemetry/tag/HasFailedAllRetries.java | 12 + .../telemetry/tag/IsBenchmark.java | 15 - .../telemetry/tag/IsQuarantined.java | 12 + .../bootstrap/instrumentation/api/Tags.java | 2 + 104 files changed, 4683 insertions(+), 125 deletions(-) create mode 100644 dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-quarantined-failed-atr/coverages.ftl create mode 100644 dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-quarantined-failed-atr/events.ftl rename dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/{test-failed-efd => test-quarantined-failed-efd}/coverages.ftl (100%) rename dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/{test-failed-efd => test-quarantined-failed-efd}/events.ftl (100%) rename dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/{test-failed => test-quarantined-failed}/coverages.ftl (100%) rename dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/{test-failed => test-quarantined-failed}/events.ftl (100%) rename dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/{test-failed-efd => test-quarantined-failed-atr}/coverages.ftl (100%) create mode 100644 dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-quarantined-failed-atr/events.ftl rename dd-java-agent/instrumentation/junit-4.10/{src/test/resources/test-failed-efd => munit-junit-4/src/test/resources/test-quarantined-failed-efd}/coverages.ftl (100%) rename dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/{test-failed-efd => test-quarantined-failed-efd}/events.ftl (100%) rename dd-java-agent/instrumentation/junit-4.10/{src/test/resources/test-failed-parameterized => munit-junit-4/src/test/resources/test-quarantined-failed}/coverages.ftl (100%) create mode 100644 dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-quarantined-failed/events.ftl rename dd-java-agent/instrumentation/{junit-5.3/spock-junit-5/src/test/resources/test-failed-efd => junit-4.10/src/test/resources/test-quarantined-failed-atr}/coverages.ftl (100%) create mode 100644 dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-quarantined-failed-atr/events.ftl rename dd-java-agent/instrumentation/{junit-5.3/spock-junit-5/src/test/resources/test-failed-parameterized => junit-4.10/src/test/resources/test-quarantined-failed-efd}/coverages.ftl (100%) rename dd-java-agent/instrumentation/junit-4.10/src/test/resources/{test-failed-efd => test-quarantined-failed-efd}/events.ftl (100%) rename dd-java-agent/instrumentation/{junit-5.3/src/test/resources/test-failed-efd => junit-4.10/src/test/resources/test-quarantined-failed-parameterized}/coverages.ftl (100%) rename dd-java-agent/instrumentation/junit-4.10/src/test/resources/{test-failed-parameterized => test-quarantined-failed-parameterized}/events.ftl (100%) rename dd-java-agent/instrumentation/{junit-5.3/src/test/resources/test-failed-parameterized => junit-4.10/src/test/resources/test-quarantined-failed}/coverages.ftl (100%) create mode 100644 dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-quarantined-failed/events.ftl create mode 100644 dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-quarantined-failed-atr/coverages.ftl create mode 100644 dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-quarantined-failed-atr/events.ftl rename dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/{test-failed-efd => test-quarantined-failed-efd}/coverages.ftl (100%) rename dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/{test-failed-efd => test-quarantined-failed-efd}/events.ftl (100%) create mode 100644 dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-quarantined-failed/coverages.ftl create mode 100644 dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-quarantined-failed/events.ftl rename dd-java-agent/instrumentation/{karate/src/test/resources/test-failed-quarantine => junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed-atr}/coverages.ftl (100%) create mode 100644 dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed-atr/events.ftl rename dd-java-agent/instrumentation/{scalatest/src/test/resources/test-failed-efd => junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed-efd}/coverages.ftl (100%) rename dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/{test-failed-efd => test-quarantined-failed-efd}/events.ftl (100%) rename dd-java-agent/instrumentation/{testng/testng-7/src/test/resources/test-failed-efd => junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed-parameterized}/coverages.ftl (100%) rename dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/{test-failed-parameterized => test-quarantined-failed-parameterized}/events.ftl (100%) rename dd-java-agent/instrumentation/{testng/testng-7/src/test/resources/test-failed-parameterized => junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed}/coverages.ftl (100%) create mode 100644 dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed/events.ftl create mode 100644 dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed-atr/coverages.ftl create mode 100644 dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed-atr/events.ftl create mode 100644 dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed-efd/coverages.ftl rename dd-java-agent/instrumentation/junit-5.3/src/test/resources/{test-failed-efd => test-quarantined-failed-efd}/events.ftl (100%) create mode 100644 dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed-parameterized/coverages.ftl rename dd-java-agent/instrumentation/junit-5.3/src/test/resources/{test-failed-parameterized => test-quarantined-failed-parameterized}/events.ftl (100%) create mode 100644 dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed/coverages.ftl create mode 100644 dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed/events.ftl create mode 100644 dd-java-agent/instrumentation/karate/src/test/resources/test-quarantined-failed/coverages.ftl rename dd-java-agent/instrumentation/karate/src/test/resources/{test-failed-quarantine => test-quarantined-failed}/events.ftl (100%) create mode 100644 dd-java-agent/instrumentation/scalatest/src/test/resources/test-quarantined-failed-atr/coverages.ftl create mode 100644 dd-java-agent/instrumentation/scalatest/src/test/resources/test-quarantined-failed-atr/events.ftl create mode 100644 dd-java-agent/instrumentation/scalatest/src/test/resources/test-quarantined-failed-efd/coverages.ftl rename dd-java-agent/instrumentation/scalatest/src/test/resources/{test-failed-efd => test-quarantined-failed-efd}/events.ftl (100%) create mode 100644 dd-java-agent/instrumentation/scalatest/src/test/resources/test-quarantined-failed/coverages.ftl create mode 100644 dd-java-agent/instrumentation/scalatest/src/test/resources/test-quarantined-failed/events.ftl create mode 100644 dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-7/coverages.ftl create mode 100644 dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-7/events.ftl create mode 100644 dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-atr-7/coverages.ftl create mode 100644 dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-atr-7/events.ftl create mode 100644 dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-atr-latest/coverages.ftl create mode 100644 dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-atr-latest/events.ftl create mode 100644 dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-efd/coverages.ftl rename dd-java-agent/instrumentation/testng/testng-7/src/test/resources/{test-failed-efd => test-quarantined-failed-efd}/events.ftl (100%) create mode 100644 dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-latest/coverages.ftl create mode 100644 dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-latest/events.ftl create mode 100644 dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-parameterized/coverages.ftl rename dd-java-agent/instrumentation/testng/testng-7/src/test/resources/{test-failed-parameterized => test-quarantined-failed-parameterized}/events.ftl (100%) create mode 100644 internal-api/src/main/java/datadog/trace/api/civisibility/telemetry/tag/HasFailedAllRetries.java delete mode 100644 internal-api/src/main/java/datadog/trace/api/civisibility/telemetry/tag/IsBenchmark.java create mode 100644 internal-api/src/main/java/datadog/trace/api/civisibility/telemetry/tag/IsQuarantined.java diff --git a/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/domain/TestFrameworkModule.java b/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/domain/TestFrameworkModule.java index 3a5d64b3b28..5b7fc2b1de5 100644 --- a/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/domain/TestFrameworkModule.java +++ b/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/domain/TestFrameworkModule.java @@ -31,6 +31,8 @@ TestSuiteImpl testSuiteStart( boolean isModified(TestSourceData testSourceData); + boolean isQuarantined(TestIdentifier test); + /** * Returns the reason for skipping a test, IF it can be skipped. * diff --git a/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/domain/TestImpl.java b/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/domain/TestImpl.java index 65dcfbfa04d..be035b82528 100644 --- a/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/domain/TestImpl.java +++ b/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/domain/TestImpl.java @@ -18,8 +18,10 @@ import datadog.trace.api.civisibility.telemetry.TagValue; import datadog.trace.api.civisibility.telemetry.tag.BrowserDriver; import datadog.trace.api.civisibility.telemetry.tag.EventType; +import datadog.trace.api.civisibility.telemetry.tag.HasFailedAllRetries; import datadog.trace.api.civisibility.telemetry.tag.IsModified; import datadog.trace.api.civisibility.telemetry.tag.IsNew; +import datadog.trace.api.civisibility.telemetry.tag.IsQuarantined; import datadog.trace.api.civisibility.telemetry.tag.IsRetry; import datadog.trace.api.civisibility.telemetry.tag.IsRum; import datadog.trace.api.civisibility.telemetry.tag.SkipReason; @@ -265,13 +267,15 @@ public void end(@Nullable Long endTime) { Object retryReason = span.getTag(Tags.TEST_RETRY_REASON); metricCollector.add( - CiVisibilityCountMetric.EVENT_FINISHED, + CiVisibilityCountMetric.TEST_EVENT_FINISHED, 1, instrumentation, EventType.TEST, span.getTag(Tags.TEST_IS_NEW) != null ? IsNew.TRUE : null, span.getTag(Tags.TEST_IS_MODIFIED) != null ? IsModified.TRUE : null, + span.getTag(Tags.TEST_MANAGEMENT_IS_QUARANTINED) != null ? IsQuarantined.TRUE : null, span.getTag(Tags.TEST_IS_RETRY) != null ? IsRetry.TRUE : null, + span.getTag(Tags.TEST_HAS_FAILED_ALL_RETRIES) != null ? HasFailedAllRetries.TRUE : null, retryReason instanceof TagValue ? (TagValue) retryReason : null, span.getTag(Tags.TEST_IS_RUM_ACTIVE) != null ? IsRum.TRUE : null, CIConstants.SELENIUM_BROWSER_DRIVER.equals(span.getTag(Tags.TEST_BROWSER_DRIVER)) diff --git a/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/domain/buildsystem/ProxyTestModule.java b/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/domain/buildsystem/ProxyTestModule.java index 4d49b9b0423..17c6303756e 100644 --- a/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/domain/buildsystem/ProxyTestModule.java +++ b/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/domain/buildsystem/ProxyTestModule.java @@ -103,6 +103,11 @@ public boolean isModified(TestSourceData testSourceData) { return executionStrategy.isModified(testSourceData); } + @Override + public boolean isQuarantined(TestIdentifier test) { + return executionStrategy.isQuarantined(test); + } + @Nullable @Override public SkipReason skipReason(TestIdentifier test) { diff --git a/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/domain/headless/HeadlessTestModule.java b/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/domain/headless/HeadlessTestModule.java index 97687b3ca30..fa696149f21 100644 --- a/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/domain/headless/HeadlessTestModule.java +++ b/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/domain/headless/HeadlessTestModule.java @@ -88,6 +88,11 @@ public boolean isModified(TestSourceData testSourceData) { return executionStrategy.isModified(testSourceData); } + @Override + public boolean isQuarantined(TestIdentifier test) { + return executionStrategy.isQuarantined(test); + } + @Nullable @Override public SkipReason skipReason(TestIdentifier test) { diff --git a/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/events/NoOpTestEventsHandler.java b/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/events/NoOpTestEventsHandler.java index b2a73bcab16..70f3827923a 100644 --- a/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/events/NoOpTestEventsHandler.java +++ b/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/events/NoOpTestEventsHandler.java @@ -59,6 +59,7 @@ public void onTestStart( @Nullable Collection categories, @Nonnull TestSourceData testSourceData, RetryReason retryReason, + boolean hasFailedAllRetries, @Nullable Long startTime) { // do nothing } diff --git a/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/events/TestEventsHandlerImpl.java b/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/events/TestEventsHandlerImpl.java index bb040afd7e4..de443756dea 100644 --- a/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/events/TestEventsHandlerImpl.java +++ b/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/events/TestEventsHandlerImpl.java @@ -140,6 +140,7 @@ public void onTestStart( final @Nullable Collection categories, final @Nonnull TestSourceData testSourceData, final @Nullable RetryReason retryReason, + final boolean hasFailedAllRetries, final @Nullable Long startTime) { if (skipTrace(testSourceData.getTestClass())) { return; @@ -166,6 +167,14 @@ public void onTestStart( test.setTag(Tags.TEST_IS_MODIFIED, true); } + if (testModule.isQuarantined(thisTest)) { + test.setTag(Tags.TEST_MANAGEMENT_IS_QUARANTINED, true); + } + + if (hasFailedAllRetries) { + test.setTag(Tags.TEST_HAS_FAILED_ALL_RETRIES, true); + } + if (testFramework != null) { test.setTag(Tags.TEST_FRAMEWORK, testFramework); if (testFrameworkVersion != null) { @@ -257,6 +266,7 @@ public void onTestIgnore( categories, testSourceData, null, + false, null); onTestSkip(testDescriptor, reason); onTestFinish(testDescriptor, null); diff --git a/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/execution/Regular.java b/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/execution/Regular.java index 320170d7ba6..dbe8bc0dc3f 100644 --- a/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/execution/Regular.java +++ b/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/execution/Regular.java @@ -31,4 +31,9 @@ public boolean retry(boolean successful, long durationMillis) { public RetryReason currentExecutionRetryReason() { return null; } + + @Override + public boolean hasFailedAllRetries() { + return false; + } } diff --git a/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/execution/RetryUntilSuccessful.java b/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/execution/RetryUntilSuccessful.java index 2a5463f4738..66fe97609f5 100644 --- a/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/execution/RetryUntilSuccessful.java +++ b/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/execution/RetryUntilSuccessful.java @@ -11,6 +11,7 @@ public class RetryUntilSuccessful implements TestExecutionPolicy { private final int maxExecutions; private final boolean suppressFailures; private int executions; + private boolean successfulExecutionSeen; /** Total execution counter that is shared by all retry policies */ private final AtomicInteger totalExecutions; @@ -41,6 +42,7 @@ private boolean currentExecutionIsNotLast() { @Override public boolean retry(boolean successful, long durationMillis) { + successfulExecutionSeen |= successful; if (!successful && ++executions < maxExecutions) { totalExecutions.incrementAndGet(); return true; @@ -58,4 +60,9 @@ public RetryReason currentExecutionRetryReason() { private boolean currentExecutionIsRetry() { return executions > 0; } + + @Override + public boolean hasFailedAllRetries() { + return executions == maxExecutions && !successfulExecutionSeen; + } } diff --git a/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/execution/RunNTimes.java b/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/execution/RunNTimes.java index 79144f1d303..5c6f64197f2 100644 --- a/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/execution/RunNTimes.java +++ b/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/execution/RunNTimes.java @@ -12,6 +12,7 @@ public class RunNTimes implements TestExecutionPolicy { private final boolean suppressFailures; private int executions; private int maxExecutions; + private boolean successfulExecutionSeen; public RunNTimes( EarlyFlakeDetectionSettings earlyFlakeDetectionSettings, boolean suppressFailures) { @@ -37,6 +38,7 @@ public boolean suppressFailures() { @Override public boolean retry(boolean successful, long durationMillis) { + successfulExecutionSeen |= successful; // adjust maximum retries based on the now known test duration int maxExecutionsForGivenDuration = earlyFlakeDetectionSettings.getExecutions(durationMillis); maxExecutions = Math.min(maxExecutions, maxExecutionsForGivenDuration); @@ -52,4 +54,9 @@ public RetryReason currentExecutionRetryReason() { private boolean currentExecutionIsRetry() { return executions > 0; } + + @Override + public boolean hasFailedAllRetries() { + return executions == maxExecutions && !successfulExecutionSeen; + } } diff --git a/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/execution/RunOnceIgnoreOutcome.java b/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/execution/RunOnceIgnoreOutcome.java index 29edc8a3e02..44e1b2d3582 100644 --- a/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/execution/RunOnceIgnoreOutcome.java +++ b/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/execution/RunOnceIgnoreOutcome.java @@ -33,4 +33,9 @@ public boolean retry(boolean successful, long durationMillis) { public RetryReason currentExecutionRetryReason() { return null; } + + @Override + public boolean hasFailedAllRetries() { + return false; + } } diff --git a/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/main/java/datadog/trace/instrumentation/junit4/CucumberTracingListener.java b/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/main/java/datadog/trace/instrumentation/junit4/CucumberTracingListener.java index 9d80fc40828..5b12ce4024b 100644 --- a/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/main/java/datadog/trace/instrumentation/junit4/CucumberTracingListener.java +++ b/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/main/java/datadog/trace/instrumentation/junit4/CucumberTracingListener.java @@ -29,13 +29,13 @@ public class CucumberTracingListener extends TracingListener { public static final String FRAMEWORK_NAME = "cucumber"; public static final String FRAMEWORK_VERSION = CucumberUtils.getVersion(); - private final ContextStore retryPolicies; + private final ContextStore executionPolicies; private final Map pickleById; public CucumberTracingListener( - ContextStore retryPolicies, + ContextStore executionPolicies, List> featureRunners) { - this.retryPolicies = retryPolicies; + this.executionPolicies = executionPolicies; pickleById = CucumberUtils.getPicklesById(featureRunners); } @@ -71,7 +71,7 @@ public void testStarted(final Description description) { String testName = CucumberUtils.getTestNameForScenario(description); List categories = getCategories(description); - TestExecutionPolicy retryPolicy = retryPolicies.get(description); + TestExecutionPolicy executionPolicy = executionPolicies.get(description); TestEventsHandlerHolder.TEST_EVENTS_HANDLER.onTestStart( new TestSuiteDescriptor(testSuiteName, null), CucumberUtils.toTestDescriptor(description), @@ -81,7 +81,8 @@ public void testStarted(final Description description) { null, categories, TestSourceData.UNKNOWN, - retryPolicy != null ? retryPolicy.currentExecutionRetryReason() : null, + executionPolicy != null ? executionPolicy.currentExecutionRetryReason() : null, + executionPolicy != null && executionPolicy.hasFailedAllRetries(), null); recordFeatureFileCodeCoverage(description); diff --git a/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/groovy/CucumberTest.groovy b/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/groovy/CucumberTest.groovy index 3a2b0804c36..ee81affbf97 100644 --- a/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/groovy/CucumberTest.groovy +++ b/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/groovy/CucumberTest.groovy @@ -98,8 +98,8 @@ class CucumberTest extends CiVisibilityInstrumentationTest { assertSpansData(testcaseName) where: - testcaseName | features | quarantined - "test-failed" | ["org/example/cucumber/calculator/basic_arithmetic_failed.feature"] | [ + testcaseName | features | quarantined + "test-quarantined-failed" | ["org/example/cucumber/calculator/basic_arithmetic_failed.feature"] | [ new TestIdentifier("classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic", "Addition", null) ] } @@ -117,10 +117,10 @@ class CucumberTest extends CiVisibilityInstrumentationTest { assertSpansData(testcaseName) where: - testcaseName | features | quarantined | retried - "test-retry-failed" | ["org/example/cucumber/calculator/basic_arithmetic_failed.feature"] | [ + testcaseName | features | quarantined | retried + "test-quarantined-failed-atr" | ["org/example/cucumber/calculator/basic_arithmetic_failed.feature"] | [ new TestIdentifier("classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic", "Addition", null) - ] | [ + ] | [ new TestIdentifier("classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic", "Addition", null) ] } @@ -138,15 +138,15 @@ class CucumberTest extends CiVisibilityInstrumentationTest { assertSpansData(testcaseName) where: - testcaseName | features | quarantined | known - "test-failed" | ["org/example/cucumber/calculator/basic_arithmetic_failed.feature"] | [ + testcaseName | features | quarantined | known + "test-quarantined-failed" | ["org/example/cucumber/calculator/basic_arithmetic_failed.feature"] | [ new TestIdentifier("classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic", "Addition", null) - ] | [ + ] | [ new TestIdentifier("classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic", "Addition", null) ] - "test-failed-efd" | ["org/example/cucumber/calculator/basic_arithmetic_failed.feature"] | [ + "test-quarantined-failed-efd" | ["org/example/cucumber/calculator/basic_arithmetic_failed.feature"] | [ new TestIdentifier("classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic", "Addition", null) - ] | [] + ] | [] } private String version() { diff --git a/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-quarantined-failed-atr/coverages.ftl b/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-quarantined-failed-atr/coverages.ftl new file mode 100644 index 00000000000..aed9df93b31 --- /dev/null +++ b/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-quarantined-failed-atr/coverages.ftl @@ -0,0 +1,36 @@ +[ { + "files" : [ { + "filename" : "org/example/cucumber/calculator/basic_arithmetic_failed.feature" + } ], + "span_id" : ${content_span_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id} +}, { + "files" : [ { + "filename" : "org/example/cucumber/calculator/basic_arithmetic_failed.feature" + } ], + "span_id" : ${content_span_id_2}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id} +}, { + "files" : [ { + "filename" : "org/example/cucumber/calculator/basic_arithmetic_failed.feature" + } ], + "span_id" : ${content_span_id_3}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id} +}, { + "files" : [ { + "filename" : "org/example/cucumber/calculator/basic_arithmetic_failed.feature" + } ], + "span_id" : ${content_span_id_4}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id} +}, { + "files" : [ { + "filename" : "org/example/cucumber/calculator/basic_arithmetic_failed.feature" + } ], + "span_id" : ${content_span_id_5}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id} +} ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-quarantined-failed-atr/events.ftl b/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-quarantined-failed-atr/events.ftl new file mode 100644 index 00000000000..a28cbaf5b8a --- /dev/null +++ b/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-quarantined-failed-atr/events.ftl @@ -0,0 +1,337 @@ +[ { + "content" : { + "duration" : ${content_duration}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "library_version" : ${content_meta_library_version}, + "span.kind" : "test_suite_end", + "test.framework" : "cucumber", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "cucumber-junit-4", + "test.status" : "fail", + "test.suite" : "classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count} + }, + "name" : "junit.test_suite", + "resource" : "classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id} + }, + "type" : "test_suite_end", + "version" : 1 +}, { + "content" : { + "duration" : ${content_duration_2}, + "error" : 1, + "meta" : { + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack}, + "error.type" : "java.lang.AssertionError", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test", + "test.framework" : "cucumber", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "cucumber-junit-4", + "test.name" : "Addition", + "test.status" : "fail", + "test.suite" : "classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic", + "test.traits" : "{\"category\":[\"foo\"]}", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_2}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "junit.test", + "parent_id" : ${content_parent_id}, + "resource" : "classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic.Addition", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id}, + "start" : ${content_start_2}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_3}, + "error" : 1, + "meta" : { + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack_2}, + "error.type" : "java.lang.AssertionError", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test", + "test.framework" : "cucumber", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.is_retry" : "true", + "test.module" : "cucumber-junit-4", + "test.name" : "Addition", + "test.retry_reason" : "atr", + "test.status" : "fail", + "test.suite" : "classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic", + "test.traits" : "{\"category\":[\"foo\"]}", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_3}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "junit.test", + "parent_id" : ${content_parent_id}, + "resource" : "classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic.Addition", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id_2}, + "start" : ${content_start_3}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id_2} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_4}, + "error" : 1, + "meta" : { + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack_3}, + "error.type" : "java.lang.AssertionError", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test", + "test.framework" : "cucumber", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.is_retry" : "true", + "test.module" : "cucumber-junit-4", + "test.name" : "Addition", + "test.retry_reason" : "atr", + "test.status" : "fail", + "test.suite" : "classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic", + "test.traits" : "{\"category\":[\"foo\"]}", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_4}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "junit.test", + "parent_id" : ${content_parent_id}, + "resource" : "classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic.Addition", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id_3}, + "start" : ${content_start_4}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id_3} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_5}, + "error" : 1, + "meta" : { + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack_4}, + "error.type" : "java.lang.AssertionError", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test", + "test.framework" : "cucumber", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.is_retry" : "true", + "test.module" : "cucumber-junit-4", + "test.name" : "Addition", + "test.retry_reason" : "atr", + "test.status" : "fail", + "test.suite" : "classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic", + "test.traits" : "{\"category\":[\"foo\"]}", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_5}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "junit.test", + "parent_id" : ${content_parent_id}, + "resource" : "classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic.Addition", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id_4}, + "start" : ${content_start_5}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id_4} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_6}, + "error" : 1, + "meta" : { + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack_5}, + "error.type" : "java.lang.AssertionError", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test", + "test.framework" : "cucumber", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.is_retry" : "true", + "test.module" : "cucumber-junit-4", + "test.name" : "Addition", + "test.retry_reason" : "atr", + "test.status" : "fail", + "test.suite" : "classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic", + "test.traits" : "{\"category\":[\"foo\"]}", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_6}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "junit.test", + "parent_id" : ${content_parent_id}, + "resource" : "classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic.Addition", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id_5}, + "start" : ${content_start_6}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id_5} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_7}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_2}, + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test_session_end", + "test.command" : "cucumber-junit-4", + "test.framework" : "cucumber", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.status" : "fail", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_7}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "junit.test_session", + "resource" : "cucumber-junit-4", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_7}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_session_end", + "version" : 1 +}, { + "content" : { + "duration" : ${content_duration_8}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_3}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "library_version" : ${content_meta_library_version}, + "span.kind" : "test_module_end", + "test.framework" : "cucumber", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "cucumber-junit-4", + "test.status" : "fail", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_8} + }, + "name" : "junit.test_module", + "resource" : "cucumber-junit-4", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_8}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_module_end", + "version" : 1 +} ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-failed-efd/coverages.ftl b/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-quarantined-failed-efd/coverages.ftl similarity index 100% rename from dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-failed-efd/coverages.ftl rename to dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-quarantined-failed-efd/coverages.ftl diff --git a/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-failed-efd/events.ftl b/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-quarantined-failed-efd/events.ftl similarity index 100% rename from dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-failed-efd/events.ftl rename to dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-quarantined-failed-efd/events.ftl diff --git a/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-failed/coverages.ftl b/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-quarantined-failed/coverages.ftl similarity index 100% rename from dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-failed/coverages.ftl rename to dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-quarantined-failed/coverages.ftl diff --git a/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-failed/events.ftl b/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-quarantined-failed/events.ftl similarity index 100% rename from dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-failed/events.ftl rename to dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-quarantined-failed/events.ftl diff --git a/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/main/java/datadog/trace/instrumentation/junit4/MUnitTracingListener.java b/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/main/java/datadog/trace/instrumentation/junit4/MUnitTracingListener.java index 49a785d126c..45341cb6a22 100644 --- a/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/main/java/datadog/trace/instrumentation/junit4/MUnitTracingListener.java +++ b/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/main/java/datadog/trace/instrumentation/junit4/MUnitTracingListener.java @@ -23,10 +23,10 @@ public class MUnitTracingListener extends TracingListener { public static final String FRAMEWORK_NAME = "munit"; public static final String FRAMEWORK_VERSION = getVersion(); - private final ContextStore retryPolicies; + private final ContextStore executionPolicies; - public MUnitTracingListener(ContextStore retryPolicies) { - this.retryPolicies = retryPolicies; + public MUnitTracingListener(ContextStore executionPolicies) { + this.executionPolicies = executionPolicies; } public static String getVersion() { @@ -76,7 +76,7 @@ public void testStarted(final Description description) { TestDescriptor testDescriptor = MUnitUtils.toTestDescriptor(description); String testName = description.getMethodName(); List categories = getCategories(description); - TestExecutionPolicy retryPolicy = retryPolicies.get(description); + TestExecutionPolicy executionPolicy = executionPolicies.get(description); TestEventsHandlerHolder.TEST_EVENTS_HANDLER.onTestStart( suiteDescriptor, testDescriptor, @@ -86,7 +86,8 @@ public void testStarted(final Description description) { null, categories, JUnit4Utils.toTestSourceData(description), - retryPolicy != null ? retryPolicy.currentExecutionRetryReason() : null, + executionPolicy != null ? executionPolicy.currentExecutionRetryReason() : null, + executionPolicy != null && executionPolicy.hasFailedAllRetries(), null); } @@ -161,6 +162,7 @@ public void testIgnored(final Description description) { categories, JUnit4Utils.toTestSourceData(description), null, + false, null); } TestEventsHandlerHolder.TEST_EVENTS_HANDLER.onTestSkip(testDescriptor, null); diff --git a/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/groovy/MUnitTest.groovy b/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/groovy/MUnitTest.groovy index 0b4fbcb1a4f..bef5f160b14 100644 --- a/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/groovy/MUnitTest.groovy +++ b/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/groovy/MUnitTest.groovy @@ -88,8 +88,8 @@ class MUnitTest extends CiVisibilityInstrumentationTest { assertSpansData(testcaseName) where: - testcaseName | tests | quarantined - "test-failed" | [TestFailedMUnit] | [new TestIdentifier("org.example.TestFailedMUnit", "Calculator.add", null)] + testcaseName | tests | quarantined + "test-quarantined-failed" | [TestFailedMUnit] | [new TestIdentifier("org.example.TestFailedMUnit", "Calculator.add", null)] } def "test quarantined auto-retries #testcaseName"() { @@ -105,8 +105,8 @@ class MUnitTest extends CiVisibilityInstrumentationTest { assertSpansData(testcaseName) where: - testcaseName | tests | quarantined | retried - "test-retry-failed" | [TestFailedMUnit] | [new TestIdentifier("org.example.TestFailedMUnit", "Calculator.add", null)] | [new TestIdentifier("org.example.TestFailedMUnit", "Calculator.add", null)] + testcaseName | tests | quarantined | retried + "test-quarantined-failed-atr" | [TestFailedMUnit] | [new TestIdentifier("org.example.TestFailedMUnit", "Calculator.add", null)] | [new TestIdentifier("org.example.TestFailedMUnit", "Calculator.add", null)] } def "test quarantined early flakiness detection #testcaseName"() { @@ -122,9 +122,9 @@ class MUnitTest extends CiVisibilityInstrumentationTest { assertSpansData(testcaseName) where: - testcaseName | tests | quarantined | known - "test-failed" | [TestFailedMUnit] | [new TestIdentifier("org.example.TestFailedMUnit", "Calculator.add", null)] | [new TestIdentifier("org.example.TestFailedMUnit", "Calculator.add", null)] - "test-failed-efd" | [TestFailedMUnit] | [new TestIdentifier("org.example.TestFailedMUnit", "Calculator.add", null)] | [] + testcaseName | tests | quarantined | known + "test-quarantined-failed" | [TestFailedMUnit] | [new TestIdentifier("org.example.TestFailedMUnit", "Calculator.add", null)] | [new TestIdentifier("org.example.TestFailedMUnit", "Calculator.add", null)] + "test-quarantined-failed-efd" | [TestFailedMUnit] | [new TestIdentifier("org.example.TestFailedMUnit", "Calculator.add", null)] | [] } private void runTests(Collection> tests, boolean expectSuccess = true) { diff --git a/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-failed-efd/coverages.ftl b/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-quarantined-failed-atr/coverages.ftl similarity index 100% rename from dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-failed-efd/coverages.ftl rename to dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-quarantined-failed-atr/coverages.ftl diff --git a/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-quarantined-failed-atr/events.ftl b/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-quarantined-failed-atr/events.ftl new file mode 100644 index 00000000000..9824b20b206 --- /dev/null +++ b/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-quarantined-failed-atr/events.ftl @@ -0,0 +1,351 @@ +[ { + "content" : { + "duration" : ${content_duration}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid}, + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test_session_end", + "test.command" : "munit-junit-4", + "test.framework" : "munit", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.status" : "fail", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "junit.test_session", + "resource" : "munit-junit-4", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_session_end", + "version" : 1 +}, { + "content" : { + "duration" : ${content_duration_2}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_2}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "library_version" : ${content_meta_library_version}, + "span.kind" : "test_module_end", + "test.framework" : "munit", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "munit-junit-4", + "test.status" : "fail", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_2} + }, + "name" : "junit.test_module", + "resource" : "munit-junit-4", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_2}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_module_end", + "version" : 1 +}, { + "content" : { + "duration" : ${content_duration_3}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_3}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "library_version" : ${content_meta_library_version}, + "span.kind" : "test_suite_end", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "munit", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "munit-junit-4", + "test.source.file" : "dummy_source_path", + "test.status" : "fail", + "test.suite" : "org.example.TestFailedMUnit", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_3}, + "test.source.end" : 19, + "test.source.start" : 11 + }, + "name" : "junit.test_suite", + "resource" : "org.example.TestFailedMUnit", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_3}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id} + }, + "type" : "test_suite_end", + "version" : 1 +}, { + "content" : { + "duration" : ${content_duration_4}, + "error" : 1, + "meta" : { + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack}, + "error.type" : "munit.ComparisonFailException", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "munit", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "munit-junit-4", + "test.name" : "Calculator.add", + "test.source.file" : "dummy_source_path", + "test.status" : "fail", + "test.suite" : "org.example.TestFailedMUnit", + "test.traits" : "{\"category\":[\"myTag\"]}", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_4}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "junit.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestFailedMUnit.Calculator.add", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id}, + "start" : ${content_start_4}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_5}, + "error" : 1, + "meta" : { + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack_2}, + "error.type" : "munit.ComparisonFailException", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "munit", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.is_retry" : "true", + "test.module" : "munit-junit-4", + "test.name" : "Calculator.add", + "test.retry_reason" : "atr", + "test.source.file" : "dummy_source_path", + "test.status" : "fail", + "test.suite" : "org.example.TestFailedMUnit", + "test.traits" : "{\"category\":[\"myTag\"]}", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_5}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "junit.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestFailedMUnit.Calculator.add", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id_2}, + "start" : ${content_start_5}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id_2} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_6}, + "error" : 1, + "meta" : { + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack_3}, + "error.type" : "munit.ComparisonFailException", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "munit", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.is_retry" : "true", + "test.module" : "munit-junit-4", + "test.name" : "Calculator.add", + "test.retry_reason" : "atr", + "test.source.file" : "dummy_source_path", + "test.status" : "fail", + "test.suite" : "org.example.TestFailedMUnit", + "test.traits" : "{\"category\":[\"myTag\"]}", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_6}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "junit.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestFailedMUnit.Calculator.add", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id_3}, + "start" : ${content_start_6}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id_3} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_7}, + "error" : 1, + "meta" : { + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack_4}, + "error.type" : "munit.ComparisonFailException", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "munit", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.is_retry" : "true", + "test.module" : "munit-junit-4", + "test.name" : "Calculator.add", + "test.retry_reason" : "atr", + "test.source.file" : "dummy_source_path", + "test.status" : "fail", + "test.suite" : "org.example.TestFailedMUnit", + "test.traits" : "{\"category\":[\"myTag\"]}", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_7}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "junit.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestFailedMUnit.Calculator.add", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id_4}, + "start" : ${content_start_7}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id_4} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_8}, + "error" : 1, + "meta" : { + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack_5}, + "error.type" : "munit.ComparisonFailException", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "munit", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.is_retry" : "true", + "test.module" : "munit-junit-4", + "test.name" : "Calculator.add", + "test.retry_reason" : "atr", + "test.source.file" : "dummy_source_path", + "test.status" : "fail", + "test.suite" : "org.example.TestFailedMUnit", + "test.traits" : "{\"category\":[\"myTag\"]}", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_8}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "junit.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestFailedMUnit.Calculator.add", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id_5}, + "start" : ${content_start_8}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id_5} + }, + "type" : "test", + "version" : 2 +} ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-failed-efd/coverages.ftl b/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-quarantined-failed-efd/coverages.ftl similarity index 100% rename from dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-failed-efd/coverages.ftl rename to dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-quarantined-failed-efd/coverages.ftl diff --git a/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-failed-efd/events.ftl b/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-quarantined-failed-efd/events.ftl similarity index 100% rename from dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-failed-efd/events.ftl rename to dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-quarantined-failed-efd/events.ftl diff --git a/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-failed-parameterized/coverages.ftl b/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-quarantined-failed/coverages.ftl similarity index 100% rename from dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-failed-parameterized/coverages.ftl rename to dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-quarantined-failed/coverages.ftl diff --git a/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-quarantined-failed/events.ftl b/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-quarantined-failed/events.ftl new file mode 100644 index 00000000000..dc8e3421f59 --- /dev/null +++ b/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-quarantined-failed/events.ftl @@ -0,0 +1,151 @@ +[ { + "content" : { + "duration" : ${content_duration}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid}, + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test_session_end", + "test.command" : "munit-junit-4", + "test.framework" : "munit", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.status" : "fail", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "junit.test_session", + "resource" : "munit-junit-4", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_session_end", + "version" : 1 +}, { + "content" : { + "duration" : ${content_duration_2}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_2}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "library_version" : ${content_meta_library_version}, + "span.kind" : "test_module_end", + "test.framework" : "munit", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "munit-junit-4", + "test.status" : "fail", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_2} + }, + "name" : "junit.test_module", + "resource" : "munit-junit-4", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_2}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_module_end", + "version" : 1 +}, { + "content" : { + "duration" : ${content_duration_3}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_3}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "library_version" : ${content_meta_library_version}, + "span.kind" : "test_suite_end", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "munit", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "munit-junit-4", + "test.source.file" : "dummy_source_path", + "test.status" : "fail", + "test.suite" : "org.example.TestFailedMUnit", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_3}, + "test.source.end" : 19, + "test.source.start" : 11 + }, + "name" : "junit.test_suite", + "resource" : "org.example.TestFailedMUnit", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_3}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id} + }, + "type" : "test_suite_end", + "version" : 1 +}, { + "content" : { + "duration" : ${content_duration_4}, + "error" : 1, + "meta" : { + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack}, + "error.type" : "munit.ComparisonFailException", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "munit", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "munit-junit-4", + "test.name" : "Calculator.add", + "test.source.file" : "dummy_source_path", + "test.status" : "fail", + "test.suite" : "org.example.TestFailedMUnit", + "test.traits" : "{\"category\":[\"myTag\"]}", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_4}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "junit.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestFailedMUnit.Calculator.add", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id}, + "start" : ${content_start_4}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id} + }, + "type" : "test", + "version" : 2 +} ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/junit-4.10/src/main/java/datadog/trace/instrumentation/junit4/JUnit4TracingListener.java b/dd-java-agent/instrumentation/junit-4.10/src/main/java/datadog/trace/instrumentation/junit4/JUnit4TracingListener.java index de0ecc306d0..4fa292924d7 100644 --- a/dd-java-agent/instrumentation/junit-4.10/src/main/java/datadog/trace/instrumentation/junit4/JUnit4TracingListener.java +++ b/dd-java-agent/instrumentation/junit-4.10/src/main/java/datadog/trace/instrumentation/junit4/JUnit4TracingListener.java @@ -18,10 +18,10 @@ public class JUnit4TracingListener extends TracingListener { private static final String FRAMEWORK_NAME = "junit4"; private static final String FRAMEWORK_VERSION = Version.id(); - private final ContextStore retryPolicies; + private final ContextStore executionPolicies; - public JUnit4TracingListener(ContextStore retryPolicies) { - this.retryPolicies = retryPolicies; + public JUnit4TracingListener(ContextStore executionPolicies) { + this.executionPolicies = executionPolicies; } public void testSuiteStarted(final Description description) { @@ -74,7 +74,7 @@ public void testStarted(final Description description) { String testParameters = JUnit4Utils.getParameters(description); List categories = JUnit4Utils.getCategories(testSourceData.getTestClass(), testSourceData.getTestMethod()); - TestExecutionPolicy retryPolicy = retryPolicies.get(description); + TestExecutionPolicy executionPolicy = executionPolicies.get(description); TestEventsHandlerHolder.TEST_EVENTS_HANDLER.onTestStart( suiteDescriptor, @@ -85,7 +85,8 @@ public void testStarted(final Description description) { testParameters, categories, testSourceData, - retryPolicy != null ? retryPolicy.currentExecutionRetryReason() : null, + executionPolicy != null ? executionPolicy.currentExecutionRetryReason() : null, + executionPolicy != null && executionPolicy.hasFailedAllRetries(), null); } diff --git a/dd-java-agent/instrumentation/junit-4.10/src/test/groovy/JUnit4Test.groovy b/dd-java-agent/instrumentation/junit-4.10/src/test/groovy/JUnit4Test.groovy index fa27adcfab9..e3cc0cb86bd 100644 --- a/dd-java-agent/instrumentation/junit-4.10/src/test/groovy/JUnit4Test.groovy +++ b/dd-java-agent/instrumentation/junit-4.10/src/test/groovy/JUnit4Test.groovy @@ -135,9 +135,9 @@ class JUnit4Test extends CiVisibilityInstrumentationTest { assertSpansData(testcaseName) where: - testcaseName | tests | quarantined - "test-failed" | [TestFailed] | [new TestIdentifier("org.example.TestFailed", "test_failed", null)] - "test-failed-parameterized" | [TestFailedParameterized] | [new TestIdentifier("org.example.TestFailedParameterized", "test_failed_parameterized", null)] + testcaseName | tests | quarantined + "test-quarantined-failed" | [TestFailed] | [new TestIdentifier("org.example.TestFailed", "test_failed", null)] + "test-quarantined-failed-parameterized" | [TestFailedParameterized] | [new TestIdentifier("org.example.TestFailedParameterized", "test_failed_parameterized", null)] } def "test quarantined auto-retries #testcaseName"() { @@ -153,8 +153,8 @@ class JUnit4Test extends CiVisibilityInstrumentationTest { assertSpansData(testcaseName) where: - testcaseName | tests | quarantined | retried - "test-retry-failed" | [TestFailed] | [new TestIdentifier("org.example.TestFailed", "test_failed", null)] | [new TestIdentifier("org.example.TestFailed", "test_failed", null)] + testcaseName | tests | quarantined | retried + "test-quarantined-failed-atr" | [TestFailed] | [new TestIdentifier("org.example.TestFailed", "test_failed", null)] | [new TestIdentifier("org.example.TestFailed", "test_failed", null)] } def "test quarantined early flakiness detection #testcaseName"() { @@ -170,9 +170,9 @@ class JUnit4Test extends CiVisibilityInstrumentationTest { assertSpansData(testcaseName) where: - testcaseName | tests | quarantined | known - "test-failed" | [TestFailed] | [new TestIdentifier("org.example.TestFailed", "test_failed", null)] | [new TestIdentifier("org.example.TestFailed", "test_failed", null)] - "test-failed-efd" | [TestFailed] | [new TestIdentifier("org.example.TestFailed", "test_failed", null)] | [] + testcaseName | tests | quarantined | known + "test-quarantined-failed" | [TestFailed] | [new TestIdentifier("org.example.TestFailed", "test_failed", null)] | [new TestIdentifier("org.example.TestFailed", "test_failed", null)] + "test-quarantined-failed-efd" | [TestFailed] | [new TestIdentifier("org.example.TestFailed", "test_failed", null)] | [] } private void runTests(Collection> tests, boolean expectSuccess = true) { diff --git a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-failed-efd/coverages.ftl b/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-quarantined-failed-atr/coverages.ftl similarity index 100% rename from dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-failed-efd/coverages.ftl rename to dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-quarantined-failed-atr/coverages.ftl diff --git a/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-quarantined-failed-atr/events.ftl b/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-quarantined-failed-atr/events.ftl new file mode 100644 index 00000000000..d4d008f55a7 --- /dev/null +++ b/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-quarantined-failed-atr/events.ftl @@ -0,0 +1,356 @@ +[ { + "content" : { + "duration" : ${content_duration}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid}, + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test_session_end", + "test.command" : "junit-4.10", + "test.framework" : "junit4", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.status" : "fail", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "junit.test_session", + "resource" : "junit-4.10", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_session_end", + "version" : 1 +}, { + "content" : { + "duration" : ${content_duration_2}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_2}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "library_version" : ${content_meta_library_version}, + "span.kind" : "test_module_end", + "test.framework" : "junit4", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "junit-4.10", + "test.status" : "fail", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_2} + }, + "name" : "junit.test_module", + "resource" : "junit-4.10", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_2}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_module_end", + "version" : 1 +}, { + "content" : { + "duration" : ${content_duration_3}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_3}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "library_version" : ${content_meta_library_version}, + "span.kind" : "test_suite_end", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "junit4", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "junit-4.10", + "test.source.file" : "dummy_source_path", + "test.status" : "fail", + "test.suite" : "org.example.TestFailed", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_3}, + "test.source.end" : 19, + "test.source.start" : 11 + }, + "name" : "junit.test_suite", + "resource" : "org.example.TestFailed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_3}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id} + }, + "type" : "test_suite_end", + "version" : 1 +}, { + "content" : { + "duration" : ${content_duration_4}, + "error" : 1, + "meta" : { + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.stack" : ${content_meta_error_stack}, + "error.type" : "java.lang.AssertionError", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "junit4", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "junit-4.10", + "test.name" : "test_failed", + "test.source.file" : "dummy_source_path", + "test.source.method" : "test_failed()V", + "test.status" : "fail", + "test.suite" : "org.example.TestFailed", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_4}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id}, + "test.source.end" : 18, + "test.source.start" : 12 + }, + "name" : "junit.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestFailed.test_failed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id}, + "start" : ${content_start_4}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_5}, + "error" : 1, + "meta" : { + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.stack" : ${content_meta_error_stack_2}, + "error.type" : "java.lang.AssertionError", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "junit4", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.is_retry" : "true", + "test.module" : "junit-4.10", + "test.name" : "test_failed", + "test.retry_reason" : "atr", + "test.source.file" : "dummy_source_path", + "test.source.method" : "test_failed()V", + "test.status" : "fail", + "test.suite" : "org.example.TestFailed", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_5}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id}, + "test.source.end" : 18, + "test.source.start" : 12 + }, + "name" : "junit.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestFailed.test_failed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id_2}, + "start" : ${content_start_5}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id_2} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_6}, + "error" : 1, + "meta" : { + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.stack" : ${content_meta_error_stack_3}, + "error.type" : "java.lang.AssertionError", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "junit4", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.is_retry" : "true", + "test.module" : "junit-4.10", + "test.name" : "test_failed", + "test.retry_reason" : "atr", + "test.source.file" : "dummy_source_path", + "test.source.method" : "test_failed()V", + "test.status" : "fail", + "test.suite" : "org.example.TestFailed", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_6}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id}, + "test.source.end" : 18, + "test.source.start" : 12 + }, + "name" : "junit.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestFailed.test_failed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id_3}, + "start" : ${content_start_6}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id_3} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_7}, + "error" : 1, + "meta" : { + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.stack" : ${content_meta_error_stack_4}, + "error.type" : "java.lang.AssertionError", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "junit4", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.is_retry" : "true", + "test.module" : "junit-4.10", + "test.name" : "test_failed", + "test.retry_reason" : "atr", + "test.source.file" : "dummy_source_path", + "test.source.method" : "test_failed()V", + "test.status" : "fail", + "test.suite" : "org.example.TestFailed", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_7}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id}, + "test.source.end" : 18, + "test.source.start" : 12 + }, + "name" : "junit.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestFailed.test_failed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id_4}, + "start" : ${content_start_7}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id_4} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_8}, + "error" : 1, + "meta" : { + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.stack" : ${content_meta_error_stack_5}, + "error.type" : "java.lang.AssertionError", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "junit4", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.is_retry" : "true", + "test.module" : "junit-4.10", + "test.name" : "test_failed", + "test.retry_reason" : "atr", + "test.source.file" : "dummy_source_path", + "test.source.method" : "test_failed()V", + "test.status" : "fail", + "test.suite" : "org.example.TestFailed", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_8}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id}, + "test.source.end" : 18, + "test.source.start" : 12 + }, + "name" : "junit.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestFailed.test_failed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id_5}, + "start" : ${content_start_8}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id_5} + }, + "type" : "test", + "version" : 2 +} ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-failed-parameterized/coverages.ftl b/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-quarantined-failed-efd/coverages.ftl similarity index 100% rename from dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-failed-parameterized/coverages.ftl rename to dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-quarantined-failed-efd/coverages.ftl diff --git a/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-failed-efd/events.ftl b/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-quarantined-failed-efd/events.ftl similarity index 100% rename from dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-failed-efd/events.ftl rename to dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-quarantined-failed-efd/events.ftl diff --git a/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-failed-efd/coverages.ftl b/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-quarantined-failed-parameterized/coverages.ftl similarity index 100% rename from dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-failed-efd/coverages.ftl rename to dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-quarantined-failed-parameterized/coverages.ftl diff --git a/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-failed-parameterized/events.ftl b/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-quarantined-failed-parameterized/events.ftl similarity index 100% rename from dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-failed-parameterized/events.ftl rename to dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-quarantined-failed-parameterized/events.ftl diff --git a/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-failed-parameterized/coverages.ftl b/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-quarantined-failed/coverages.ftl similarity index 100% rename from dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-failed-parameterized/coverages.ftl rename to dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-quarantined-failed/coverages.ftl diff --git a/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-quarantined-failed/events.ftl b/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-quarantined-failed/events.ftl new file mode 100644 index 00000000000..661f29b1b5f --- /dev/null +++ b/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-quarantined-failed/events.ftl @@ -0,0 +1,152 @@ +[ { + "content" : { + "duration" : ${content_duration}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid}, + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test_session_end", + "test.command" : "junit-4.10", + "test.framework" : "junit4", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.status" : "fail", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "junit.test_session", + "resource" : "junit-4.10", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_session_end", + "version" : 1 +}, { + "content" : { + "duration" : ${content_duration_2}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_2}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "library_version" : ${content_meta_library_version}, + "span.kind" : "test_module_end", + "test.framework" : "junit4", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "junit-4.10", + "test.status" : "fail", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_2} + }, + "name" : "junit.test_module", + "resource" : "junit-4.10", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_2}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_module_end", + "version" : 1 +}, { + "content" : { + "duration" : ${content_duration_3}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_3}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "library_version" : ${content_meta_library_version}, + "span.kind" : "test_suite_end", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "junit4", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "junit-4.10", + "test.source.file" : "dummy_source_path", + "test.status" : "fail", + "test.suite" : "org.example.TestFailed", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_3}, + "test.source.end" : 19, + "test.source.start" : 11 + }, + "name" : "junit.test_suite", + "resource" : "org.example.TestFailed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_3}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id} + }, + "type" : "test_suite_end", + "version" : 1 +}, { + "content" : { + "duration" : ${content_duration_4}, + "error" : 1, + "meta" : { + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.stack" : ${content_meta_error_stack}, + "error.type" : "java.lang.AssertionError", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "junit4", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "junit-4.10", + "test.name" : "test_failed", + "test.source.file" : "dummy_source_path", + "test.source.method" : "test_failed()V", + "test.status" : "fail", + "test.suite" : "org.example.TestFailed", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_4}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id}, + "test.source.end" : 18, + "test.source.start" : 12 + }, + "name" : "junit.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestFailed.test_failed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id}, + "start" : ${content_start_4}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id} + }, + "type" : "test", + "version" : 2 +} ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/main/java/datadog/trace/instrumentation/junit5/CucumberTracingListener.java b/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/main/java/datadog/trace/instrumentation/junit5/CucumberTracingListener.java index 904609e0f06..d97b78e5be3 100644 --- a/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/main/java/datadog/trace/instrumentation/junit5/CucumberTracingListener.java +++ b/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/main/java/datadog/trace/instrumentation/junit5/CucumberTracingListener.java @@ -124,6 +124,7 @@ private void testResourceExecutionStarted( tags, TestSourceData.UNKNOWN, JUnitPlatformUtils.retryReason(testDescriptor), + JUnitPlatformUtils.hasFailedAllRetries(testDescriptor), null); CoveragePerTestBridge.recordCoverage(classpathResourceName); diff --git a/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/groovy/CucumberTest.groovy b/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/groovy/CucumberTest.groovy index 5f2f57f5bb3..f52b798eb4f 100644 --- a/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/groovy/CucumberTest.groovy +++ b/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/groovy/CucumberTest.groovy @@ -108,8 +108,8 @@ class CucumberTest extends CiVisibilityInstrumentationTest { assertSpansData(testcaseName) where: - testcaseName | features | quarantined - "test-failed" | ["org/example/cucumber/calculator/basic_arithmetic_failed.feature"] | [ + testcaseName | features | quarantined + "test-quarantined-failed" | ["org/example/cucumber/calculator/basic_arithmetic_failed.feature"] | [ new TestIdentifier("classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic", "Addition", null) ] } @@ -127,10 +127,10 @@ class CucumberTest extends CiVisibilityInstrumentationTest { assertSpansData(testcaseName) where: - testcaseName | features | quarantined | retried - "test-retry-failed" | ["org/example/cucumber/calculator/basic_arithmetic_failed.feature"] | [ + testcaseName | features | quarantined | retried + "test-quarantined-failed-atr" | ["org/example/cucumber/calculator/basic_arithmetic_failed.feature"] | [ new TestIdentifier("classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic", "Addition", null) - ] | [ + ] | [ new TestIdentifier("classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic", "Addition", null) ] } @@ -148,15 +148,15 @@ class CucumberTest extends CiVisibilityInstrumentationTest { assertSpansData(testcaseName) where: - testcaseName | features | quarantined | known - "test-failed" | ["org/example/cucumber/calculator/basic_arithmetic_failed.feature"] | [ + testcaseName | features | quarantined | known + "test-quarantined-failed" | ["org/example/cucumber/calculator/basic_arithmetic_failed.feature"] | [ new TestIdentifier("classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic", "Addition", null) - ] | [ + ] | [ new TestIdentifier("classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic", "Addition", null) ] - "test-failed-efd" | ["org/example/cucumber/calculator/basic_arithmetic_failed.feature"] | [ + "test-quarantined-failed-efd" | ["org/example/cucumber/calculator/basic_arithmetic_failed.feature"] | [ new TestIdentifier("classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic", "Addition", null) - ] | [] + ] | [] } private String parameterizedTestNameSuffix() { diff --git a/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-quarantined-failed-atr/coverages.ftl b/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-quarantined-failed-atr/coverages.ftl new file mode 100644 index 00000000000..aed9df93b31 --- /dev/null +++ b/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-quarantined-failed-atr/coverages.ftl @@ -0,0 +1,36 @@ +[ { + "files" : [ { + "filename" : "org/example/cucumber/calculator/basic_arithmetic_failed.feature" + } ], + "span_id" : ${content_span_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id} +}, { + "files" : [ { + "filename" : "org/example/cucumber/calculator/basic_arithmetic_failed.feature" + } ], + "span_id" : ${content_span_id_2}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id} +}, { + "files" : [ { + "filename" : "org/example/cucumber/calculator/basic_arithmetic_failed.feature" + } ], + "span_id" : ${content_span_id_3}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id} +}, { + "files" : [ { + "filename" : "org/example/cucumber/calculator/basic_arithmetic_failed.feature" + } ], + "span_id" : ${content_span_id_4}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id} +}, { + "files" : [ { + "filename" : "org/example/cucumber/calculator/basic_arithmetic_failed.feature" + } ], + "span_id" : ${content_span_id_5}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id} +} ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-quarantined-failed-atr/events.ftl b/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-quarantined-failed-atr/events.ftl new file mode 100644 index 00000000000..bb58917bee1 --- /dev/null +++ b/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-quarantined-failed-atr/events.ftl @@ -0,0 +1,337 @@ +[ { + "content" : { + "duration" : ${content_duration}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "library_version" : ${content_meta_library_version}, + "span.kind" : "test_suite_end", + "test.framework" : "cucumber", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "cucumber-junit-5", + "test.status" : "fail", + "test.suite" : "classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count} + }, + "name" : "junit.test_suite", + "resource" : "classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id} + }, + "type" : "test_suite_end", + "version" : 1 +}, { + "content" : { + "duration" : ${content_duration_2}, + "error" : 1, + "meta" : { + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack}, + "error.type" : "java.lang.AssertionError", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test", + "test.framework" : "cucumber", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "cucumber-junit-5", + "test.name" : "Addition", + "test.status" : "fail", + "test.suite" : "classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic", + "test.traits" : "{\"category\":[\"foo\"]}", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_2}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "junit.test", + "parent_id" : ${content_parent_id}, + "resource" : "classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic.Addition", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id}, + "start" : ${content_start_2}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_3}, + "error" : 1, + "meta" : { + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack_2}, + "error.type" : "java.lang.AssertionError", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test", + "test.framework" : "cucumber", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.is_retry" : "true", + "test.module" : "cucumber-junit-5", + "test.name" : "Addition", + "test.retry_reason" : "atr", + "test.status" : "fail", + "test.suite" : "classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic", + "test.traits" : "{\"category\":[\"foo\"]}", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_3}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "junit.test", + "parent_id" : ${content_parent_id}, + "resource" : "classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic.Addition", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id_2}, + "start" : ${content_start_3}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id_2} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_4}, + "error" : 1, + "meta" : { + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack_3}, + "error.type" : "java.lang.AssertionError", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test", + "test.framework" : "cucumber", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.is_retry" : "true", + "test.module" : "cucumber-junit-5", + "test.name" : "Addition", + "test.retry_reason" : "atr", + "test.status" : "fail", + "test.suite" : "classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic", + "test.traits" : "{\"category\":[\"foo\"]}", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_4}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "junit.test", + "parent_id" : ${content_parent_id}, + "resource" : "classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic.Addition", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id_3}, + "start" : ${content_start_4}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id_3} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_5}, + "error" : 1, + "meta" : { + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack_4}, + "error.type" : "java.lang.AssertionError", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test", + "test.framework" : "cucumber", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.is_retry" : "true", + "test.module" : "cucumber-junit-5", + "test.name" : "Addition", + "test.retry_reason" : "atr", + "test.status" : "fail", + "test.suite" : "classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic", + "test.traits" : "{\"category\":[\"foo\"]}", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_5}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "junit.test", + "parent_id" : ${content_parent_id}, + "resource" : "classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic.Addition", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id_4}, + "start" : ${content_start_5}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id_4} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_6}, + "error" : 1, + "meta" : { + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack_5}, + "error.type" : "java.lang.AssertionError", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test", + "test.framework" : "cucumber", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.is_retry" : "true", + "test.module" : "cucumber-junit-5", + "test.name" : "Addition", + "test.retry_reason" : "atr", + "test.status" : "fail", + "test.suite" : "classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic", + "test.traits" : "{\"category\":[\"foo\"]}", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_6}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "junit.test", + "parent_id" : ${content_parent_id}, + "resource" : "classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic.Addition", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id_5}, + "start" : ${content_start_6}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id_5} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_7}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_2}, + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test_session_end", + "test.command" : "cucumber-junit-5", + "test.framework" : "cucumber", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.status" : "fail", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_7}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "junit.test_session", + "resource" : "cucumber-junit-5", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_7}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_session_end", + "version" : 1 +}, { + "content" : { + "duration" : ${content_duration_8}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_3}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "library_version" : ${content_meta_library_version}, + "span.kind" : "test_module_end", + "test.framework" : "cucumber", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "cucumber-junit-5", + "test.status" : "fail", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_8} + }, + "name" : "junit.test_module", + "resource" : "cucumber-junit-5", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_8}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_module_end", + "version" : 1 +} ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-failed-efd/coverages.ftl b/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-quarantined-failed-efd/coverages.ftl similarity index 100% rename from dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-failed-efd/coverages.ftl rename to dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-quarantined-failed-efd/coverages.ftl diff --git a/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-failed-efd/events.ftl b/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-quarantined-failed-efd/events.ftl similarity index 100% rename from dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-failed-efd/events.ftl rename to dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-quarantined-failed-efd/events.ftl diff --git a/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-quarantined-failed/coverages.ftl b/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-quarantined-failed/coverages.ftl new file mode 100644 index 00000000000..e48f884bdbe --- /dev/null +++ b/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-quarantined-failed/coverages.ftl @@ -0,0 +1,8 @@ +[ { + "files" : [ { + "filename" : "org/example/cucumber/calculator/basic_arithmetic_failed.feature" + } ], + "span_id" : ${content_span_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id} +} ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-quarantined-failed/events.ftl b/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-quarantined-failed/events.ftl new file mode 100644 index 00000000000..dd668874669 --- /dev/null +++ b/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-quarantined-failed/events.ftl @@ -0,0 +1,145 @@ +[ { + "content" : { + "duration" : ${content_duration}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "library_version" : ${content_meta_library_version}, + "span.kind" : "test_suite_end", + "test.framework" : "cucumber", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "cucumber-junit-5", + "test.status" : "fail", + "test.suite" : "classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count} + }, + "name" : "junit.test_suite", + "resource" : "classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id} + }, + "type" : "test_suite_end", + "version" : 1 +}, { + "content" : { + "duration" : ${content_duration_2}, + "error" : 1, + "meta" : { + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack}, + "error.type" : "java.lang.AssertionError", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test", + "test.framework" : "cucumber", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "cucumber-junit-5", + "test.name" : "Addition", + "test.status" : "fail", + "test.suite" : "classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic", + "test.traits" : "{\"category\":[\"foo\"]}", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_2}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "junit.test", + "parent_id" : ${content_parent_id}, + "resource" : "classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic.Addition", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id}, + "start" : ${content_start_2}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_3}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_2}, + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test_session_end", + "test.command" : "cucumber-junit-5", + "test.framework" : "cucumber", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.status" : "fail", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_3}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "junit.test_session", + "resource" : "cucumber-junit-5", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_3}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_session_end", + "version" : 1 +}, { + "content" : { + "duration" : ${content_duration_4}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_3}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "library_version" : ${content_meta_library_version}, + "span.kind" : "test_module_end", + "test.framework" : "cucumber", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "cucumber-junit-5", + "test.status" : "fail", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_4} + }, + "name" : "junit.test_module", + "resource" : "cucumber-junit-5", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_4}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_module_end", + "version" : 1 +} ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/main/java/datadog/trace/instrumentation/junit5/SpockTracingListener.java b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/main/java/datadog/trace/instrumentation/junit5/SpockTracingListener.java index bd9b58841b7..53cb8244040 100644 --- a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/main/java/datadog/trace/instrumentation/junit5/SpockTracingListener.java +++ b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/main/java/datadog/trace/instrumentation/junit5/SpockTracingListener.java @@ -125,6 +125,7 @@ private void testMethodExecutionStarted(TestDescriptor testDescriptor, MethodSou tags, testSourceData, JUnitPlatformUtils.retryReason(testDescriptor), + JUnitPlatformUtils.hasFailedAllRetries(testDescriptor), null); } diff --git a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/groovy/SpockTest.groovy b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/groovy/SpockTest.groovy index e7ea2814d38..0f1be0dd8ed 100644 --- a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/groovy/SpockTest.groovy +++ b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/groovy/SpockTest.groovy @@ -142,9 +142,9 @@ class SpockTest extends CiVisibilityInstrumentationTest { assertSpansData(testcaseName) where: - testcaseName | tests | quarantined - "test-failed" | [TestFailedSpock] | [new TestIdentifier("org.example.TestFailedSpock", "test failed", null)] - "test-failed-parameterized" | [TestFailedParameterizedSpock] | [new TestIdentifier("org.example.TestFailedParameterizedSpock", "test add 4 and 4", null)] + testcaseName | tests | quarantined + "test-quarantined-failed" | [TestFailedSpock] | [new TestIdentifier("org.example.TestFailedSpock", "test failed", null)] + "test-quarantined-failed-parameterized" | [TestFailedParameterizedSpock] | [new TestIdentifier("org.example.TestFailedParameterizedSpock", "test add 4 and 4", null)] } def "test quarantined auto-retries #testcaseName"() { @@ -160,8 +160,8 @@ class SpockTest extends CiVisibilityInstrumentationTest { assertSpansData(testcaseName) where: - testcaseName | tests | quarantined | retried - "test-retry-failed" | [TestFailedSpock] | [new TestIdentifier("org.example.TestFailedSpock", "test failed", null)] | [new TestIdentifier("org.example.TestFailedSpock", "test failed", null)] + testcaseName | tests | quarantined | retried + "test-quarantined-failed-atr" | [TestFailedSpock] | [new TestIdentifier("org.example.TestFailedSpock", "test failed", null)] | [new TestIdentifier("org.example.TestFailedSpock", "test failed", null)] } def "test quarantined early flakiness detection #testcaseName"() { @@ -177,9 +177,9 @@ class SpockTest extends CiVisibilityInstrumentationTest { assertSpansData(testcaseName) where: - testcaseName | tests | quarantined | known - "test-failed" | [TestFailedSpock] | [new TestIdentifier("org.example.TestFailedSpock", "test failed", null)] | [new TestIdentifier("org.example.TestFailedSpock", "test failed", null)] - "test-failed-efd" | [TestFailedSpock] | [new TestIdentifier("org.example.TestFailedSpock", "test failed", null)] | [] + testcaseName | tests | quarantined | known + "test-quarantined-failed" | [TestFailedSpock] | [new TestIdentifier("org.example.TestFailedSpock", "test failed", null)] | [new TestIdentifier("org.example.TestFailedSpock", "test failed", null)] + "test-quarantined-failed-efd" | [TestFailedSpock] | [new TestIdentifier("org.example.TestFailedSpock", "test failed", null)] | [] } private static void runTests(List> classes, boolean expectSuccess = true) { diff --git a/dd-java-agent/instrumentation/karate/src/test/resources/test-failed-quarantine/coverages.ftl b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed-atr/coverages.ftl similarity index 100% rename from dd-java-agent/instrumentation/karate/src/test/resources/test-failed-quarantine/coverages.ftl rename to dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed-atr/coverages.ftl diff --git a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed-atr/events.ftl b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed-atr/events.ftl new file mode 100644 index 00000000000..494677c86bb --- /dev/null +++ b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed-atr/events.ftl @@ -0,0 +1,366 @@ +[ { + "content" : { + "duration" : ${content_duration}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "library_version" : ${content_meta_library_version}, + "span.kind" : "test_suite_end", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "spock", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "spock-junit-5", + "test.source.file" : "dummy_source_path", + "test.status" : "fail", + "test.suite" : "org.example.TestFailedSpock", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count}, + "test.source.end" : 19, + "test.source.start" : 11 + }, + "name" : "junit.test_suite", + "resource" : "org.example.TestFailedSpock", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id} + }, + "type" : "test_suite_end", + "version" : 1 +}, { + "content" : { + "duration" : ${content_duration_2}, + "error" : 1, + "meta" : { + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack}, + "error.type" : "org.spockframework.runtime.SpockComparisonFailure", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "spock", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.is_new" : "true", + "test.module" : "spock-junit-5", + "test.name" : "test failed", + "test.source.file" : "dummy_source_path", + "test.source.method" : "test failed()V", + "test.status" : "fail", + "test.suite" : "org.example.TestFailedSpock", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_2}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id}, + "test.source.end" : 18, + "test.source.start" : 12 + }, + "name" : "junit.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestFailedSpock.test failed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id}, + "start" : ${content_start_2}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_3}, + "error" : 1, + "meta" : { + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack_2}, + "error.type" : "org.spockframework.runtime.SpockComparisonFailure", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "spock", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.is_new" : "true", + "test.is_retry" : "true", + "test.module" : "spock-junit-5", + "test.name" : "test failed", + "test.retry_reason" : "atr", + "test.source.file" : "dummy_source_path", + "test.source.method" : "test failed()V", + "test.status" : "fail", + "test.suite" : "org.example.TestFailedSpock", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_3}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id}, + "test.source.end" : 18, + "test.source.start" : 12 + }, + "name" : "junit.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestFailedSpock.test failed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id_2}, + "start" : ${content_start_3}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id_2} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_4}, + "error" : 1, + "meta" : { + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack_3}, + "error.type" : "org.spockframework.runtime.SpockComparisonFailure", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "spock", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.is_new" : "true", + "test.is_retry" : "true", + "test.module" : "spock-junit-5", + "test.name" : "test failed", + "test.retry_reason" : "atr", + "test.source.file" : "dummy_source_path", + "test.source.method" : "test failed()V", + "test.status" : "fail", + "test.suite" : "org.example.TestFailedSpock", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_4}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id}, + "test.source.end" : 18, + "test.source.start" : 12 + }, + "name" : "junit.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestFailedSpock.test failed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id_3}, + "start" : ${content_start_4}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id_3} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_5}, + "error" : 1, + "meta" : { + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack_4}, + "error.type" : "org.spockframework.runtime.SpockComparisonFailure", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "spock", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.is_new" : "true", + "test.is_retry" : "true", + "test.module" : "spock-junit-5", + "test.name" : "test failed", + "test.retry_reason" : "atr", + "test.source.file" : "dummy_source_path", + "test.source.method" : "test failed()V", + "test.status" : "fail", + "test.suite" : "org.example.TestFailedSpock", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_5}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id}, + "test.source.end" : 18, + "test.source.start" : 12 + }, + "name" : "junit.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestFailedSpock.test failed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id_4}, + "start" : ${content_start_5}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id_4} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_6}, + "error" : 1, + "meta" : { + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack_5}, + "error.type" : "org.spockframework.runtime.SpockComparisonFailure", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "spock", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.is_new" : "true", + "test.is_retry" : "true", + "test.module" : "spock-junit-5", + "test.name" : "test failed", + "test.retry_reason" : "atr", + "test.source.file" : "dummy_source_path", + "test.source.method" : "test failed()V", + "test.status" : "fail", + "test.suite" : "org.example.TestFailedSpock", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_6}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id}, + "test.source.end" : 18, + "test.source.start" : 12 + }, + "name" : "junit.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestFailedSpock.test failed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id_5}, + "start" : ${content_start_6}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id_5} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_7}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_2}, + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test_session_end", + "test.command" : "spock-junit-5", + "test.framework" : "spock", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.status" : "fail", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_7}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "junit.test_session", + "resource" : "spock-junit-5", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_7}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_session_end", + "version" : 1 +}, { + "content" : { + "duration" : ${content_duration_8}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_3}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "library_version" : ${content_meta_library_version}, + "span.kind" : "test_module_end", + "test.framework" : "spock", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "spock-junit-5", + "test.status" : "fail", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_8} + }, + "name" : "junit.test_module", + "resource" : "spock-junit-5", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_8}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_module_end", + "version" : 1 +} ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/scalatest/src/test/resources/test-failed-efd/coverages.ftl b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed-efd/coverages.ftl similarity index 100% rename from dd-java-agent/instrumentation/scalatest/src/test/resources/test-failed-efd/coverages.ftl rename to dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed-efd/coverages.ftl diff --git a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-failed-efd/events.ftl b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed-efd/events.ftl similarity index 100% rename from dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-failed-efd/events.ftl rename to dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed-efd/events.ftl diff --git a/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-failed-efd/coverages.ftl b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed-parameterized/coverages.ftl similarity index 100% rename from dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-failed-efd/coverages.ftl rename to dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed-parameterized/coverages.ftl diff --git a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-failed-parameterized/events.ftl b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed-parameterized/events.ftl similarity index 100% rename from dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-failed-parameterized/events.ftl rename to dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed-parameterized/events.ftl diff --git a/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-failed-parameterized/coverages.ftl b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed/coverages.ftl similarity index 100% rename from dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-failed-parameterized/coverages.ftl rename to dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed/coverages.ftl diff --git a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed/events.ftl b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed/events.ftl new file mode 100644 index 00000000000..139ab206207 --- /dev/null +++ b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed/events.ftl @@ -0,0 +1,153 @@ +[ { + "content" : { + "duration" : ${content_duration}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "library_version" : ${content_meta_library_version}, + "span.kind" : "test_suite_end", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "spock", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "spock-junit-5", + "test.source.file" : "dummy_source_path", + "test.status" : "fail", + "test.suite" : "org.example.TestFailedSpock", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count}, + "test.source.end" : 19, + "test.source.start" : 11 + }, + "name" : "junit.test_suite", + "resource" : "org.example.TestFailedSpock", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id} + }, + "type" : "test_suite_end", + "version" : 1 +}, { + "content" : { + "duration" : ${content_duration_2}, + "error" : 1, + "meta" : { + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack}, + "error.type" : "org.spockframework.runtime.SpockComparisonFailure", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "spock", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "spock-junit-5", + "test.name" : "test failed", + "test.source.file" : "dummy_source_path", + "test.source.method" : "test failed()V", + "test.status" : "fail", + "test.suite" : "org.example.TestFailedSpock", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_2}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id}, + "test.source.end" : 18, + "test.source.start" : 12 + }, + "name" : "junit.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestFailedSpock.test failed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id}, + "start" : ${content_start_2}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_3}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_2}, + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test_session_end", + "test.command" : "spock-junit-5", + "test.framework" : "spock", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.status" : "fail", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_3}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "junit.test_session", + "resource" : "spock-junit-5", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_3}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_session_end", + "version" : 1 +}, { + "content" : { + "duration" : ${content_duration_4}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_3}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "library_version" : ${content_meta_library_version}, + "span.kind" : "test_module_end", + "test.framework" : "spock", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "spock-junit-5", + "test.status" : "fail", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_4} + }, + "name" : "junit.test_module", + "resource" : "spock-junit-5", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_4}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_module_end", + "version" : 1 +} ] diff --git a/dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/JUnitPlatformUtils.java b/dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/JUnitPlatformUtils.java index db0e5215d43..ef03ba502a0 100644 --- a/dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/JUnitPlatformUtils.java +++ b/dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/JUnitPlatformUtils.java @@ -37,6 +37,7 @@ public abstract class JUnitPlatformUtils { public static final String RETRY_DESCRIPTOR_REASON_SUFFIX = "retry-reason"; public static final String RETRY_DESCRIPTOR_ID_SUFFIX = "retry-attempt"; + public static final String HAS_FAILED_ALL_RETRIES_SUFFIX = "failed-all-retries"; private static final Logger LOGGER = LoggerFactory.getLogger(JUnitPlatformUtils.class); @@ -195,6 +196,10 @@ public static boolean isRetry(TestDescriptor testDescriptor) { return getIDSegmentValue(testDescriptor, RETRY_DESCRIPTOR_ID_SUFFIX) != null; } + public static boolean hasFailedAllRetries(TestDescriptor testDescriptor) { + return getIDSegmentValue(testDescriptor, HAS_FAILED_ALL_RETRIES_SUFFIX) != null; + } + private static String getIDSegmentValue(TestDescriptor testDescriptor, String segmentName) { UniqueId uniqueId = testDescriptor.getUniqueId(); List segments = uniqueId.getSegments(); diff --git a/dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/TracingListener.java b/dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/TracingListener.java index 77fbc39e13e..47a4bbeaade 100644 --- a/dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/TracingListener.java +++ b/dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/TracingListener.java @@ -125,6 +125,7 @@ private void testMethodExecutionStarted(TestDescriptor testDescriptor, MethodSou tags, testSourceData, JUnitPlatformUtils.retryReason(testDescriptor), + JUnitPlatformUtils.hasFailedAllRetries(testDescriptor), null); } diff --git a/dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/retry/JUnit5ExecutionInstrumentation.java b/dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/retry/JUnit5ExecutionInstrumentation.java index 5cf7a6b87a5..56942d4e1ca 100644 --- a/dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/retry/JUnit5ExecutionInstrumentation.java +++ b/dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/retry/JUnit5ExecutionInstrumentation.java @@ -23,6 +23,7 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import java.util.ArrayList; import java.util.Collections; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; @@ -181,11 +182,18 @@ public static Boolean execute(@Advice.This HierarchicalTestExecutorService.TestT * require every test execution to have a distinct unique ID. * Rerunning a test with the ID that was executed previously will cause errors. */ - TestDescriptor retryDescriptor = - descriptorHandle.withIdSuffix( - JUnitPlatformUtils.RETRY_DESCRIPTOR_REASON_SUFFIX, - executionPolicy.currentExecutionRetryReason(), - JUnitPlatformUtils.RETRY_DESCRIPTOR_ID_SUFFIX, String.valueOf(++retryAttemptIdx)); + Map suffixes = new HashMap<>(); + suffixes.put( + JUnitPlatformUtils.RETRY_DESCRIPTOR_REASON_SUFFIX, + executionPolicy.currentExecutionRetryReason()); + suffixes.put( + JUnitPlatformUtils.RETRY_DESCRIPTOR_ID_SUFFIX, String.valueOf(++retryAttemptIdx)); + + if (executionPolicy.hasFailedAllRetries()) { + suffixes.put(JUnitPlatformUtils.HAS_FAILED_ALL_RETRIES_SUFFIX, "true"); + } + + TestDescriptor retryDescriptor = descriptorHandle.withIdSuffix(suffixes); taskHandle.setTestDescriptor(retryDescriptor); taskHandle.setNode((Node) retryDescriptor); taskHandle.getListener().dynamicTestRegistered(retryDescriptor); diff --git a/dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/retry/TestDescriptorHandle.java b/dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/retry/TestDescriptorHandle.java index e433f8633ba..9637f74106c 100644 --- a/dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/retry/TestDescriptorHandle.java +++ b/dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/retry/TestDescriptorHandle.java @@ -6,6 +6,7 @@ import java.lang.invoke.MethodHandle; import java.util.Collection; import java.util.Collections; +import java.util.Map; import org.junit.platform.commons.util.ClassLoaderUtils; import org.junit.platform.engine.TestDescriptor; import org.junit.platform.engine.UniqueId; @@ -42,13 +43,12 @@ public TestDescriptorHandle(TestDescriptor testDescriptor) { this.testDescriptor = UnsafeUtils.tryShallowClone(testDescriptor); } - public TestDescriptor withIdSuffix( - String segmentName, Object segmentValue, String otherSegmentName, Object otherSegmentValue) { - UniqueId uniqueId = testDescriptor.getUniqueId(); - UniqueId updatedId = - uniqueId - .append(segmentName, String.valueOf(segmentValue)) - .append(otherSegmentName, String.valueOf(otherSegmentValue)); + public TestDescriptor withIdSuffix(Map suffices) { + UniqueId updatedId = testDescriptor.getUniqueId(); + for (Map.Entry e : suffices.entrySet()) { + updatedId = updatedId.append(e.getKey(), String.valueOf(e.getValue())); + } + TestDescriptor descriptorClone = UnsafeUtils.tryShallowClone(testDescriptor); METHOD_HANDLES.invoke(UNIQUE_ID_SETTER, descriptorClone, updatedId); return descriptorClone; diff --git a/dd-java-agent/instrumentation/junit-5.3/src/test/groovy/JUnit5Test.groovy b/dd-java-agent/instrumentation/junit-5.3/src/test/groovy/JUnit5Test.groovy index c4257650728..fd639b78c2a 100644 --- a/dd-java-agent/instrumentation/junit-5.3/src/test/groovy/JUnit5Test.groovy +++ b/dd-java-agent/instrumentation/junit-5.3/src/test/groovy/JUnit5Test.groovy @@ -173,9 +173,9 @@ class JUnit5Test extends CiVisibilityInstrumentationTest { assertSpansData(testcaseName) where: - testcaseName | tests | quarantined - "test-failed" | [TestFailed] | [new TestIdentifier("org.example.TestFailed", "test_failed", null)] - "test-failed-parameterized" | [TestFailedParameterized] | [new TestIdentifier("org.example.TestFailedParameterized", "test_failed_parameterized", null)] + testcaseName | tests | quarantined + "test-quarantined-failed" | [TestFailed] | [new TestIdentifier("org.example.TestFailed", "test_failed", null)] + "test-quarantined-failed-parameterized" | [TestFailedParameterized] | [new TestIdentifier("org.example.TestFailedParameterized", "test_failed_parameterized", null)] } def "test quarantined auto-retries #testcaseName"() { @@ -191,8 +191,8 @@ class JUnit5Test extends CiVisibilityInstrumentationTest { assertSpansData(testcaseName) where: - testcaseName | tests | quarantined | retried - "test-retry-failed" | [TestFailed] | [new TestIdentifier("org.example.TestFailed", "test_failed", null)] | [new TestIdentifier("org.example.TestFailed", "test_failed", null)] + testcaseName | tests | quarantined | retried + "test-quarantined-failed-atr" | [TestFailed] | [new TestIdentifier("org.example.TestFailed", "test_failed", null)] | [new TestIdentifier("org.example.TestFailed", "test_failed", null)] } def "test quarantined early flakiness detection #testcaseName"() { @@ -208,9 +208,9 @@ class JUnit5Test extends CiVisibilityInstrumentationTest { assertSpansData(testcaseName) where: - testcaseName | tests | quarantined | known - "test-failed" | [TestFailed] | [new TestIdentifier("org.example.TestFailed", "test_failed", null)] | [new TestIdentifier("org.example.TestFailed", "test_failed", null)] - "test-failed-efd" | [TestFailed] | [new TestIdentifier("org.example.TestFailed", "test_failed", null)] | [] + testcaseName | tests | quarantined | known + "test-quarantined-failed" | [TestFailed] | [new TestIdentifier("org.example.TestFailed", "test_failed", null)] | [new TestIdentifier("org.example.TestFailed", "test_failed", null)] + "test-quarantined-failed-efd" | [TestFailed] | [new TestIdentifier("org.example.TestFailed", "test_failed", null)] | [] } protected void runTests(List> tests, boolean expectSuccess = true) { diff --git a/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed-atr/coverages.ftl b/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed-atr/coverages.ftl new file mode 100644 index 00000000000..8878e547a79 --- /dev/null +++ b/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed-atr/coverages.ftl @@ -0,0 +1 @@ +[ ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed-atr/events.ftl b/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed-atr/events.ftl new file mode 100644 index 00000000000..b789fefc1bf --- /dev/null +++ b/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed-atr/events.ftl @@ -0,0 +1,361 @@ +[ { + "content" : { + "duration" : ${content_duration}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid}, + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test_session_end", + "test.command" : "junit-5.3", + "test.framework" : "junit5", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.status" : "fail", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "junit.test_session", + "resource" : "junit-5.3", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_session_end", + "version" : 1 +}, { + "content" : { + "duration" : ${content_duration_2}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_2}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "library_version" : ${content_meta_library_version}, + "span.kind" : "test_module_end", + "test.framework" : "junit5", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "junit-5.3", + "test.status" : "fail", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_2} + }, + "name" : "junit.test_module", + "resource" : "junit-5.3", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_2}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_module_end", + "version" : 1 +}, { + "content" : { + "duration" : ${content_duration_3}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_3}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "library_version" : ${content_meta_library_version}, + "span.kind" : "test_suite_end", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "junit5", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "junit-5.3", + "test.source.file" : "dummy_source_path", + "test.status" : "fail", + "test.suite" : "org.example.TestFailed", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_3}, + "test.source.end" : 19, + "test.source.start" : 11 + }, + "name" : "junit.test_suite", + "resource" : "org.example.TestFailed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_3}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id} + }, + "type" : "test_suite_end", + "version" : 1 +}, { + "content" : { + "duration" : ${content_duration_4}, + "error" : 1, + "meta" : { + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack}, + "error.type" : "org.opentest4j.AssertionFailedError", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "junit5", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "junit-5.3", + "test.name" : "test_failed", + "test.source.file" : "dummy_source_path", + "test.source.method" : "test_failed()V", + "test.status" : "fail", + "test.suite" : "org.example.TestFailed", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_4}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id}, + "test.source.end" : 18, + "test.source.start" : 12 + }, + "name" : "junit.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestFailed.test_failed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id}, + "start" : ${content_start_4}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_5}, + "error" : 1, + "meta" : { + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack_2}, + "error.type" : "org.opentest4j.AssertionFailedError", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "junit5", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.is_retry" : "true", + "test.module" : "junit-5.3", + "test.name" : "test_failed", + "test.retry_reason" : "atr", + "test.source.file" : "dummy_source_path", + "test.source.method" : "test_failed()V", + "test.status" : "fail", + "test.suite" : "org.example.TestFailed", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_5}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id}, + "test.source.end" : 18, + "test.source.start" : 12 + }, + "name" : "junit.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestFailed.test_failed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id_2}, + "start" : ${content_start_5}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id_2} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_6}, + "error" : 1, + "meta" : { + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack_3}, + "error.type" : "org.opentest4j.AssertionFailedError", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "junit5", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.is_retry" : "true", + "test.module" : "junit-5.3", + "test.name" : "test_failed", + "test.retry_reason" : "atr", + "test.source.file" : "dummy_source_path", + "test.source.method" : "test_failed()V", + "test.status" : "fail", + "test.suite" : "org.example.TestFailed", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_6}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id}, + "test.source.end" : 18, + "test.source.start" : 12 + }, + "name" : "junit.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestFailed.test_failed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id_3}, + "start" : ${content_start_6}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id_3} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_7}, + "error" : 1, + "meta" : { + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack_4}, + "error.type" : "org.opentest4j.AssertionFailedError", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "junit5", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.is_retry" : "true", + "test.module" : "junit-5.3", + "test.name" : "test_failed", + "test.retry_reason" : "atr", + "test.source.file" : "dummy_source_path", + "test.source.method" : "test_failed()V", + "test.status" : "fail", + "test.suite" : "org.example.TestFailed", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_7}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id}, + "test.source.end" : 18, + "test.source.start" : 12 + }, + "name" : "junit.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestFailed.test_failed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id_4}, + "start" : ${content_start_7}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id_4} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_8}, + "error" : 1, + "meta" : { + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack_5}, + "error.type" : "org.opentest4j.AssertionFailedError", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "junit5", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.is_retry" : "true", + "test.module" : "junit-5.3", + "test.name" : "test_failed", + "test.retry_reason" : "atr", + "test.source.file" : "dummy_source_path", + "test.source.method" : "test_failed()V", + "test.status" : "fail", + "test.suite" : "org.example.TestFailed", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_8}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id}, + "test.source.end" : 18, + "test.source.start" : 12 + }, + "name" : "junit.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestFailed.test_failed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id_5}, + "start" : ${content_start_8}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id_5} + }, + "type" : "test", + "version" : 2 +} ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed-efd/coverages.ftl b/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed-efd/coverages.ftl new file mode 100644 index 00000000000..8878e547a79 --- /dev/null +++ b/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed-efd/coverages.ftl @@ -0,0 +1 @@ +[ ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-failed-efd/events.ftl b/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed-efd/events.ftl similarity index 100% rename from dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-failed-efd/events.ftl rename to dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed-efd/events.ftl diff --git a/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed-parameterized/coverages.ftl b/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed-parameterized/coverages.ftl new file mode 100644 index 00000000000..8878e547a79 --- /dev/null +++ b/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed-parameterized/coverages.ftl @@ -0,0 +1 @@ +[ ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-failed-parameterized/events.ftl b/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed-parameterized/events.ftl similarity index 100% rename from dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-failed-parameterized/events.ftl rename to dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed-parameterized/events.ftl diff --git a/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed/coverages.ftl b/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed/coverages.ftl new file mode 100644 index 00000000000..8878e547a79 --- /dev/null +++ b/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed/coverages.ftl @@ -0,0 +1 @@ +[ ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed/events.ftl b/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed/events.ftl new file mode 100644 index 00000000000..7c2c2feca53 --- /dev/null +++ b/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed/events.ftl @@ -0,0 +1,153 @@ +[ { + "content" : { + "duration" : ${content_duration}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid}, + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test_session_end", + "test.command" : "junit-5.3", + "test.framework" : "junit5", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.status" : "fail", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "junit.test_session", + "resource" : "junit-5.3", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_session_end", + "version" : 1 +}, { + "content" : { + "duration" : ${content_duration_2}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_2}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "library_version" : ${content_meta_library_version}, + "span.kind" : "test_module_end", + "test.framework" : "junit5", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "junit-5.3", + "test.status" : "fail", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_2} + }, + "name" : "junit.test_module", + "resource" : "junit-5.3", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_2}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_module_end", + "version" : 1 +}, { + "content" : { + "duration" : ${content_duration_3}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_3}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "library_version" : ${content_meta_library_version}, + "span.kind" : "test_suite_end", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "junit5", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "junit-5.3", + "test.source.file" : "dummy_source_path", + "test.status" : "fail", + "test.suite" : "org.example.TestFailed", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_3}, + "test.source.end" : 19, + "test.source.start" : 11 + }, + "name" : "junit.test_suite", + "resource" : "org.example.TestFailed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_3}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id} + }, + "type" : "test_suite_end", + "version" : 1 +}, { + "content" : { + "duration" : ${content_duration_4}, + "error" : 1, + "meta" : { + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack}, + "error.type" : "org.opentest4j.AssertionFailedError", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "junit5", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "junit-5.3", + "test.name" : "test_failed", + "test.source.file" : "dummy_source_path", + "test.source.method" : "test_failed()V", + "test.status" : "fail", + "test.suite" : "org.example.TestFailed", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_4}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id}, + "test.source.end" : 18, + "test.source.start" : 12 + }, + "name" : "junit.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestFailed.test_failed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id}, + "start" : ${content_start_4}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id} + }, + "type" : "test", + "version" : 2 +} ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/karate/src/main/java/datadog/trace/instrumentation/karate/KarateExecutionInstrumentation.java b/dd-java-agent/instrumentation/karate/src/main/java/datadog/trace/instrumentation/karate/KarateExecutionInstrumentation.java index b7386e7a673..bda51313ce5 100644 --- a/dd-java-agent/instrumentation/karate/src/main/java/datadog/trace/instrumentation/karate/KarateExecutionInstrumentation.java +++ b/dd-java-agent/instrumentation/karate/src/main/java/datadog/trace/instrumentation/karate/KarateExecutionInstrumentation.java @@ -106,6 +106,9 @@ public static void afterExecute(@Advice.This ScenarioRuntime scenarioRuntime) { new ScenarioRuntime(scenarioRuntime.featureRuntime, scenarioRuntime.scenario); retry.magicVariables.put( KarateUtils.RETRY_MAGIC_VARIABLE, executionPolicy.currentExecutionRetryReason()); + retry.magicVariables.put( + KarateUtils.HAS_FAILED_ALL_RETRIES_MAGIC_VARIABLE, + executionPolicy.hasFailedAllRetries()); retry.run(); retry.featureRuntime.result.addResult(retry.result); finalResult = retry.result; diff --git a/dd-java-agent/instrumentation/karate/src/main/java/datadog/trace/instrumentation/karate/KarateTracingHook.java b/dd-java-agent/instrumentation/karate/src/main/java/datadog/trace/instrumentation/karate/KarateTracingHook.java index 7be682983c7..36c49cda52d 100644 --- a/dd-java-agent/instrumentation/karate/src/main/java/datadog/trace/instrumentation/karate/KarateTracingHook.java +++ b/dd-java-agent/instrumentation/karate/src/main/java/datadog/trace/instrumentation/karate/KarateTracingHook.java @@ -145,6 +145,9 @@ public boolean beforeScenario(ScenarioRuntime sr) { categories, TestSourceData.UNKNOWN, (RetryReason) sr.magicVariables.get(KarateUtils.RETRY_MAGIC_VARIABLE), + (Boolean) + sr.magicVariables.getOrDefault( + KarateUtils.HAS_FAILED_ALL_RETRIES_MAGIC_VARIABLE, Boolean.FALSE), null); return true; } diff --git a/dd-java-agent/instrumentation/karate/src/main/java/datadog/trace/instrumentation/karate/KarateUtils.java b/dd-java-agent/instrumentation/karate/src/main/java/datadog/trace/instrumentation/karate/KarateUtils.java index b93213b0cb1..acda6d26c3f 100644 --- a/dd-java-agent/instrumentation/karate/src/main/java/datadog/trace/instrumentation/karate/KarateUtils.java +++ b/dd-java-agent/instrumentation/karate/src/main/java/datadog/trace/instrumentation/karate/KarateUtils.java @@ -22,6 +22,8 @@ public abstract class KarateUtils { public static final String RETRY_MAGIC_VARIABLE = "__datadog_retry"; + public static final String HAS_FAILED_ALL_RETRIES_MAGIC_VARIABLE = + "__datadog_has_failed_all_retries"; private KarateUtils() {} diff --git a/dd-java-agent/instrumentation/karate/src/test/groovy/KarateTest.groovy b/dd-java-agent/instrumentation/karate/src/test/groovy/KarateTest.groovy index 4f3b72c4657..3a866bd64e8 100644 --- a/dd-java-agent/instrumentation/karate/src/test/groovy/KarateTest.groovy +++ b/dd-java-agent/instrumentation/karate/src/test/groovy/KarateTest.groovy @@ -104,8 +104,8 @@ class KarateTest extends CiVisibilityInstrumentationTest { assertSpansData(testcaseName) where: - testcaseName | tests | quarantined - "test-failed-quarantine" | [TestFailedKarate] | [new TestIdentifier("[org/example/test_failed] test failed", "second scenario", null)] + testcaseName | tests | quarantined + "test-quarantined-failed" | [TestFailedKarate] | [new TestIdentifier("[org/example/test_failed] test failed", "second scenario", null)] } private void runTests(List> tests, boolean expectSuccess = true) { diff --git a/dd-java-agent/instrumentation/karate/src/test/resources/test-quarantined-failed/coverages.ftl b/dd-java-agent/instrumentation/karate/src/test/resources/test-quarantined-failed/coverages.ftl new file mode 100644 index 00000000000..8878e547a79 --- /dev/null +++ b/dd-java-agent/instrumentation/karate/src/test/resources/test-quarantined-failed/coverages.ftl @@ -0,0 +1 @@ +[ ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/karate/src/test/resources/test-failed-quarantine/events.ftl b/dd-java-agent/instrumentation/karate/src/test/resources/test-quarantined-failed/events.ftl similarity index 100% rename from dd-java-agent/instrumentation/karate/src/test/resources/test-failed-quarantine/events.ftl rename to dd-java-agent/instrumentation/karate/src/test/resources/test-quarantined-failed/events.ftl diff --git a/dd-java-agent/instrumentation/scalatest/src/main/java/datadog/trace/instrumentation/scalatest/DatadogReporter.java b/dd-java-agent/instrumentation/scalatest/src/main/java/datadog/trace/instrumentation/scalatest/DatadogReporter.java index 079cfee63b8..ba64c659f3e 100644 --- a/dd-java-agent/instrumentation/scalatest/src/main/java/datadog/trace/instrumentation/scalatest/DatadogReporter.java +++ b/dd-java-agent/instrumentation/scalatest/src/main/java/datadog/trace/instrumentation/scalatest/DatadogReporter.java @@ -145,7 +145,7 @@ private static void onTestStart(TestStarting event) { categories = Collections.emptyList(); } Class testClass = ScalatestUtils.getClass(event.suiteClassName()); - TestExecutionPolicy retryPolicy = context.popExecutionPolicy(testIdentifier); + TestExecutionPolicy executionPolicy = context.popExecutionPolicy(testIdentifier); eventHandler.onTestStart( new TestSuiteDescriptor(testSuiteName, testClass), @@ -156,7 +156,8 @@ private static void onTestStart(TestStarting event) { testParameters, categories, new TestSourceData(testClass, null, null), - retryPolicy != null ? retryPolicy.currentExecutionRetryReason() : null, + executionPolicy != null ? executionPolicy.currentExecutionRetryReason() : null, + executionPolicy != null && executionPolicy.hasFailedAllRetries(), null); } diff --git a/dd-java-agent/instrumentation/scalatest/src/test/groovy/ScalatestTest.groovy b/dd-java-agent/instrumentation/scalatest/src/test/groovy/ScalatestTest.groovy index 43741eaf554..6128765da7a 100644 --- a/dd-java-agent/instrumentation/scalatest/src/test/groovy/ScalatestTest.groovy +++ b/dd-java-agent/instrumentation/scalatest/src/test/groovy/ScalatestTest.groovy @@ -110,8 +110,8 @@ class ScalatestTest extends CiVisibilityInstrumentationTest { assertSpansData(testcaseName) where: - testcaseName | tests | quarantined - "test-failed" | [TestFailed] | [new TestIdentifier("org.example.TestFailed", "Example.add adds two numbers", null)] + testcaseName | tests | quarantined + "test-quarantined-failed" | [TestFailed] | [new TestIdentifier("org.example.TestFailed", "Example.add adds two numbers", null)] } def "test quarantined auto-retries #testcaseName"() { @@ -127,8 +127,8 @@ class ScalatestTest extends CiVisibilityInstrumentationTest { assertSpansData(testcaseName) where: - testcaseName | tests | quarantined | retried - "test-retry-failed" | [TestFailed] | [new TestIdentifier("org.example.TestFailed", "Example.add adds two numbers", null)] | [new TestIdentifier("org.example.TestFailed", "Example.add adds two numbers", null)] + testcaseName | tests | quarantined | retried + "test-quarantined-failed-atr" | [TestFailed] | [new TestIdentifier("org.example.TestFailed", "Example.add adds two numbers", null)] | [new TestIdentifier("org.example.TestFailed", "Example.add adds two numbers", null)] } def "test quarantined early flakiness detection #testcaseName"() { @@ -144,9 +144,9 @@ class ScalatestTest extends CiVisibilityInstrumentationTest { assertSpansData(testcaseName) where: - testcaseName | tests | quarantined | known - "test-failed" | [TestFailed] | [new TestIdentifier("org.example.TestFailed", "Example.add adds two numbers", null)] | [new TestIdentifier("org.example.TestFailed", "Example.add adds two numbers", null)] - "test-failed-efd" | [TestFailed] | [new TestIdentifier("org.example.TestFailed", "Example.add adds two numbers", null)] | [] + testcaseName | tests | quarantined | known + "test-quarantined-failed" | [TestFailed] | [new TestIdentifier("org.example.TestFailed", "Example.add adds two numbers", null)] | [new TestIdentifier("org.example.TestFailed", "Example.add adds two numbers", null)] + "test-quarantined-failed-efd" | [TestFailed] | [new TestIdentifier("org.example.TestFailed", "Example.add adds two numbers", null)] | [] } @Override diff --git a/dd-java-agent/instrumentation/scalatest/src/test/resources/test-quarantined-failed-atr/coverages.ftl b/dd-java-agent/instrumentation/scalatest/src/test/resources/test-quarantined-failed-atr/coverages.ftl new file mode 100644 index 00000000000..8878e547a79 --- /dev/null +++ b/dd-java-agent/instrumentation/scalatest/src/test/resources/test-quarantined-failed-atr/coverages.ftl @@ -0,0 +1 @@ +[ ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/scalatest/src/test/resources/test-quarantined-failed-atr/events.ftl b/dd-java-agent/instrumentation/scalatest/src/test/resources/test-quarantined-failed-atr/events.ftl new file mode 100644 index 00000000000..d9499753bd7 --- /dev/null +++ b/dd-java-agent/instrumentation/scalatest/src/test/resources/test-quarantined-failed-atr/events.ftl @@ -0,0 +1,346 @@ +[ { + "content" : { + "duration" : ${content_duration}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid}, + "component" : "scalatest", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "library_version" : ${content_meta_library_version}, + "span.kind" : "test_suite_end", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "scalatest", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "scalatest", + "test.source.file" : "dummy_source_path", + "test.status" : "fail", + "test.suite" : "org.example.TestFailed", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count}, + "test.source.end" : 19, + "test.source.start" : 11 + }, + "name" : "scalatest.test_suite", + "resource" : "org.example.TestFailed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id} + }, + "type" : "test_suite_end", + "version" : 1 +}, { + "content" : { + "duration" : ${content_duration_2}, + "error" : 1, + "meta" : { + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "scalatest", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack}, + "error.type" : "org.scalatest.exceptions.TestFailedException", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "scalatest", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "scalatest", + "test.name" : "Example.add adds two numbers", + "test.source.file" : "dummy_source_path", + "test.status" : "fail", + "test.suite" : "org.example.TestFailed", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_2}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "scalatest.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestFailed.Example.add adds two numbers", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id}, + "start" : ${content_start_2}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_3}, + "error" : 1, + "meta" : { + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "scalatest", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack_2}, + "error.type" : "org.scalatest.exceptions.TestFailedException", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "scalatest", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.is_retry" : "true", + "test.module" : "scalatest", + "test.name" : "Example.add adds two numbers", + "test.retry_reason" : "atr", + "test.source.file" : "dummy_source_path", + "test.status" : "fail", + "test.suite" : "org.example.TestFailed", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_3}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "scalatest.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestFailed.Example.add adds two numbers", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id_2}, + "start" : ${content_start_3}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id_2} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_4}, + "error" : 1, + "meta" : { + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "scalatest", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack_3}, + "error.type" : "org.scalatest.exceptions.TestFailedException", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "scalatest", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.is_retry" : "true", + "test.module" : "scalatest", + "test.name" : "Example.add adds two numbers", + "test.retry_reason" : "atr", + "test.source.file" : "dummy_source_path", + "test.status" : "fail", + "test.suite" : "org.example.TestFailed", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_4}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "scalatest.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestFailed.Example.add adds two numbers", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id_3}, + "start" : ${content_start_4}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id_3} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_5}, + "error" : 1, + "meta" : { + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "scalatest", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack_4}, + "error.type" : "org.scalatest.exceptions.TestFailedException", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "scalatest", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.is_retry" : "true", + "test.module" : "scalatest", + "test.name" : "Example.add adds two numbers", + "test.retry_reason" : "atr", + "test.source.file" : "dummy_source_path", + "test.status" : "fail", + "test.suite" : "org.example.TestFailed", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_5}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "scalatest.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestFailed.Example.add adds two numbers", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id_4}, + "start" : ${content_start_5}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id_4} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_6}, + "error" : 1, + "meta" : { + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "scalatest", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack_5}, + "error.type" : "org.scalatest.exceptions.TestFailedException", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "scalatest", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.is_retry" : "true", + "test.module" : "scalatest", + "test.name" : "Example.add adds two numbers", + "test.retry_reason" : "atr", + "test.source.file" : "dummy_source_path", + "test.status" : "fail", + "test.suite" : "org.example.TestFailed", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_6}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "scalatest.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestFailed.Example.add adds two numbers", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id_5}, + "start" : ${content_start_6}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id_5} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_7}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_2}, + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "scalatest", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test_session_end", + "test.command" : "scalatest", + "test.framework" : "scalatest", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.status" : "fail", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_7}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "scalatest.test_session", + "resource" : "scalatest", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_7}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_session_end", + "version" : 1 +}, { + "content" : { + "duration" : ${content_duration_8}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_3}, + "component" : "scalatest", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "library_version" : ${content_meta_library_version}, + "span.kind" : "test_module_end", + "test.framework" : "scalatest", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "scalatest", + "test.status" : "fail", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_8} + }, + "name" : "scalatest.test_module", + "resource" : "scalatest", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_8}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_module_end", + "version" : 1 +} ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/scalatest/src/test/resources/test-quarantined-failed-efd/coverages.ftl b/dd-java-agent/instrumentation/scalatest/src/test/resources/test-quarantined-failed-efd/coverages.ftl new file mode 100644 index 00000000000..8878e547a79 --- /dev/null +++ b/dd-java-agent/instrumentation/scalatest/src/test/resources/test-quarantined-failed-efd/coverages.ftl @@ -0,0 +1 @@ +[ ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/scalatest/src/test/resources/test-failed-efd/events.ftl b/dd-java-agent/instrumentation/scalatest/src/test/resources/test-quarantined-failed-efd/events.ftl similarity index 100% rename from dd-java-agent/instrumentation/scalatest/src/test/resources/test-failed-efd/events.ftl rename to dd-java-agent/instrumentation/scalatest/src/test/resources/test-quarantined-failed-efd/events.ftl diff --git a/dd-java-agent/instrumentation/scalatest/src/test/resources/test-quarantined-failed/coverages.ftl b/dd-java-agent/instrumentation/scalatest/src/test/resources/test-quarantined-failed/coverages.ftl new file mode 100644 index 00000000000..8878e547a79 --- /dev/null +++ b/dd-java-agent/instrumentation/scalatest/src/test/resources/test-quarantined-failed/coverages.ftl @@ -0,0 +1 @@ +[ ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/scalatest/src/test/resources/test-quarantined-failed/events.ftl b/dd-java-agent/instrumentation/scalatest/src/test/resources/test-quarantined-failed/events.ftl new file mode 100644 index 00000000000..c316e1a718e --- /dev/null +++ b/dd-java-agent/instrumentation/scalatest/src/test/resources/test-quarantined-failed/events.ftl @@ -0,0 +1,150 @@ +[ { + "content" : { + "duration" : ${content_duration}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid}, + "component" : "scalatest", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "library_version" : ${content_meta_library_version}, + "span.kind" : "test_suite_end", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "scalatest", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "scalatest", + "test.source.file" : "dummy_source_path", + "test.status" : "fail", + "test.suite" : "org.example.TestFailed", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count}, + "test.source.end" : 19, + "test.source.start" : 11 + }, + "name" : "scalatest.test_suite", + "resource" : "org.example.TestFailed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id} + }, + "type" : "test_suite_end", + "version" : 1 +}, { + "content" : { + "duration" : ${content_duration_2}, + "error" : 1, + "meta" : { + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "scalatest", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack}, + "error.type" : "org.scalatest.exceptions.TestFailedException", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "scalatest", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "scalatest", + "test.name" : "Example.add adds two numbers", + "test.source.file" : "dummy_source_path", + "test.status" : "fail", + "test.suite" : "org.example.TestFailed", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_2}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "scalatest.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestFailed.Example.add adds two numbers", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id}, + "start" : ${content_start_2}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_3}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_2}, + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "scalatest", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test_session_end", + "test.command" : "scalatest", + "test.framework" : "scalatest", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.status" : "fail", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_3}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "scalatest.test_session", + "resource" : "scalatest", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_3}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_session_end", + "version" : 1 +}, { + "content" : { + "duration" : ${content_duration_4}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_3}, + "component" : "scalatest", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "library_version" : ${content_meta_library_version}, + "span.kind" : "test_module_end", + "test.framework" : "scalatest", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "scalatest", + "test.status" : "fail", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_4} + }, + "name" : "scalatest.test_module", + "resource" : "scalatest", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_4}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_module_end", + "version" : 1 +} ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/testng/src/main/java/datadog/trace/instrumentation/testng/TracingListener.java b/dd-java-agent/instrumentation/testng/src/main/java/datadog/trace/instrumentation/testng/TracingListener.java index 6237acd9ddd..21e37383b41 100644 --- a/dd-java-agent/instrumentation/testng/src/main/java/datadog/trace/instrumentation/testng/TracingListener.java +++ b/dd-java-agent/instrumentation/testng/src/main/java/datadog/trace/instrumentation/testng/TracingListener.java @@ -2,10 +2,11 @@ import datadog.trace.api.civisibility.config.TestSourceData; import datadog.trace.api.civisibility.events.TestSuiteDescriptor; -import datadog.trace.api.civisibility.telemetry.tag.RetryReason; +import datadog.trace.api.civisibility.execution.TestExecutionPolicy; import datadog.trace.api.civisibility.telemetry.tag.TestFrameworkInstrumentation; import datadog.trace.instrumentation.testng.execution.RetryAnalyzer; import java.util.List; +import javax.annotation.Nullable; import org.testng.IConfigurationListener; import org.testng.IRetryAnalyzer; import org.testng.ITestClass; @@ -82,6 +83,7 @@ public void onTestStart(final ITestResult result) { List groups = TestNGUtils.getGroups(result); TestSourceData testSourceData = TestNGUtils.toTestSourceData(result); + TestExecutionPolicy executionPolicy = executionPolicy(result); TestEventsHandlerHolder.TEST_EVENTS_HANDLER.onTestStart( suiteDescriptor, result, @@ -91,15 +93,17 @@ public void onTestStart(final ITestResult result) { testParameters, groups, testSourceData, - retryReason(result), + executionPolicy != null ? executionPolicy.currentExecutionRetryReason() : null, + executionPolicy != null && executionPolicy.hasFailedAllRetries(), null); } - private RetryReason retryReason(final ITestResult result) { + @Nullable + private TestExecutionPolicy executionPolicy(final ITestResult result) { IRetryAnalyzer retryAnalyzer = TestNGUtils.getRetryAnalyzer(result); if (retryAnalyzer instanceof RetryAnalyzer) { RetryAnalyzer datadogAnalyzer = (RetryAnalyzer) retryAnalyzer; - return datadogAnalyzer.currentExecutionRetryReason(); + return datadogAnalyzer.getExecutionPolicy(); } return null; } diff --git a/dd-java-agent/instrumentation/testng/src/main/java/datadog/trace/instrumentation/testng/execution/RetryAnalyzer.java b/dd-java-agent/instrumentation/testng/src/main/java/datadog/trace/instrumentation/testng/execution/RetryAnalyzer.java index 9d9604e0363..c85b50a80c7 100644 --- a/dd-java-agent/instrumentation/testng/src/main/java/datadog/trace/instrumentation/testng/execution/RetryAnalyzer.java +++ b/dd-java-agent/instrumentation/testng/src/main/java/datadog/trace/instrumentation/testng/execution/RetryAnalyzer.java @@ -3,7 +3,6 @@ import datadog.trace.api.civisibility.config.TestIdentifier; import datadog.trace.api.civisibility.config.TestSourceData; import datadog.trace.api.civisibility.execution.TestExecutionPolicy; -import datadog.trace.api.civisibility.telemetry.tag.RetryReason; import datadog.trace.instrumentation.testng.TestEventsHandlerHolder; import datadog.trace.instrumentation.testng.TestNGUtils; import org.testng.IRetryAnalyzer; @@ -33,8 +32,8 @@ public boolean retry(ITestResult result) { result.isSuccess(), result.getEndMillis() - result.getStartMillis()); } - public RetryReason currentExecutionRetryReason() { - return executionPolicy != null ? executionPolicy.currentExecutionRetryReason() : null; + public TestExecutionPolicy getExecutionPolicy() { + return executionPolicy; } public boolean suppressFailures() { diff --git a/dd-java-agent/instrumentation/testng/src/testFixtures/groovy/datadog/trace/instrumentation/testng/TestNGTest.groovy b/dd-java-agent/instrumentation/testng/src/testFixtures/groovy/datadog/trace/instrumentation/testng/TestNGTest.groovy index f7a4ca4f3d1..7a4839736b8 100644 --- a/dd-java-agent/instrumentation/testng/src/testFixtures/groovy/datadog/trace/instrumentation/testng/TestNGTest.groovy +++ b/dd-java-agent/instrumentation/testng/src/testFixtures/groovy/datadog/trace/instrumentation/testng/TestNGTest.groovy @@ -165,9 +165,9 @@ abstract class TestNGTest extends CiVisibilityInstrumentationTest { assertSpansData(testcaseName) where: - testcaseName | tests | quarantined - "test-failed-${version()}" | [TestFailed] | [new TestIdentifier("org.example.TestFailed", "test_failed", null)] - "test-failed-parameterized" | [TestFailedParameterized] | [new TestIdentifier("org.example.TestFailedParameterized", "parameterized_test_succeed", null)] + testcaseName | tests | quarantined + "test-quarantined-failed-${version()}" | [TestFailed] | [new TestIdentifier("org.example.TestFailed", "test_failed", null)] + "test-quarantined-failed-parameterized" | [TestFailedParameterized] | [new TestIdentifier("org.example.TestFailedParameterized", "parameterized_test_succeed", null)] } def "test quarantined auto-retries #testcaseName"() { @@ -185,8 +185,8 @@ abstract class TestNGTest extends CiVisibilityInstrumentationTest { assertSpansData(testcaseName) where: - testcaseName | tests | quarantined | retried - "test-retry-failed-${version()}" | [TestFailed] | [new TestIdentifier("org.example.TestFailed", "test_failed", null)] | [new TestIdentifier("org.example.TestFailed", "test_failed", null)] + testcaseName | tests | quarantined | retried + "test-quarantined-failed-atr-${version()}" | [TestFailed] | [new TestIdentifier("org.example.TestFailed", "test_failed", null)] | [new TestIdentifier("org.example.TestFailed", "test_failed", null)] } def "test quarantined early flakiness detection #testcaseName"() { @@ -204,9 +204,9 @@ abstract class TestNGTest extends CiVisibilityInstrumentationTest { assertSpansData(testcaseName) where: - testcaseName | tests | quarantined | known - "test-failed-${version()}" | [TestFailed] | [new TestIdentifier("org.example.TestFailed", "test_failed", null)] | [new TestIdentifier("org.example.TestFailed", "test_failed", null)] - "test-failed-efd" | [TestFailed] | [new TestIdentifier("org.example.TestFailed", "test_failed", null)] | [] + testcaseName | tests | quarantined | known + "test-quarantined-failed-${version()}" | [TestFailed] | [new TestIdentifier("org.example.TestFailed", "test_failed", null)] | [new TestIdentifier("org.example.TestFailed", "test_failed", null)] + "test-quarantined-failed-efd" | [TestFailed] | [new TestIdentifier("org.example.TestFailed", "test_failed", null)] | [] } private static boolean isEFDSupported() { diff --git a/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-7/coverages.ftl b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-7/coverages.ftl new file mode 100644 index 00000000000..8878e547a79 --- /dev/null +++ b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-7/coverages.ftl @@ -0,0 +1 @@ +[ ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-7/events.ftl b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-7/events.ftl new file mode 100644 index 00000000000..090f035a082 --- /dev/null +++ b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-7/events.ftl @@ -0,0 +1,153 @@ +[ { + "content" : { + "duration" : ${content_duration}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid}, + "component" : "testng", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "library_version" : ${content_meta_library_version}, + "span.kind" : "test_suite_end", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "testng", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "testng-7", + "test.source.file" : "dummy_source_path", + "test.status" : "fail", + "test.suite" : "org.example.TestFailed", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count}, + "test.source.end" : 19, + "test.source.start" : 11 + }, + "name" : "testng.test_suite", + "resource" : "org.example.TestFailed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id} + }, + "type" : "test_suite_end", + "version" : 1 +}, { + "content" : { + "duration" : ${content_duration_2}, + "error" : 1, + "meta" : { + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "testng", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack}, + "error.type" : "java.lang.AssertionError", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "testng", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "testng-7", + "test.name" : "test_failed", + "test.source.file" : "dummy_source_path", + "test.source.method" : "test_failed()V", + "test.status" : "fail", + "test.suite" : "org.example.TestFailed", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_2}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id}, + "test.source.end" : 18, + "test.source.start" : 12 + }, + "name" : "testng.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestFailed.test_failed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id}, + "start" : ${content_start_2}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_3}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_2}, + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "testng", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test_session_end", + "test.command" : "testng-7", + "test.framework" : "testng", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.status" : "fail", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_3}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "testng.test_session", + "resource" : "testng-7", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_3}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_session_end", + "version" : 1 +}, { + "content" : { + "duration" : ${content_duration_4}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_3}, + "component" : "testng", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "library_version" : ${content_meta_library_version}, + "span.kind" : "test_module_end", + "test.framework" : "testng", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "testng-7", + "test.status" : "fail", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_4} + }, + "name" : "testng.test_module", + "resource" : "testng-7", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_4}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_module_end", + "version" : 1 +} ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-atr-7/coverages.ftl b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-atr-7/coverages.ftl new file mode 100644 index 00000000000..8878e547a79 --- /dev/null +++ b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-atr-7/coverages.ftl @@ -0,0 +1 @@ +[ ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-atr-7/events.ftl b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-atr-7/events.ftl new file mode 100644 index 00000000000..94397e26158 --- /dev/null +++ b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-atr-7/events.ftl @@ -0,0 +1,361 @@ +[ { + "content" : { + "duration" : ${content_duration}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid}, + "component" : "testng", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "library_version" : ${content_meta_library_version}, + "span.kind" : "test_suite_end", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "testng", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "testng-7", + "test.source.file" : "dummy_source_path", + "test.status" : "fail", + "test.suite" : "org.example.TestFailed", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count}, + "test.source.end" : 19, + "test.source.start" : 11 + }, + "name" : "testng.test_suite", + "resource" : "org.example.TestFailed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id} + }, + "type" : "test_suite_end", + "version" : 1 +}, { + "content" : { + "duration" : ${content_duration_2}, + "error" : 1, + "meta" : { + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "testng", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack}, + "error.type" : "java.lang.AssertionError", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "testng", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "testng-7", + "test.name" : "test_failed", + "test.source.file" : "dummy_source_path", + "test.source.method" : "test_failed()V", + "test.status" : "fail", + "test.suite" : "org.example.TestFailed", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_2}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id}, + "test.source.end" : 18, + "test.source.start" : 12 + }, + "name" : "testng.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestFailed.test_failed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id}, + "start" : ${content_start_2}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_3}, + "error" : 1, + "meta" : { + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "testng", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack_2}, + "error.type" : "java.lang.AssertionError", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "testng", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.is_retry" : "true", + "test.module" : "testng-7", + "test.name" : "test_failed", + "test.retry_reason" : "atr", + "test.source.file" : "dummy_source_path", + "test.source.method" : "test_failed()V", + "test.status" : "fail", + "test.suite" : "org.example.TestFailed", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_3}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id}, + "test.source.end" : 18, + "test.source.start" : 12 + }, + "name" : "testng.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestFailed.test_failed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id_2}, + "start" : ${content_start_3}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id_2} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_4}, + "error" : 1, + "meta" : { + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "testng", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack_3}, + "error.type" : "java.lang.AssertionError", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "testng", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.is_retry" : "true", + "test.module" : "testng-7", + "test.name" : "test_failed", + "test.retry_reason" : "atr", + "test.source.file" : "dummy_source_path", + "test.source.method" : "test_failed()V", + "test.status" : "fail", + "test.suite" : "org.example.TestFailed", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_4}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id}, + "test.source.end" : 18, + "test.source.start" : 12 + }, + "name" : "testng.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestFailed.test_failed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id_3}, + "start" : ${content_start_4}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id_3} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_5}, + "error" : 1, + "meta" : { + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "testng", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack_4}, + "error.type" : "java.lang.AssertionError", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "testng", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.is_retry" : "true", + "test.module" : "testng-7", + "test.name" : "test_failed", + "test.retry_reason" : "atr", + "test.source.file" : "dummy_source_path", + "test.source.method" : "test_failed()V", + "test.status" : "fail", + "test.suite" : "org.example.TestFailed", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_5}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id}, + "test.source.end" : 18, + "test.source.start" : 12 + }, + "name" : "testng.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestFailed.test_failed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id_4}, + "start" : ${content_start_5}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id_4} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_6}, + "error" : 1, + "meta" : { + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "testng", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack_5}, + "error.type" : "java.lang.AssertionError", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "testng", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.is_retry" : "true", + "test.module" : "testng-7", + "test.name" : "test_failed", + "test.retry_reason" : "atr", + "test.source.file" : "dummy_source_path", + "test.source.method" : "test_failed()V", + "test.status" : "fail", + "test.suite" : "org.example.TestFailed", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_6}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id}, + "test.source.end" : 18, + "test.source.start" : 12 + }, + "name" : "testng.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestFailed.test_failed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id_5}, + "start" : ${content_start_6}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id_5} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_7}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_2}, + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "testng", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test_session_end", + "test.command" : "testng-7", + "test.framework" : "testng", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.status" : "fail", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_7}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "testng.test_session", + "resource" : "testng-7", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_7}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_session_end", + "version" : 1 +}, { + "content" : { + "duration" : ${content_duration_8}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_3}, + "component" : "testng", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "library_version" : ${content_meta_library_version}, + "span.kind" : "test_module_end", + "test.framework" : "testng", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "testng-7", + "test.status" : "fail", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_8} + }, + "name" : "testng.test_module", + "resource" : "testng-7", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_8}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_module_end", + "version" : 1 +} ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-atr-latest/coverages.ftl b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-atr-latest/coverages.ftl new file mode 100644 index 00000000000..8878e547a79 --- /dev/null +++ b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-atr-latest/coverages.ftl @@ -0,0 +1 @@ +[ ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-atr-latest/events.ftl b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-atr-latest/events.ftl new file mode 100644 index 00000000000..c7b50f79d7b --- /dev/null +++ b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-atr-latest/events.ftl @@ -0,0 +1,341 @@ +[ { + "type" : "test_suite_end", + "version" : 1, + "content" : { + "test_session_id" : ${content_test_session_id}, + "test_module_id" : ${content_test_module_id}, + "test_suite_id" : ${content_test_suite_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "testng.test_suite", + "resource" : "org.example.TestFailed", + "start" : ${content_start}, + "duration" : ${content_duration}, + "error" : 0, + "metrics" : { }, + "meta" : { + "test.type" : "test", + "test.source.file" : "dummy_source_path", + "test.module" : "testng-7", + "test.status" : "fail", + "test_session.name" : "session-name", + "env" : "none", + "dummy_ci_tag" : "dummy_ci_tag_value", + "library_version" : ${content_meta_library_version}, + "component" : "testng", + "span.kind" : "test_suite_end", + "test.suite" : "org.example.TestFailed", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.framework" : "testng" + } + } +}, { + "type" : "test", + "version" : 2, + "content" : { + "trace_id" : ${content_trace_id}, + "span_id" : ${content_span_id}, + "parent_id" : ${content_parent_id}, + "test_session_id" : ${content_test_session_id}, + "test_module_id" : ${content_test_module_id}, + "test_suite_id" : ${content_test_suite_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "testng.test", + "resource" : "org.example.TestFailed.test_failed", + "start" : ${content_start_2}, + "duration" : ${content_duration_2}, + "error" : 1, + "metrics" : { + "process_id" : ${content_metrics_process_id}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "test.source.end" : 18, + "test.source.start" : 12 + }, + "meta" : { + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "test.source.file" : "dummy_source_path", + "test.source.method" : "test_failed()V", + "test.module" : "testng-7", + "test.status" : "fail", + "language" : "jvm", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "library_version" : ${content_meta_library_version}, + "test.name" : "test_failed", + "span.kind" : "test", + "test.suite" : "org.example.TestFailed", + "runtime-id" : ${content_meta_runtime_id}, + "test.type" : "test", + "test_session.name" : "session-name", + "env" : "none", + "dummy_ci_tag" : "dummy_ci_tag_value", + "component" : "testng", + "error.type" : "java.lang.AssertionError", + "_dd.profiling.ctx" : "test", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack}, + "test.framework_version" : ${content_meta_test_framework_version}, + "test.framework" : "testng" + } + } +}, { + "type" : "test", + "version" : 2, + "content" : { + "trace_id" : ${content_trace_id_2}, + "span_id" : ${content_span_id_2}, + "parent_id" : ${content_parent_id}, + "test_session_id" : ${content_test_session_id}, + "test_module_id" : ${content_test_module_id}, + "test_suite_id" : ${content_test_suite_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "testng.test", + "resource" : "org.example.TestFailed.test_failed", + "start" : ${content_start_3}, + "duration" : ${content_duration_3}, + "error" : 1, + "metrics" : { + "process_id" : ${content_metrics_process_id}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "test.source.end" : 18, + "test.source.start" : 12 + }, + "meta" : { + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "test.source.file" : "dummy_source_path", + "test.source.method" : "test_failed()V", + "test.module" : "testng-7", + "test.status" : "fail", + "language" : "jvm", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "library_version" : ${content_meta_library_version}, + "test.name" : "test_failed", + "span.kind" : "test", + "test.suite" : "org.example.TestFailed", + "runtime-id" : ${content_meta_runtime_id}, + "test.type" : "test", + "test_session.name" : "session-name", + "env" : "none", + "dummy_ci_tag" : "dummy_ci_tag_value", + "test.is_retry" : "true", + "component" : "testng", + "error.type" : "java.lang.AssertionError", + "_dd.profiling.ctx" : "test", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack_2}, + "test.framework_version" : ${content_meta_test_framework_version}, + "test.framework" : "testng" + } + } +}, { + "type" : "test", + "version" : 2, + "content" : { + "trace_id" : ${content_trace_id_3}, + "span_id" : ${content_span_id_3}, + "parent_id" : ${content_parent_id}, + "test_session_id" : ${content_test_session_id}, + "test_module_id" : ${content_test_module_id}, + "test_suite_id" : ${content_test_suite_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "testng.test", + "resource" : "org.example.TestFailed.test_failed", + "start" : ${content_start_4}, + "duration" : ${content_duration_4}, + "error" : 1, + "metrics" : { + "process_id" : ${content_metrics_process_id}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "test.source.end" : 18, + "test.source.start" : 12 + }, + "meta" : { + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "test.source.file" : "dummy_source_path", + "test.source.method" : "test_failed()V", + "test.module" : "testng-7", + "test.status" : "fail", + "language" : "jvm", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "library_version" : ${content_meta_library_version}, + "test.name" : "test_failed", + "span.kind" : "test", + "test.suite" : "org.example.TestFailed", + "runtime-id" : ${content_meta_runtime_id}, + "test.type" : "test", + "test_session.name" : "session-name", + "env" : "none", + "dummy_ci_tag" : "dummy_ci_tag_value", + "test.is_retry" : "true", + "component" : "testng", + "error.type" : "java.lang.AssertionError", + "_dd.profiling.ctx" : "test", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack_3}, + "test.framework_version" : ${content_meta_test_framework_version}, + "test.framework" : "testng" + } + } +}, { + "type" : "test", + "version" : 2, + "content" : { + "trace_id" : ${content_trace_id_4}, + "span_id" : ${content_span_id_4}, + "parent_id" : ${content_parent_id}, + "test_session_id" : ${content_test_session_id}, + "test_module_id" : ${content_test_module_id}, + "test_suite_id" : ${content_test_suite_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "testng.test", + "resource" : "org.example.TestFailed.test_failed", + "start" : ${content_start_5}, + "duration" : ${content_duration_5}, + "error" : 1, + "metrics" : { + "process_id" : ${content_metrics_process_id}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "test.source.end" : 18, + "test.source.start" : 12 + }, + "meta" : { + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "test.source.file" : "dummy_source_path", + "test.source.method" : "test_failed()V", + "test.module" : "testng-7", + "test.status" : "fail", + "language" : "jvm", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "library_version" : ${content_meta_library_version}, + "test.name" : "test_failed", + "span.kind" : "test", + "test.suite" : "org.example.TestFailed", + "runtime-id" : ${content_meta_runtime_id}, + "test.type" : "test", + "test_session.name" : "session-name", + "env" : "none", + "dummy_ci_tag" : "dummy_ci_tag_value", + "test.is_retry" : "true", + "component" : "testng", + "error.type" : "java.lang.AssertionError", + "_dd.profiling.ctx" : "test", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack_4}, + "test.framework_version" : ${content_meta_test_framework_version}, + "test.framework" : "testng" + } + } +}, { + "type" : "test", + "version" : 2, + "content" : { + "trace_id" : ${content_trace_id_5}, + "span_id" : ${content_span_id_5}, + "parent_id" : ${content_parent_id}, + "test_session_id" : ${content_test_session_id}, + "test_module_id" : ${content_test_module_id}, + "test_suite_id" : ${content_test_suite_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "testng.test", + "resource" : "org.example.TestFailed.test_failed", + "start" : ${content_start_6}, + "duration" : ${content_duration_6}, + "error" : 1, + "metrics" : { + "process_id" : ${content_metrics_process_id}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "test.source.end" : 18, + "test.source.start" : 12 + }, + "meta" : { + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "test.source.file" : "dummy_source_path", + "test.source.method" : "test_failed()V", + "test.module" : "testng-7", + "test.status" : "fail", + "language" : "jvm", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "library_version" : ${content_meta_library_version}, + "test.name" : "test_failed", + "span.kind" : "test", + "test.suite" : "org.example.TestFailed", + "runtime-id" : ${content_meta_runtime_id}, + "test.type" : "test", + "test_session.name" : "session-name", + "env" : "none", + "dummy_ci_tag" : "dummy_ci_tag_value", + "test.is_retry" : "true", + "component" : "testng", + "error.type" : "java.lang.AssertionError", + "_dd.profiling.ctx" : "test", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack_5}, + "test.framework_version" : ${content_meta_test_framework_version}, + "test.framework" : "testng" + } + } +}, { + "type" : "test_session_end", + "version" : 1, + "content" : { + "test_session_id" : ${content_test_session_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "testng.test_session", + "resource" : "testng-7", + "start" : ${content_start_7}, + "duration" : ${content_duration_7}, + "error" : 0, + "metrics" : { + "process_id" : ${content_metrics_process_id}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0 + }, + "meta" : { + "test.type" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "test.status" : "fail", + "test_session.name" : "session-name", + "language" : "jvm", + "env" : "none", + "dummy_ci_tag" : "dummy_ci_tag_value", + "library_version" : ${content_meta_library_version}, + "component" : "testng", + "_dd.profiling.ctx" : "test", + "span.kind" : "test_session_end", + "runtime-id" : ${content_meta_runtime_id}, + "test.command" : "testng-7", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.framework" : "testng" + } + } +}, { + "type" : "test_module_end", + "version" : 1, + "content" : { + "test_session_id" : ${content_test_session_id}, + "test_module_id" : ${content_test_module_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "testng.test_module", + "resource" : "testng-7", + "start" : ${content_start_8}, + "duration" : ${content_duration_8}, + "error" : 0, + "metrics" : { }, + "meta" : { + "test.type" : "test", + "test.module" : "testng-7", + "test.status" : "fail", + "test_session.name" : "session-name", + "env" : "none", + "dummy_ci_tag" : "dummy_ci_tag_value", + "library_version" : ${content_meta_library_version}, + "component" : "testng", + "span.kind" : "test_module_end", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.framework" : "testng" + } + } +} ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-efd/coverages.ftl b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-efd/coverages.ftl new file mode 100644 index 00000000000..8878e547a79 --- /dev/null +++ b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-efd/coverages.ftl @@ -0,0 +1 @@ +[ ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-failed-efd/events.ftl b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-efd/events.ftl similarity index 100% rename from dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-failed-efd/events.ftl rename to dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-efd/events.ftl diff --git a/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-latest/coverages.ftl b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-latest/coverages.ftl new file mode 100644 index 00000000000..8878e547a79 --- /dev/null +++ b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-latest/coverages.ftl @@ -0,0 +1 @@ +[ ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-latest/events.ftl b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-latest/events.ftl new file mode 100644 index 00000000000..325fdb0456f --- /dev/null +++ b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-latest/events.ftl @@ -0,0 +1,141 @@ +[ { + "type" : "test_suite_end", + "version" : 1, + "content" : { + "test_session_id" : ${content_test_session_id}, + "test_module_id" : ${content_test_module_id}, + "test_suite_id" : ${content_test_suite_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "testng.test_suite", + "resource" : "org.example.TestFailed", + "start" : ${content_start}, + "duration" : ${content_duration}, + "error" : 0, + "metrics" : { }, + "meta" : { + "test.type" : "test", + "test.source.file" : "dummy_source_path", + "test.module" : "testng-7", + "test.status" : "fail", + "test_session.name" : "session-name", + "env" : "none", + "dummy_ci_tag" : "dummy_ci_tag_value", + "library_version" : ${content_meta_library_version}, + "component" : "testng", + "span.kind" : "test_suite_end", + "test.suite" : "org.example.TestFailed", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.framework" : "testng" + } + } +}, { + "type" : "test", + "version" : 2, + "content" : { + "trace_id" : ${content_trace_id}, + "span_id" : ${content_span_id}, + "parent_id" : ${content_parent_id}, + "test_session_id" : ${content_test_session_id}, + "test_module_id" : ${content_test_module_id}, + "test_suite_id" : ${content_test_suite_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "testng.test", + "resource" : "org.example.TestFailed.test_failed", + "start" : ${content_start_2}, + "duration" : ${content_duration_2}, + "error" : 1, + "metrics" : { + "process_id" : ${content_metrics_process_id}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "test.source.end" : 18, + "test.source.start" : 12 + }, + "meta" : { + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "test.source.file" : "dummy_source_path", + "test.source.method" : "test_failed()V", + "test.module" : "testng-7", + "test.status" : "fail", + "language" : "jvm", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "library_version" : ${content_meta_library_version}, + "test.name" : "test_failed", + "span.kind" : "test", + "test.suite" : "org.example.TestFailed", + "runtime-id" : ${content_meta_runtime_id}, + "test.type" : "test", + "test_session.name" : "session-name", + "env" : "none", + "dummy_ci_tag" : "dummy_ci_tag_value", + "component" : "testng", + "error.type" : "java.lang.AssertionError", + "_dd.profiling.ctx" : "test", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack}, + "test.framework_version" : ${content_meta_test_framework_version}, + "test.framework" : "testng" + } + } +}, { + "type" : "test_session_end", + "version" : 1, + "content" : { + "test_session_id" : ${content_test_session_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "testng.test_session", + "resource" : "testng-7", + "start" : ${content_start_3}, + "duration" : ${content_duration_3}, + "error" : 0, + "metrics" : { + "process_id" : ${content_metrics_process_id}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0 + }, + "meta" : { + "test.type" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "test.status" : "fail", + "test_session.name" : "session-name", + "language" : "jvm", + "env" : "none", + "dummy_ci_tag" : "dummy_ci_tag_value", + "library_version" : ${content_meta_library_version}, + "component" : "testng", + "_dd.profiling.ctx" : "test", + "span.kind" : "test_session_end", + "runtime-id" : ${content_meta_runtime_id}, + "test.command" : "testng-7", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.framework" : "testng" + } + } +}, { + "type" : "test_module_end", + "version" : 1, + "content" : { + "test_session_id" : ${content_test_session_id}, + "test_module_id" : ${content_test_module_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "testng.test_module", + "resource" : "testng-7", + "start" : ${content_start_4}, + "duration" : ${content_duration_4}, + "error" : 0, + "metrics" : { }, + "meta" : { + "test.type" : "test", + "test.module" : "testng-7", + "test.status" : "fail", + "test_session.name" : "session-name", + "env" : "none", + "dummy_ci_tag" : "dummy_ci_tag_value", + "library_version" : ${content_meta_library_version}, + "component" : "testng", + "span.kind" : "test_module_end", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.framework" : "testng" + } + } +} ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-parameterized/coverages.ftl b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-parameterized/coverages.ftl new file mode 100644 index 00000000000..8878e547a79 --- /dev/null +++ b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-parameterized/coverages.ftl @@ -0,0 +1 @@ +[ ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-failed-parameterized/events.ftl b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-parameterized/events.ftl similarity index 100% rename from dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-failed-parameterized/events.ftl rename to dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-parameterized/events.ftl diff --git a/dd-java-agent/instrumentation/weaver/src/main/java/datadog/trace/instrumentation/weaver/DatadogWeaverReporter.java b/dd-java-agent/instrumentation/weaver/src/main/java/datadog/trace/instrumentation/weaver/DatadogWeaverReporter.java index 513dbdd1ff2..9e9cb78f68d 100644 --- a/dd-java-agent/instrumentation/weaver/src/main/java/datadog/trace/instrumentation/weaver/DatadogWeaverReporter.java +++ b/dd-java-agent/instrumentation/weaver/src/main/java/datadog/trace/instrumentation/weaver/DatadogWeaverReporter.java @@ -107,6 +107,7 @@ public static void onTestFinished(TestFinished event, TaskDef taskDef) { categories, new TestSourceData(testClass, testMethod, testMethodName), retryReason, + false, startMicros); if (testOutcome.result() instanceof Result.Ignored) { diff --git a/internal-api/src/main/java/datadog/trace/api/civisibility/events/TestEventsHandler.java b/internal-api/src/main/java/datadog/trace/api/civisibility/events/TestEventsHandler.java index 801ff7b642f..7048e1c374a 100644 --- a/internal-api/src/main/java/datadog/trace/api/civisibility/events/TestEventsHandler.java +++ b/internal-api/src/main/java/datadog/trace/api/civisibility/events/TestEventsHandler.java @@ -54,6 +54,8 @@ void onTestSuiteStart( * @param testSourceData metadata for locating the source code for the test case * @param retryReason if this is a retry of the previously executed test case, the reason for * retrying + * @param hasFailedAllRetries {@code true} if this test was executed multiple times, and all the + * executions failed * @param startTime the timestamp of the test execution start ({@code null} for current timestamp) */ void onTestStart( @@ -66,6 +68,7 @@ void onTestStart( @Nullable Collection categories, @Nonnull TestSourceData testSourceData, @Nullable RetryReason retryReason, + boolean hasFailedAllRetries, @Nullable Long startTime); void onTestSkip(TestKey descriptor, @Nullable String reason); diff --git a/internal-api/src/main/java/datadog/trace/api/civisibility/execution/TestExecutionPolicy.java b/internal-api/src/main/java/datadog/trace/api/civisibility/execution/TestExecutionPolicy.java index 594568a03b0..01fceb6d9b9 100644 --- a/internal-api/src/main/java/datadog/trace/api/civisibility/execution/TestExecutionPolicy.java +++ b/internal-api/src/main/java/datadog/trace/api/civisibility/execution/TestExecutionPolicy.java @@ -32,4 +32,10 @@ public interface TestExecutionPolicy { */ @Nullable RetryReason currentExecutionRetryReason(); + + /** + * @return {@code true} if the test has failed all retry attempts (only for policies that allow + * multiple retries) + */ + boolean hasFailedAllRetries(); } diff --git a/internal-api/src/main/java/datadog/trace/api/civisibility/telemetry/CiVisibilityCountMetric.java b/internal-api/src/main/java/datadog/trace/api/civisibility/telemetry/CiVisibilityCountMetric.java index a5b0cc5d4cd..65aa7a6dd75 100644 --- a/internal-api/src/main/java/datadog/trace/api/civisibility/telemetry/CiVisibilityCountMetric.java +++ b/internal-api/src/main/java/datadog/trace/api/civisibility/telemetry/CiVisibilityCountMetric.java @@ -15,11 +15,12 @@ import datadog.trace.api.civisibility.telemetry.tag.FailFastTestOrderEnabled; import datadog.trace.api.civisibility.telemetry.tag.FlakyTestRetriesEnabled; import datadog.trace.api.civisibility.telemetry.tag.HasCodeowner; +import datadog.trace.api.civisibility.telemetry.tag.HasFailedAllRetries; import datadog.trace.api.civisibility.telemetry.tag.ImpactedTestsDetectionEnabled; -import datadog.trace.api.civisibility.telemetry.tag.IsBenchmark; import datadog.trace.api.civisibility.telemetry.tag.IsHeadless; import datadog.trace.api.civisibility.telemetry.tag.IsModified; import datadog.trace.api.civisibility.telemetry.tag.IsNew; +import datadog.trace.api.civisibility.telemetry.tag.IsQuarantined; import datadog.trace.api.civisibility.telemetry.tag.IsRetry; import datadog.trace.api.civisibility.telemetry.tag.IsRum; import datadog.trace.api.civisibility.telemetry.tag.IsUnsupportedCI; @@ -53,8 +54,7 @@ public enum CiVisibilityCountMetric { EventType.class, IsHeadless.class, HasCodeowner.class, - IsUnsupportedCI.class, - IsBenchmark.class), + IsUnsupportedCI.class), /** The number of events finished */ EVENT_FINISHED( "event_finished", @@ -63,11 +63,17 @@ public enum CiVisibilityCountMetric { IsHeadless.class, HasCodeowner.class, IsUnsupportedCI.class, - IsBenchmark.class, - EarlyFlakeDetectionAbortReason.class, + EarlyFlakeDetectionAbortReason.class), + /** The number of test events finished */ + TEST_EVENT_FINISHED( + "event_finished", + TestFrameworkInstrumentation.class, + EventType.class, IsNew.class, IsModified.class, + IsQuarantined.class, IsRetry.class, + HasFailedAllRetries.class, RetryReason.class, IsRum.class, BrowserDriver.class), diff --git a/internal-api/src/main/java/datadog/trace/api/civisibility/telemetry/tag/HasFailedAllRetries.java b/internal-api/src/main/java/datadog/trace/api/civisibility/telemetry/tag/HasFailedAllRetries.java new file mode 100644 index 00000000000..ca8e4f9a8fd --- /dev/null +++ b/internal-api/src/main/java/datadog/trace/api/civisibility/telemetry/tag/HasFailedAllRetries.java @@ -0,0 +1,12 @@ +package datadog.trace.api.civisibility.telemetry.tag; + +import datadog.trace.api.civisibility.telemetry.TagValue; + +public enum HasFailedAllRetries implements TagValue { + TRUE; + + @Override + public String asString() { + return "has_failed_all_retries:true"; + } +} diff --git a/internal-api/src/main/java/datadog/trace/api/civisibility/telemetry/tag/IsBenchmark.java b/internal-api/src/main/java/datadog/trace/api/civisibility/telemetry/tag/IsBenchmark.java deleted file mode 100644 index 901fd994a5b..00000000000 --- a/internal-api/src/main/java/datadog/trace/api/civisibility/telemetry/tag/IsBenchmark.java +++ /dev/null @@ -1,15 +0,0 @@ -package datadog.trace.api.civisibility.telemetry.tag; - -import datadog.trace.api.civisibility.telemetry.TagValue; - -/** - * Whether a test case is a benchmark (that is a test cases of a benchmarking framework, e.g. JMH). - */ -public enum IsBenchmark implements TagValue { - TRUE; - - @Override - public String asString() { - return "is_benchmark:true"; - } -} diff --git a/internal-api/src/main/java/datadog/trace/api/civisibility/telemetry/tag/IsQuarantined.java b/internal-api/src/main/java/datadog/trace/api/civisibility/telemetry/tag/IsQuarantined.java new file mode 100644 index 00000000000..b8122301e22 --- /dev/null +++ b/internal-api/src/main/java/datadog/trace/api/civisibility/telemetry/tag/IsQuarantined.java @@ -0,0 +1,12 @@ +package datadog.trace.api.civisibility.telemetry.tag; + +import datadog.trace.api.civisibility.telemetry.TagValue; + +public enum IsQuarantined implements TagValue { + TRUE; + + @Override + public String asString() { + return "is_quarantined:true"; + } +} diff --git a/internal-api/src/main/java/datadog/trace/bootstrap/instrumentation/api/Tags.java b/internal-api/src/main/java/datadog/trace/bootstrap/instrumentation/api/Tags.java index 47e4a0d45b3..a0bfe78ef10 100644 --- a/internal-api/src/main/java/datadog/trace/bootstrap/instrumentation/api/Tags.java +++ b/internal-api/src/main/java/datadog/trace/bootstrap/instrumentation/api/Tags.java @@ -96,6 +96,8 @@ public class Tags { public static final String TEST_IS_RETRY = "test.is_retry"; public static final String TEST_RETRY_REASON = "test.retry_reason"; public static final String TEST_IS_MODIFIED = "test.is_modified"; + public static final String TEST_HAS_FAILED_ALL_RETRIES = "test.has_failed_all_retries"; + public static final String TEST_MANAGEMENT_IS_QUARANTINED = "test.management.is_quarantined"; public static final String CI_PROVIDER_NAME = "ci.provider.name"; public static final String CI_PIPELINE_ID = "ci.pipeline.id"; From 0c58002e6a99685ddbd91f7041b9f1a16cccfcee Mon Sep 17 00:00:00 2001 From: Nikita Tkachenko Date: Fri, 31 Jan 2025 17:16:25 +0100 Subject: [PATCH 2/5] Add is_quarantined tag to test fixtures --- .../test-quarantined-failed-atr/events.ftl | 5 + .../test-quarantined-failed-efd/events.ftl | 3 + .../test-quarantined-failed/events.ftl | 1 + .../test-quarantined-failed-atr/events.ftl | 5 + .../test-quarantined-failed-efd/events.ftl | 3 + .../test-quarantined-failed/events.ftl | 3 +- .../test-quarantined-failed-atr/events.ftl | 5 + .../test-quarantined-failed-efd/events.ftl | 3 + .../events.ftl | 2 + .../test-quarantined-failed/events.ftl | 3 +- .../test-quarantined-failed-atr/events.ftl | 5 + .../test-quarantined-failed-efd/events.ftl | 3 + .../test-quarantined-failed/events.ftl | 3 +- .../test-quarantined-failed-atr/events.ftl | 5 + .../test-quarantined-failed-efd/events.ftl | 3 + .../events.ftl | 1 + .../test-quarantined-failed/events.ftl | 1 + .../test-quarantined-failed-atr/events.ftl | 5 + .../test-quarantined-failed-efd/events.ftl | 3 + .../events.ftl | 2 + .../test-quarantined-failed/events.ftl | 3 +- .../test-quarantined-failed/events.ftl | 1 + .../test-quarantined-failed-atr/events.ftl | 5 + .../test-quarantined-failed-efd/events.ftl | 3 + .../test-quarantined-failed/events.ftl | 3 +- .../events.ftl | 660 +++++++++--------- .../events.ftl | 281 ++++---- .../resources/test-efd-known-test/events.ftl | 210 +++--- .../events.ftl | 496 ++++++------- .../events.ftl | 585 ++++++++-------- .../test-efd-new-slow-test/events.ftl | 284 ++++---- .../resources/test-efd-new-test/events.ftl | 356 +++++----- .../test-efd-new-very-slow-test/events.ftl | 212 +++--- .../test-quarantined-failed-7/events.ftl | 3 +- .../test-quarantined-failed-atr-7/events.ftl | 5 + .../test-quarantined-failed-efd/events.ftl | 3 + .../events.ftl | 2 + 37 files changed, 1692 insertions(+), 1484 deletions(-) diff --git a/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-quarantined-failed-atr/events.ftl b/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-quarantined-failed-atr/events.ftl index a28cbaf5b8a..0d01488f22f 100644 --- a/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-quarantined-failed-atr/events.ftl +++ b/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-quarantined-failed-atr/events.ftl @@ -49,6 +49,7 @@ "span.kind" : "test", "test.framework" : "cucumber", "test.framework_version" : ${content_meta_test_framework_version}, + "test.management.is_quarantined" : "true", "test.module" : "cucumber-junit-4", "test.name" : "Addition", "test.status" : "fail", @@ -96,6 +97,7 @@ "test.framework" : "cucumber", "test.framework_version" : ${content_meta_test_framework_version}, "test.is_retry" : "true", + "test.management.is_quarantined" : "true", "test.module" : "cucumber-junit-4", "test.name" : "Addition", "test.retry_reason" : "atr", @@ -144,6 +146,7 @@ "test.framework" : "cucumber", "test.framework_version" : ${content_meta_test_framework_version}, "test.is_retry" : "true", + "test.management.is_quarantined" : "true", "test.module" : "cucumber-junit-4", "test.name" : "Addition", "test.retry_reason" : "atr", @@ -192,6 +195,7 @@ "test.framework" : "cucumber", "test.framework_version" : ${content_meta_test_framework_version}, "test.is_retry" : "true", + "test.management.is_quarantined" : "true", "test.module" : "cucumber-junit-4", "test.name" : "Addition", "test.retry_reason" : "atr", @@ -240,6 +244,7 @@ "test.framework" : "cucumber", "test.framework_version" : ${content_meta_test_framework_version}, "test.is_retry" : "true", + "test.management.is_quarantined" : "true", "test.module" : "cucumber-junit-4", "test.name" : "Addition", "test.retry_reason" : "atr", diff --git a/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-quarantined-failed-efd/events.ftl b/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-quarantined-failed-efd/events.ftl index ac77c4dec0f..d4c17a0458c 100644 --- a/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-quarantined-failed-efd/events.ftl +++ b/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-quarantined-failed-efd/events.ftl @@ -50,6 +50,7 @@ "test.framework" : "cucumber", "test.framework_version" : ${content_meta_test_framework_version}, "test.is_new" : "true", + "test.management.is_quarantined" : "true", "test.module" : "cucumber-junit-4", "test.name" : "Addition", "test.status" : "fail", @@ -98,6 +99,7 @@ "test.framework_version" : ${content_meta_test_framework_version}, "test.is_new" : "true", "test.is_retry" : "true", + "test.management.is_quarantined" : "true", "test.module" : "cucumber-junit-4", "test.name" : "Addition", "test.retry_reason" : "efd", @@ -147,6 +149,7 @@ "test.framework_version" : ${content_meta_test_framework_version}, "test.is_new" : "true", "test.is_retry" : "true", + "test.management.is_quarantined" : "true", "test.module" : "cucumber-junit-4", "test.name" : "Addition", "test.retry_reason" : "efd", diff --git a/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-quarantined-failed/events.ftl b/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-quarantined-failed/events.ftl index 64dc9c7e7e9..8645e3118df 100644 --- a/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-quarantined-failed/events.ftl +++ b/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-quarantined-failed/events.ftl @@ -49,6 +49,7 @@ "span.kind" : "test", "test.framework" : "cucumber", "test.framework_version" : ${content_meta_test_framework_version}, + "test.management.is_quarantined" : "true", "test.module" : "cucumber-junit-4", "test.name" : "Addition", "test.status" : "fail", diff --git a/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-quarantined-failed-atr/events.ftl b/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-quarantined-failed-atr/events.ftl index 9824b20b206..b2c467b953b 100644 --- a/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-quarantined-failed-atr/events.ftl +++ b/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-quarantined-failed-atr/events.ftl @@ -120,6 +120,7 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "munit", "test.framework_version" : ${content_meta_test_framework_version}, + "test.management.is_quarantined" : "true", "test.module" : "munit-junit-4", "test.name" : "Calculator.add", "test.source.file" : "dummy_source_path", @@ -169,6 +170,7 @@ "test.framework" : "munit", "test.framework_version" : ${content_meta_test_framework_version}, "test.is_retry" : "true", + "test.management.is_quarantined" : "true", "test.module" : "munit-junit-4", "test.name" : "Calculator.add", "test.retry_reason" : "atr", @@ -219,6 +221,7 @@ "test.framework" : "munit", "test.framework_version" : ${content_meta_test_framework_version}, "test.is_retry" : "true", + "test.management.is_quarantined" : "true", "test.module" : "munit-junit-4", "test.name" : "Calculator.add", "test.retry_reason" : "atr", @@ -269,6 +272,7 @@ "test.framework" : "munit", "test.framework_version" : ${content_meta_test_framework_version}, "test.is_retry" : "true", + "test.management.is_quarantined" : "true", "test.module" : "munit-junit-4", "test.name" : "Calculator.add", "test.retry_reason" : "atr", @@ -319,6 +323,7 @@ "test.framework" : "munit", "test.framework_version" : ${content_meta_test_framework_version}, "test.is_retry" : "true", + "test.management.is_quarantined" : "true", "test.module" : "munit-junit-4", "test.name" : "Calculator.add", "test.retry_reason" : "atr", diff --git a/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-quarantined-failed-efd/events.ftl b/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-quarantined-failed-efd/events.ftl index c5e94d96146..d51ce34dd3e 100644 --- a/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-quarantined-failed-efd/events.ftl +++ b/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-quarantined-failed-efd/events.ftl @@ -123,6 +123,7 @@ "test.framework" : "munit", "test.framework_version" : ${content_meta_test_framework_version}, "test.is_new" : "true", + "test.management.is_quarantined" : "true", "test.module" : "munit-junit-4", "test.name" : "Calculator.add", "test.source.file" : "dummy_source_path", @@ -173,6 +174,7 @@ "test.framework_version" : ${content_meta_test_framework_version}, "test.is_new" : "true", "test.is_retry" : "true", + "test.management.is_quarantined" : "true", "test.module" : "munit-junit-4", "test.name" : "Calculator.add", "test.retry_reason" : "efd", @@ -224,6 +226,7 @@ "test.framework_version" : ${content_meta_test_framework_version}, "test.is_new" : "true", "test.is_retry" : "true", + "test.management.is_quarantined" : "true", "test.module" : "munit-junit-4", "test.name" : "Calculator.add", "test.retry_reason" : "efd", diff --git a/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-quarantined-failed/events.ftl b/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-quarantined-failed/events.ftl index dc8e3421f59..2b2523e4fe8 100644 --- a/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-quarantined-failed/events.ftl +++ b/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-quarantined-failed/events.ftl @@ -120,6 +120,7 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "munit", "test.framework_version" : ${content_meta_test_framework_version}, + "test.management.is_quarantined" : "true", "test.module" : "munit-junit-4", "test.name" : "Calculator.add", "test.source.file" : "dummy_source_path", @@ -148,4 +149,4 @@ }, "type" : "test", "version" : 2 -} ] \ No newline at end of file +} ] diff --git a/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-quarantined-failed-atr/events.ftl b/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-quarantined-failed-atr/events.ftl index d4d008f55a7..b82c949ba2e 100644 --- a/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-quarantined-failed-atr/events.ftl +++ b/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-quarantined-failed-atr/events.ftl @@ -119,6 +119,7 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "junit4", "test.framework_version" : ${content_meta_test_framework_version}, + "test.management.is_quarantined" : "true", "test.module" : "junit-4.10", "test.name" : "test_failed", "test.source.file" : "dummy_source_path", @@ -169,6 +170,7 @@ "test.framework" : "junit4", "test.framework_version" : ${content_meta_test_framework_version}, "test.is_retry" : "true", + "test.management.is_quarantined" : "true", "test.module" : "junit-4.10", "test.name" : "test_failed", "test.retry_reason" : "atr", @@ -220,6 +222,7 @@ "test.framework" : "junit4", "test.framework_version" : ${content_meta_test_framework_version}, "test.is_retry" : "true", + "test.management.is_quarantined" : "true", "test.module" : "junit-4.10", "test.name" : "test_failed", "test.retry_reason" : "atr", @@ -271,6 +274,7 @@ "test.framework" : "junit4", "test.framework_version" : ${content_meta_test_framework_version}, "test.is_retry" : "true", + "test.management.is_quarantined" : "true", "test.module" : "junit-4.10", "test.name" : "test_failed", "test.retry_reason" : "atr", @@ -322,6 +326,7 @@ "test.framework" : "junit4", "test.framework_version" : ${content_meta_test_framework_version}, "test.is_retry" : "true", + "test.management.is_quarantined" : "true", "test.module" : "junit-4.10", "test.name" : "test_failed", "test.retry_reason" : "atr", diff --git a/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-quarantined-failed-efd/events.ftl b/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-quarantined-failed-efd/events.ftl index b9bc04bc9ba..8531b99c004 100644 --- a/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-quarantined-failed-efd/events.ftl +++ b/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-quarantined-failed-efd/events.ftl @@ -122,6 +122,7 @@ "test.framework" : "junit4", "test.framework_version" : ${content_meta_test_framework_version}, "test.is_new" : "true", + "test.management.is_quarantined" : "true", "test.module" : "junit-4.10", "test.name" : "test_failed", "test.source.file" : "dummy_source_path", @@ -173,6 +174,7 @@ "test.framework_version" : ${content_meta_test_framework_version}, "test.is_new" : "true", "test.is_retry" : "true", + "test.management.is_quarantined" : "true", "test.module" : "junit-4.10", "test.name" : "test_failed", "test.retry_reason" : "efd", @@ -225,6 +227,7 @@ "test.framework_version" : ${content_meta_test_framework_version}, "test.is_new" : "true", "test.is_retry" : "true", + "test.management.is_quarantined" : "true", "test.module" : "junit-4.10", "test.name" : "test_failed", "test.retry_reason" : "efd", diff --git a/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-quarantined-failed-parameterized/events.ftl b/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-quarantined-failed-parameterized/events.ftl index 6ab10b0fb6f..2e1945b0a8b 100644 --- a/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-quarantined-failed-parameterized/events.ftl +++ b/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-quarantined-failed-parameterized/events.ftl @@ -120,6 +120,7 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "junit4", "test.framework_version" : ${content_meta_test_framework_version}, + "test.management.is_quarantined" : "true", "test.module" : "junit-4.10", "test.name" : "test_failed_parameterized", "test.parameters" : "{\"metadata\":{\"test_name\":\"test_failed_parameterized[0 0 42]\"}}", @@ -168,6 +169,7 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "junit4", "test.framework_version" : ${content_meta_test_framework_version}, + "test.management.is_quarantined" : "true", "test.module" : "junit-4.10", "test.name" : "test_failed_parameterized", "test.parameters" : "{\"metadata\":{\"test_name\":\"test_failed_parameterized[21 21 42]\"}}", diff --git a/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-quarantined-failed/events.ftl b/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-quarantined-failed/events.ftl index 661f29b1b5f..f44789bd26a 100644 --- a/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-quarantined-failed/events.ftl +++ b/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-quarantined-failed/events.ftl @@ -119,6 +119,7 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "junit4", "test.framework_version" : ${content_meta_test_framework_version}, + "test.management.is_quarantined" : "true", "test.module" : "junit-4.10", "test.name" : "test_failed", "test.source.file" : "dummy_source_path", @@ -149,4 +150,4 @@ }, "type" : "test", "version" : 2 -} ] \ No newline at end of file +} ] diff --git a/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-quarantined-failed-atr/events.ftl b/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-quarantined-failed-atr/events.ftl index bb58917bee1..14858b6c7e7 100644 --- a/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-quarantined-failed-atr/events.ftl +++ b/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-quarantined-failed-atr/events.ftl @@ -49,6 +49,7 @@ "span.kind" : "test", "test.framework" : "cucumber", "test.framework_version" : ${content_meta_test_framework_version}, + "test.management.is_quarantined" : "true", "test.module" : "cucumber-junit-5", "test.name" : "Addition", "test.status" : "fail", @@ -96,6 +97,7 @@ "test.framework" : "cucumber", "test.framework_version" : ${content_meta_test_framework_version}, "test.is_retry" : "true", + "test.management.is_quarantined" : "true", "test.module" : "cucumber-junit-5", "test.name" : "Addition", "test.retry_reason" : "atr", @@ -144,6 +146,7 @@ "test.framework" : "cucumber", "test.framework_version" : ${content_meta_test_framework_version}, "test.is_retry" : "true", + "test.management.is_quarantined" : "true", "test.module" : "cucumber-junit-5", "test.name" : "Addition", "test.retry_reason" : "atr", @@ -192,6 +195,7 @@ "test.framework" : "cucumber", "test.framework_version" : ${content_meta_test_framework_version}, "test.is_retry" : "true", + "test.management.is_quarantined" : "true", "test.module" : "cucumber-junit-5", "test.name" : "Addition", "test.retry_reason" : "atr", @@ -240,6 +244,7 @@ "test.framework" : "cucumber", "test.framework_version" : ${content_meta_test_framework_version}, "test.is_retry" : "true", + "test.management.is_quarantined" : "true", "test.module" : "cucumber-junit-5", "test.name" : "Addition", "test.retry_reason" : "atr", diff --git a/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-quarantined-failed-efd/events.ftl b/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-quarantined-failed-efd/events.ftl index 4acbe339494..86949c3073c 100644 --- a/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-quarantined-failed-efd/events.ftl +++ b/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-quarantined-failed-efd/events.ftl @@ -50,6 +50,7 @@ "test.framework" : "cucumber", "test.framework_version" : ${content_meta_test_framework_version}, "test.is_new" : "true", + "test.management.is_quarantined" : "true", "test.module" : "cucumber-junit-5", "test.name" : "Addition", "test.status" : "fail", @@ -98,6 +99,7 @@ "test.framework_version" : ${content_meta_test_framework_version}, "test.is_new" : "true", "test.is_retry" : "true", + "test.management.is_quarantined" : "true", "test.module" : "cucumber-junit-5", "test.name" : "Addition", "test.retry_reason" : "efd", @@ -147,6 +149,7 @@ "test.framework_version" : ${content_meta_test_framework_version}, "test.is_new" : "true", "test.is_retry" : "true", + "test.management.is_quarantined" : "true", "test.module" : "cucumber-junit-5", "test.name" : "Addition", "test.retry_reason" : "efd", diff --git a/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-quarantined-failed/events.ftl b/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-quarantined-failed/events.ftl index dd668874669..a4084dc3282 100644 --- a/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-quarantined-failed/events.ftl +++ b/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-quarantined-failed/events.ftl @@ -49,6 +49,7 @@ "span.kind" : "test", "test.framework" : "cucumber", "test.framework_version" : ${content_meta_test_framework_version}, + "test.management.is_quarantined" : "true", "test.module" : "cucumber-junit-5", "test.name" : "Addition", "test.status" : "fail", @@ -142,4 +143,4 @@ }, "type" : "test_module_end", "version" : 1 -} ] \ No newline at end of file +} ] diff --git a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed-atr/events.ftl b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed-atr/events.ftl index 494677c86bb..5be15c250ad 100644 --- a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed-atr/events.ftl +++ b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed-atr/events.ftl @@ -55,6 +55,7 @@ "test.framework" : "spock", "test.framework_version" : ${content_meta_test_framework_version}, "test.is_new" : "true", + "test.management.is_quarantined" : "true", "test.module" : "spock-junit-5", "test.name" : "test failed", "test.source.file" : "dummy_source_path", @@ -107,6 +108,7 @@ "test.framework_version" : ${content_meta_test_framework_version}, "test.is_new" : "true", "test.is_retry" : "true", + "test.management.is_quarantined" : "true", "test.module" : "spock-junit-5", "test.name" : "test failed", "test.retry_reason" : "atr", @@ -160,6 +162,7 @@ "test.framework_version" : ${content_meta_test_framework_version}, "test.is_new" : "true", "test.is_retry" : "true", + "test.management.is_quarantined" : "true", "test.module" : "spock-junit-5", "test.name" : "test failed", "test.retry_reason" : "atr", @@ -213,6 +216,7 @@ "test.framework_version" : ${content_meta_test_framework_version}, "test.is_new" : "true", "test.is_retry" : "true", + "test.management.is_quarantined" : "true", "test.module" : "spock-junit-5", "test.name" : "test failed", "test.retry_reason" : "atr", @@ -266,6 +270,7 @@ "test.framework_version" : ${content_meta_test_framework_version}, "test.is_new" : "true", "test.is_retry" : "true", + "test.management.is_quarantined" : "true", "test.module" : "spock-junit-5", "test.name" : "test failed", "test.retry_reason" : "atr", diff --git a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed-efd/events.ftl b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed-efd/events.ftl index 7939af650fb..32a57334d0c 100644 --- a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed-efd/events.ftl +++ b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed-efd/events.ftl @@ -55,6 +55,7 @@ "test.framework" : "spock", "test.framework_version" : ${content_meta_test_framework_version}, "test.is_new" : "true", + "test.management.is_quarantined" : "true", "test.module" : "spock-junit-5", "test.name" : "test failed", "test.source.file" : "dummy_source_path", @@ -107,6 +108,7 @@ "test.framework_version" : ${content_meta_test_framework_version}, "test.is_new" : "true", "test.is_retry" : "true", + "test.management.is_quarantined" : "true", "test.module" : "spock-junit-5", "test.name" : "test failed", "test.retry_reason" : "efd", @@ -160,6 +162,7 @@ "test.framework_version" : ${content_meta_test_framework_version}, "test.is_new" : "true", "test.is_retry" : "true", + "test.management.is_quarantined" : "true", "test.module" : "spock-junit-5", "test.name" : "test failed", "test.retry_reason" : "efd", diff --git a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed-parameterized/events.ftl b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed-parameterized/events.ftl index f680cdb5dbe..1cc899baf00 100644 --- a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed-parameterized/events.ftl +++ b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed-parameterized/events.ftl @@ -104,6 +104,7 @@ "test.framework" : "spock", "test.framework_version" : ${content_meta_test_framework_version}, "test.is_new" : "true", + "test.management.is_quarantined" : "true", "test.module" : "spock-junit-5", "test.name" : "test add 4 and 4", "test.parameters" : "{\"metadata\":{\"test_name\":\"test add 4 and 4\"}}", diff --git a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed/events.ftl b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed/events.ftl index 139ab206207..f26cd14e8ed 100644 --- a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed/events.ftl +++ b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed/events.ftl @@ -54,6 +54,7 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "spock", "test.framework_version" : ${content_meta_test_framework_version}, + "test.management.is_quarantined" : "true", "test.module" : "spock-junit-5", "test.name" : "test failed", "test.source.file" : "dummy_source_path", diff --git a/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed-atr/events.ftl b/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed-atr/events.ftl index b789fefc1bf..eea0791d003 100644 --- a/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed-atr/events.ftl +++ b/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed-atr/events.ftl @@ -120,6 +120,7 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "junit5", "test.framework_version" : ${content_meta_test_framework_version}, + "test.management.is_quarantined" : "true", "test.module" : "junit-5.3", "test.name" : "test_failed", "test.source.file" : "dummy_source_path", @@ -171,6 +172,7 @@ "test.framework" : "junit5", "test.framework_version" : ${content_meta_test_framework_version}, "test.is_retry" : "true", + "test.management.is_quarantined" : "true", "test.module" : "junit-5.3", "test.name" : "test_failed", "test.retry_reason" : "atr", @@ -223,6 +225,7 @@ "test.framework" : "junit5", "test.framework_version" : ${content_meta_test_framework_version}, "test.is_retry" : "true", + "test.management.is_quarantined" : "true", "test.module" : "junit-5.3", "test.name" : "test_failed", "test.retry_reason" : "atr", @@ -275,6 +278,7 @@ "test.framework" : "junit5", "test.framework_version" : ${content_meta_test_framework_version}, "test.is_retry" : "true", + "test.management.is_quarantined" : "true", "test.module" : "junit-5.3", "test.name" : "test_failed", "test.retry_reason" : "atr", @@ -327,6 +331,7 @@ "test.framework" : "junit5", "test.framework_version" : ${content_meta_test_framework_version}, "test.is_retry" : "true", + "test.management.is_quarantined" : "true", "test.module" : "junit-5.3", "test.name" : "test_failed", "test.retry_reason" : "atr", diff --git a/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed-efd/events.ftl b/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed-efd/events.ftl index 78b17e5d2a8..ae65671fb1b 100644 --- a/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed-efd/events.ftl +++ b/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed-efd/events.ftl @@ -123,6 +123,7 @@ "test.framework" : "junit5", "test.framework_version" : ${content_meta_test_framework_version}, "test.is_new" : "true", + "test.management.is_quarantined" : "true", "test.module" : "junit-5.3", "test.name" : "test_failed", "test.source.file" : "dummy_source_path", @@ -175,6 +176,7 @@ "test.framework_version" : ${content_meta_test_framework_version}, "test.is_new" : "true", "test.is_retry" : "true", + "test.management.is_quarantined" : "true", "test.module" : "junit-5.3", "test.name" : "test_failed", "test.retry_reason" : "efd", @@ -228,6 +230,7 @@ "test.framework_version" : ${content_meta_test_framework_version}, "test.is_new" : "true", "test.is_retry" : "true", + "test.management.is_quarantined" : "true", "test.module" : "junit-5.3", "test.name" : "test_failed", "test.retry_reason" : "efd", diff --git a/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed-parameterized/events.ftl b/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed-parameterized/events.ftl index 1dfdad89f47..dc422d1d12a 100644 --- a/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed-parameterized/events.ftl +++ b/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed-parameterized/events.ftl @@ -120,6 +120,7 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "junit5", "test.framework_version" : ${content_meta_test_framework_version}, + "test.management.is_quarantined" : "true", "test.module" : "junit-5.3", "test.name" : "test_failed_parameterized", "test.parameters" : "{\"metadata\":{\"test_name\":\"[1] 0, 0, 42\"}}", @@ -171,6 +172,7 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "junit5", "test.framework_version" : ${content_meta_test_framework_version}, + "test.management.is_quarantined" : "true", "test.module" : "junit-5.3", "test.name" : "test_failed_parameterized", "test.parameters" : "{\"metadata\":{\"test_name\":\"[2] 1, 1, 42\"}}", diff --git a/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed/events.ftl b/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed/events.ftl index 7c2c2feca53..382f11791e1 100644 --- a/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed/events.ftl +++ b/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed/events.ftl @@ -120,6 +120,7 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "junit5", "test.framework_version" : ${content_meta_test_framework_version}, + "test.management.is_quarantined" : "true", "test.module" : "junit-5.3", "test.name" : "test_failed", "test.source.file" : "dummy_source_path", @@ -150,4 +151,4 @@ }, "type" : "test", "version" : 2 -} ] \ No newline at end of file +} ] diff --git a/dd-java-agent/instrumentation/karate/src/test/resources/test-quarantined-failed/events.ftl b/dd-java-agent/instrumentation/karate/src/test/resources/test-quarantined-failed/events.ftl index 869575044b3..2440c78cd2c 100644 --- a/dd-java-agent/instrumentation/karate/src/test/resources/test-quarantined-failed/events.ftl +++ b/dd-java-agent/instrumentation/karate/src/test/resources/test-quarantined-failed/events.ftl @@ -139,6 +139,7 @@ "span.kind" : "test", "test.framework" : "karate", "test.framework_version" : ${content_meta_test_framework_version}, + "test.management.is_quarantined" : "true", "test.module" : "karate", "test.name" : "second scenario", "test.status" : "fail", diff --git a/dd-java-agent/instrumentation/scalatest/src/test/resources/test-quarantined-failed-atr/events.ftl b/dd-java-agent/instrumentation/scalatest/src/test/resources/test-quarantined-failed-atr/events.ftl index d9499753bd7..c5c24f827ed 100644 --- a/dd-java-agent/instrumentation/scalatest/src/test/resources/test-quarantined-failed-atr/events.ftl +++ b/dd-java-agent/instrumentation/scalatest/src/test/resources/test-quarantined-failed-atr/events.ftl @@ -54,6 +54,7 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "scalatest", "test.framework_version" : ${content_meta_test_framework_version}, + "test.management.is_quarantined" : "true", "test.module" : "scalatest", "test.name" : "Example.add adds two numbers", "test.source.file" : "dummy_source_path", @@ -102,6 +103,7 @@ "test.framework" : "scalatest", "test.framework_version" : ${content_meta_test_framework_version}, "test.is_retry" : "true", + "test.management.is_quarantined" : "true", "test.module" : "scalatest", "test.name" : "Example.add adds two numbers", "test.retry_reason" : "atr", @@ -151,6 +153,7 @@ "test.framework" : "scalatest", "test.framework_version" : ${content_meta_test_framework_version}, "test.is_retry" : "true", + "test.management.is_quarantined" : "true", "test.module" : "scalatest", "test.name" : "Example.add adds two numbers", "test.retry_reason" : "atr", @@ -200,6 +203,7 @@ "test.framework" : "scalatest", "test.framework_version" : ${content_meta_test_framework_version}, "test.is_retry" : "true", + "test.management.is_quarantined" : "true", "test.module" : "scalatest", "test.name" : "Example.add adds two numbers", "test.retry_reason" : "atr", @@ -249,6 +253,7 @@ "test.framework" : "scalatest", "test.framework_version" : ${content_meta_test_framework_version}, "test.is_retry" : "true", + "test.management.is_quarantined" : "true", "test.module" : "scalatest", "test.name" : "Example.add adds two numbers", "test.retry_reason" : "atr", diff --git a/dd-java-agent/instrumentation/scalatest/src/test/resources/test-quarantined-failed-efd/events.ftl b/dd-java-agent/instrumentation/scalatest/src/test/resources/test-quarantined-failed-efd/events.ftl index aba4496f09d..397094efa5c 100644 --- a/dd-java-agent/instrumentation/scalatest/src/test/resources/test-quarantined-failed-efd/events.ftl +++ b/dd-java-agent/instrumentation/scalatest/src/test/resources/test-quarantined-failed-efd/events.ftl @@ -55,6 +55,7 @@ "test.framework" : "scalatest", "test.framework_version" : ${content_meta_test_framework_version}, "test.is_new" : "true", + "test.management.is_quarantined" : "true", "test.module" : "scalatest", "test.name" : "Example.add adds two numbers", "test.source.file" : "dummy_source_path", @@ -104,6 +105,7 @@ "test.framework_version" : ${content_meta_test_framework_version}, "test.is_new" : "true", "test.is_retry" : "true", + "test.management.is_quarantined" : "true", "test.module" : "scalatest", "test.name" : "Example.add adds two numbers", "test.retry_reason" : "efd", @@ -154,6 +156,7 @@ "test.framework_version" : ${content_meta_test_framework_version}, "test.is_new" : "true", "test.is_retry" : "true", + "test.management.is_quarantined" : "true", "test.module" : "scalatest", "test.name" : "Example.add adds two numbers", "test.retry_reason" : "efd", diff --git a/dd-java-agent/instrumentation/scalatest/src/test/resources/test-quarantined-failed/events.ftl b/dd-java-agent/instrumentation/scalatest/src/test/resources/test-quarantined-failed/events.ftl index c316e1a718e..e1df07f0a58 100644 --- a/dd-java-agent/instrumentation/scalatest/src/test/resources/test-quarantined-failed/events.ftl +++ b/dd-java-agent/instrumentation/scalatest/src/test/resources/test-quarantined-failed/events.ftl @@ -54,6 +54,7 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "scalatest", "test.framework_version" : ${content_meta_test_framework_version}, + "test.management.is_quarantined" : "true", "test.module" : "scalatest", "test.name" : "Example.add adds two numbers", "test.source.file" : "dummy_source_path", @@ -147,4 +148,4 @@ }, "type" : "test_module_end", "version" : 1 -} ] \ No newline at end of file +} ] diff --git a/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-efd-faulty-session-threshold/events.ftl b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-efd-faulty-session-threshold/events.ftl index 83867ec017a..110273ab9d5 100644 --- a/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-efd-faulty-session-threshold/events.ftl +++ b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-efd-faulty-session-threshold/events.ftl @@ -1,438 +1,460 @@ [ { - "type" : "test_suite_end", - "version" : 1, "content" : { - "test_session_id" : ${content_test_session_id}, - "test_module_id" : ${content_test_module_id}, - "test_suite_id" : ${content_test_suite_id}, - "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", - "name" : "testng.test_suite", - "resource" : "org.example.TestFailedAndSucceed", - "start" : ${content_start}, "duration" : ${content_duration}, "error" : 0, - "metrics" : { }, "meta" : { - "test.type" : "test", - "test.source.file" : "dummy_source_path", - "test.module" : "testng-7", - "test.status" : "fail", - "test_session.name" : "session-name", - "env" : "none", + "_dd.p.tid" : ${content_meta__dd_p_tid}, + "component" : "testng", "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", "library_version" : ${content_meta_library_version}, - "component" : "testng", "span.kind" : "test_suite_end", - "test.suite" : "org.example.TestFailedAndSucceed", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "testng", "test.framework_version" : ${content_meta_test_framework_version}, - "test.framework" : "testng" - } - } + "test.module" : "testng-7", + "test.source.file" : "dummy_source_path", + "test.status" : "fail", + "test.suite" : "org.example.TestFailedAndSucceed", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count}, + "test.source.end" : 19, + "test.source.start" : 11 + }, + "name" : "testng.test_suite", + "resource" : "org.example.TestFailedAndSucceed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id} + }, + "type" : "test_suite_end", + "version" : 1 }, { - "type" : "test", - "version" : 2, "content" : { - "trace_id" : ${content_trace_id}, - "span_id" : ${content_span_id}, - "parent_id" : ${content_parent_id}, - "test_session_id" : ${content_test_session_id}, - "test_module_id" : ${content_test_module_id}, - "test_suite_id" : ${content_test_suite_id}, - "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", - "name" : "testng.test", - "resource" : "org.example.TestFailedAndSucceed.test_another_succeed", - "start" : ${content_start_2}, "duration" : ${content_duration_2}, "error" : 1, - "metrics" : { - "process_id" : ${content_metrics_process_id}, - "_dd.profiling.enabled" : 0, - "_dd.trace_span_attribute_schema" : 0, - "test.source.end" : 18, - "test.source.start" : 12 - }, "meta" : { + "_dd.profiling.ctx" : "test", "_dd.tracer_host" : ${content_meta__dd_tracer_host}, - "test.source.file" : "dummy_source_path", - "test.source.method" : "test_another_succeed()V", - "test.module" : "testng-7", - "test.status" : "fail", + "component" : "testng", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", "language" : "jvm", - "test.is_new" : "true", - "test.codeowners" : "[\"owner1\",\"owner2\"]", "library_version" : ${content_meta_library_version}, - "test.name" : "test_another_succeed", + "runtime-id" : ${content_meta_runtime_id}, "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "testng", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.is_new" : "true", + "test.module" : "testng-7", + "test.name" : "test_another_succeed", + "test.source.file" : "dummy_source_path", + "test.source.method" : "test_another_succeed()V", + "test.status" : "fail", "test.suite" : "org.example.TestFailedAndSucceed", - "runtime-id" : ${content_meta_runtime_id}, "test.type" : "test", - "test_session.name" : "session-name", - "env" : "none", - "dummy_ci_tag" : "dummy_ci_tag_value", - "component" : "testng", - "_dd.profiling.ctx" : "test", - "test.framework_version" : ${content_meta_test_framework_version}, - "test.framework" : "testng" - } - } -}, { - "type" : "test", - "version" : 2, - "content" : { - "trace_id" : ${content_trace_id_2}, - "span_id" : ${content_span_id_2}, - "parent_id" : ${content_parent_id}, - "test_session_id" : ${content_test_session_id}, - "test_module_id" : ${content_test_module_id}, - "test_suite_id" : ${content_test_suite_id}, - "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", - "name" : "testng.test", - "resource" : "org.example.TestFailedAndSucceed.test_another_succeed", - "start" : ${content_start_3}, - "duration" : ${content_duration_3}, - "error" : 1, + "test_session.name" : "session-name" + }, "metrics" : { - "process_id" : ${content_metrics_process_id}, + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_2}, "_dd.profiling.enabled" : 0, "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id}, "test.source.end" : 18, "test.source.start" : 12 }, + "name" : "testng.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestFailedAndSucceed.test_another_succeed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id}, + "start" : ${content_start_2}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_3}, + "error" : 1, "meta" : { + "_dd.profiling.ctx" : "test", "_dd.tracer_host" : ${content_meta__dd_tracer_host}, - "test.source.file" : "dummy_source_path", - "test.source.method" : "test_another_succeed()V", - "test.module" : "testng-7", - "test.status" : "fail", + "component" : "testng", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", "language" : "jvm", - "test.is_new" : "true", - "test.codeowners" : "[\"owner1\",\"owner2\"]", "library_version" : ${content_meta_library_version}, - "test.name" : "test_another_succeed", + "runtime-id" : ${content_meta_runtime_id}, "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "testng", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.is_new" : "true", + "test.is_retry" : "true", + "test.module" : "testng-7", + "test.name" : "test_another_succeed", + "test.retry_reason" : "efd", + "test.source.file" : "dummy_source_path", + "test.source.method" : "test_another_succeed()V", + "test.status" : "fail", "test.suite" : "org.example.TestFailedAndSucceed", - "runtime-id" : ${content_meta_runtime_id}, "test.type" : "test", - "test_session.name" : "session-name", - "env" : "none", - "dummy_ci_tag" : "dummy_ci_tag_value", - "test.is_retry" : "true", - "component" : "testng", - "_dd.profiling.ctx" : "test", - "test.framework_version" : ${content_meta_test_framework_version}, - "test.framework" : "testng" - } - } -}, { - "type" : "test", - "version" : 2, - "content" : { - "trace_id" : ${content_trace_id_3}, - "span_id" : ${content_span_id_3}, - "parent_id" : ${content_parent_id}, - "test_session_id" : ${content_test_session_id}, - "test_module_id" : ${content_test_module_id}, - "test_suite_id" : ${content_test_suite_id}, - "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", - "name" : "testng.test", - "resource" : "org.example.TestFailedAndSucceed.test_another_succeed", - "start" : ${content_start_4}, - "duration" : ${content_duration_4}, - "error" : 0, + "test_session.name" : "session-name" + }, "metrics" : { - "process_id" : ${content_metrics_process_id}, + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_3}, "_dd.profiling.enabled" : 0, "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id}, "test.source.end" : 18, "test.source.start" : 12 }, + "name" : "testng.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestFailedAndSucceed.test_another_succeed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id_2}, + "start" : ${content_start_3}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id_2} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_4}, + "error" : 0, "meta" : { + "_dd.profiling.ctx" : "test", "_dd.tracer_host" : ${content_meta__dd_tracer_host}, - "test.source.file" : "dummy_source_path", - "test.source.method" : "test_another_succeed()V", - "test.module" : "testng-7", - "test.status" : "pass", + "component" : "testng", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", "language" : "jvm", - "test.is_new" : "true", - "test.codeowners" : "[\"owner1\",\"owner2\"]", "library_version" : ${content_meta_library_version}, - "test.name" : "test_another_succeed", + "runtime-id" : ${content_meta_runtime_id}, "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "testng", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.is_new" : "true", + "test.is_retry" : "true", + "test.module" : "testng-7", + "test.name" : "test_another_succeed", + "test.retry_reason" : "efd", + "test.source.file" : "dummy_source_path", + "test.source.method" : "test_another_succeed()V", + "test.status" : "pass", "test.suite" : "org.example.TestFailedAndSucceed", - "runtime-id" : ${content_meta_runtime_id}, "test.type" : "test", - "test_session.name" : "session-name", - "env" : "none", - "dummy_ci_tag" : "dummy_ci_tag_value", - "test.is_retry" : "true", - "component" : "testng", - "_dd.profiling.ctx" : "test", - "test.framework_version" : ${content_meta_test_framework_version}, - "test.framework" : "testng" - } - } -}, { - "type" : "test", - "version" : 2, - "content" : { - "trace_id" : ${content_trace_id_4}, - "span_id" : ${content_span_id_4}, - "parent_id" : ${content_parent_id}, - "test_session_id" : ${content_test_session_id}, - "test_module_id" : ${content_test_module_id}, - "test_suite_id" : ${content_test_suite_id}, - "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", - "name" : "testng.test", - "resource" : "org.example.TestFailedAndSucceed.test_failed", - "start" : ${content_start_5}, - "duration" : ${content_duration_5}, - "error" : 1, + "test_session.name" : "session-name" + }, "metrics" : { - "process_id" : ${content_metrics_process_id}, + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_4}, "_dd.profiling.enabled" : 0, "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id}, "test.source.end" : 18, "test.source.start" : 12 }, + "name" : "testng.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestFailedAndSucceed.test_another_succeed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id_3}, + "start" : ${content_start_4}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id_3} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_5}, + "error" : 1, "meta" : { + "_dd.profiling.ctx" : "test", "_dd.tracer_host" : ${content_meta__dd_tracer_host}, - "test.source.file" : "dummy_source_path", - "test.source.method" : "test_failed()V", - "test.module" : "testng-7", - "test.status" : "fail", + "component" : "testng", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack}, + "error.type" : "java.lang.AssertionError", "language" : "jvm", - "test.is_new" : "true", - "test.codeowners" : "[\"owner1\",\"owner2\"]", "library_version" : ${content_meta_library_version}, - "test.name" : "test_failed", + "runtime-id" : ${content_meta_runtime_id}, "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "testng", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.is_new" : "true", + "test.module" : "testng-7", + "test.name" : "test_failed", + "test.source.file" : "dummy_source_path", + "test.source.method" : "test_failed()V", + "test.status" : "fail", "test.suite" : "org.example.TestFailedAndSucceed", - "runtime-id" : ${content_meta_runtime_id}, "test.type" : "test", - "test_session.name" : "session-name", - "env" : "none", - "dummy_ci_tag" : "dummy_ci_tag_value", - "component" : "testng", - "error.type" : "java.lang.AssertionError", - "_dd.profiling.ctx" : "test", - "error.message" : ${content_meta_error_message}, - "error.stack" : ${content_meta_error_stack}, - "test.framework_version" : ${content_meta_test_framework_version}, - "test.framework" : "testng" - } - } -}, { - "type" : "test", - "version" : 2, - "content" : { - "trace_id" : ${content_trace_id_5}, - "span_id" : ${content_span_id_5}, - "parent_id" : ${content_parent_id}, - "test_session_id" : ${content_test_session_id}, - "test_module_id" : ${content_test_module_id}, - "test_suite_id" : ${content_test_suite_id}, - "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", - "name" : "testng.test", - "resource" : "org.example.TestFailedAndSucceed.test_failed", - "start" : ${content_start_6}, - "duration" : ${content_duration_6}, - "error" : 1, + "test_session.name" : "session-name" + }, "metrics" : { - "process_id" : ${content_metrics_process_id}, + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_5}, "_dd.profiling.enabled" : 0, "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id}, "test.source.end" : 18, "test.source.start" : 12 }, + "name" : "testng.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestFailedAndSucceed.test_failed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id_4}, + "start" : ${content_start_5}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id_4} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_6}, + "error" : 1, "meta" : { + "_dd.profiling.ctx" : "test", "_dd.tracer_host" : ${content_meta__dd_tracer_host}, - "test.source.file" : "dummy_source_path", - "test.source.method" : "test_failed()V", - "test.module" : "testng-7", - "test.status" : "fail", + "component" : "testng", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack_2}, + "error.type" : "java.lang.AssertionError", "language" : "jvm", - "test.is_new" : "true", - "test.codeowners" : "[\"owner1\",\"owner2\"]", "library_version" : ${content_meta_library_version}, - "test.name" : "test_failed", + "runtime-id" : ${content_meta_runtime_id}, "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "testng", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.is_new" : "true", + "test.is_retry" : "true", + "test.module" : "testng-7", + "test.name" : "test_failed", + "test.retry_reason" : "efd", + "test.source.file" : "dummy_source_path", + "test.source.method" : "test_failed()V", + "test.status" : "fail", "test.suite" : "org.example.TestFailedAndSucceed", - "runtime-id" : ${content_meta_runtime_id}, "test.type" : "test", - "test_session.name" : "session-name", - "env" : "none", - "dummy_ci_tag" : "dummy_ci_tag_value", - "test.is_retry" : "true", - "component" : "testng", - "error.type" : "java.lang.AssertionError", - "_dd.profiling.ctx" : "test", - "error.message" : ${content_meta_error_message}, - "error.stack" : ${content_meta_error_stack_2}, - "test.framework_version" : ${content_meta_test_framework_version}, - "test.framework" : "testng" - } - } -}, { - "type" : "test", - "version" : 2, - "content" : { - "trace_id" : ${content_trace_id_6}, - "span_id" : ${content_span_id_6}, - "parent_id" : ${content_parent_id}, - "test_session_id" : ${content_test_session_id}, - "test_module_id" : ${content_test_module_id}, - "test_suite_id" : ${content_test_suite_id}, - "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", - "name" : "testng.test", - "resource" : "org.example.TestFailedAndSucceed.test_failed", - "start" : ${content_start_7}, - "duration" : ${content_duration_7}, - "error" : 1, + "test_session.name" : "session-name" + }, "metrics" : { - "process_id" : ${content_metrics_process_id}, + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_6}, "_dd.profiling.enabled" : 0, "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id}, "test.source.end" : 18, "test.source.start" : 12 }, + "name" : "testng.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestFailedAndSucceed.test_failed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id_5}, + "start" : ${content_start_6}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id_5} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_7}, + "error" : 1, "meta" : { + "_dd.profiling.ctx" : "test", "_dd.tracer_host" : ${content_meta__dd_tracer_host}, - "test.source.file" : "dummy_source_path", - "test.source.method" : "test_failed()V", - "test.module" : "testng-7", - "test.status" : "fail", + "component" : "testng", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack_3}, + "error.type" : "java.lang.AssertionError", "language" : "jvm", - "test.is_new" : "true", - "test.codeowners" : "[\"owner1\",\"owner2\"]", "library_version" : ${content_meta_library_version}, - "test.name" : "test_failed", + "runtime-id" : ${content_meta_runtime_id}, "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "testng", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.is_new" : "true", + "test.is_retry" : "true", + "test.module" : "testng-7", + "test.name" : "test_failed", + "test.retry_reason" : "efd", + "test.source.file" : "dummy_source_path", + "test.source.method" : "test_failed()V", + "test.status" : "fail", "test.suite" : "org.example.TestFailedAndSucceed", - "runtime-id" : ${content_meta_runtime_id}, "test.type" : "test", - "test_session.name" : "session-name", - "env" : "none", - "dummy_ci_tag" : "dummy_ci_tag_value", - "test.is_retry" : "true", - "component" : "testng", - "error.type" : "java.lang.AssertionError", - "_dd.profiling.ctx" : "test", - "error.message" : ${content_meta_error_message}, - "error.stack" : ${content_meta_error_stack_3}, - "test.framework_version" : ${content_meta_test_framework_version}, - "test.framework" : "testng" - } - } -}, { - "type" : "test", - "version" : 2, - "content" : { - "trace_id" : ${content_trace_id_7}, - "span_id" : ${content_span_id_7}, - "parent_id" : ${content_parent_id}, - "test_session_id" : ${content_test_session_id}, - "test_module_id" : ${content_test_module_id}, - "test_suite_id" : ${content_test_suite_id}, - "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", - "name" : "testng.test", - "resource" : "org.example.TestFailedAndSucceed.test_succeed", - "start" : ${content_start_8}, - "duration" : ${content_duration_8}, - "error" : 0, + "test_session.name" : "session-name" + }, "metrics" : { - "process_id" : ${content_metrics_process_id}, + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_7}, "_dd.profiling.enabled" : 0, "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id}, "test.source.end" : 18, "test.source.start" : 12 }, + "name" : "testng.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestFailedAndSucceed.test_failed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id_6}, + "start" : ${content_start_7}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id_6} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_8}, + "error" : 0, "meta" : { + "_dd.profiling.ctx" : "test", "_dd.tracer_host" : ${content_meta__dd_tracer_host}, - "test.source.file" : "dummy_source_path", - "test.source.method" : "test_succeed()V", - "test.module" : "testng-7", - "test.status" : "pass", + "component" : "testng", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", "language" : "jvm", - "test.is_new" : "true", - "test.codeowners" : "[\"owner1\",\"owner2\"]", "library_version" : ${content_meta_library_version}, - "test.name" : "test_succeed", + "runtime-id" : ${content_meta_runtime_id}, "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "testng", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.is_new" : "true", + "test.module" : "testng-7", + "test.name" : "test_succeed", + "test.source.file" : "dummy_source_path", + "test.source.method" : "test_succeed()V", + "test.status" : "pass", "test.suite" : "org.example.TestFailedAndSucceed", - "runtime-id" : ${content_meta_runtime_id}, "test.type" : "test", - "test_session.name" : "session-name", - "env" : "none", - "dummy_ci_tag" : "dummy_ci_tag_value", - "component" : "testng", - "_dd.profiling.ctx" : "test", - "test.framework_version" : ${content_meta_test_framework_version}, - "test.framework" : "testng" - } - } + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_8}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id}, + "test.source.end" : 18, + "test.source.start" : 12 + }, + "name" : "testng.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestFailedAndSucceed.test_succeed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id_7}, + "start" : ${content_start_8}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id_7} + }, + "type" : "test", + "version" : 2 }, { - "type" : "test_session_end", - "version" : 1, "content" : { - "test_session_id" : ${content_test_session_id}, - "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", - "name" : "testng.test_session", - "resource" : "testng-7", - "start" : ${content_start_9}, "duration" : ${content_duration_9}, "error" : 0, - "metrics" : { - "process_id" : ${content_metrics_process_id}, - "_dd.profiling.enabled" : 0, - "_dd.trace_span_attribute_schema" : 0 - }, "meta" : { - "test.type" : "test", + "_dd.p.tid" : ${content_meta__dd_p_tid_2}, + "_dd.profiling.ctx" : "test", "_dd.tracer_host" : ${content_meta__dd_tracer_host}, - "test.status" : "fail", - "test.early_flake.enabled" : "true", - "test_session.name" : "session-name", - "language" : "jvm", - "test.early_flake.abort_reason" : "faulty", - "env" : "none", + "component" : "testng", "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "language" : "jvm", "library_version" : ${content_meta_library_version}, - "component" : "testng", - "_dd.profiling.ctx" : "test", - "span.kind" : "test_session_end", "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test_session_end", "test.command" : "testng-7", + "test.early_flake.abort_reason" : "faulty", + "test.early_flake.enabled" : "true", + "test.framework" : "testng", "test.framework_version" : ${content_meta_test_framework_version}, - "test.framework" : "testng" - } - } + "test.status" : "fail", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_9}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "testng.test_session", + "resource" : "testng-7", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_9}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_session_end", + "version" : 1 }, { - "type" : "test_module_end", - "version" : 1, "content" : { - "test_session_id" : ${content_test_session_id}, - "test_module_id" : ${content_test_module_id}, - "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", - "name" : "testng.test_module", - "resource" : "testng-7", - "start" : ${content_start_10}, "duration" : ${content_duration_10}, "error" : 0, - "metrics" : { }, "meta" : { - "test.type" : "test", - "test.module" : "testng-7", - "test.status" : "fail", - "test.early_flake.enabled" : "true", - "test_session.name" : "session-name", - "test.early_flake.abort_reason" : "faulty", - "env" : "none", + "_dd.p.tid" : ${content_meta__dd_p_tid_3}, + "component" : "testng", "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", "library_version" : ${content_meta_library_version}, - "component" : "testng", "span.kind" : "test_module_end", + "test.early_flake.abort_reason" : "faulty", + "test.early_flake.enabled" : "true", + "test.framework" : "testng", "test.framework_version" : ${content_meta_test_framework_version}, - "test.framework" : "testng" - } - } + "test.module" : "testng-7", + "test.status" : "fail", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_10} + }, + "name" : "testng.test_module", + "resource" : "testng-7", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_10}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_module_end", + "version" : 1 } ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-efd-known-parameterized-test/events.ftl b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-efd-known-parameterized-test/events.ftl index c26bcd15871..a99c7db5fac 100644 --- a/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-efd-known-parameterized-test/events.ftl +++ b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-efd-known-parameterized-test/events.ftl @@ -1,188 +1,201 @@ [ { - "type" : "test_suite_end", - "version" : 1, "content" : { - "test_session_id" : ${content_test_session_id}, - "test_module_id" : ${content_test_module_id}, - "test_suite_id" : ${content_test_suite_id}, - "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", - "name" : "testng.test_suite", - "resource" : "org.example.TestParameterized", - "start" : ${content_start}, "duration" : ${content_duration}, "error" : 0, - "metrics" : { }, "meta" : { - "test.type" : "test", - "test.source.file" : "dummy_source_path", - "test.module" : "testng-7", - "test.status" : "pass", - "test_session.name" : "session-name", - "env" : "none", + "_dd.p.tid" : ${content_meta__dd_p_tid}, + "component" : "testng", "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", "library_version" : ${content_meta_library_version}, - "component" : "testng", "span.kind" : "test_suite_end", - "test.suite" : "org.example.TestParameterized", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "testng", "test.framework_version" : ${content_meta_test_framework_version}, - "test.framework" : "testng" - } - } + "test.module" : "testng-7", + "test.source.file" : "dummy_source_path", + "test.status" : "pass", + "test.suite" : "org.example.TestParameterized", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count}, + "test.source.end" : 19, + "test.source.start" : 11 + }, + "name" : "testng.test_suite", + "resource" : "org.example.TestParameterized", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id} + }, + "type" : "test_suite_end", + "version" : 1 }, { - "type" : "test", - "version" : 2, "content" : { - "trace_id" : ${content_trace_id}, - "span_id" : ${content_span_id}, - "parent_id" : ${content_parent_id}, - "test_session_id" : ${content_test_session_id}, - "test_module_id" : ${content_test_module_id}, - "test_suite_id" : ${content_test_suite_id}, - "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", - "name" : "testng.test", - "resource" : "org.example.TestParameterized.parameterized_test_succeed", - "start" : ${content_start_2}, "duration" : ${content_duration_2}, "error" : 0, - "metrics" : { - "process_id" : ${content_metrics_process_id}, - "_dd.profiling.enabled" : 0, - "_dd.trace_span_attribute_schema" : 0, - "test.source.end" : 18, - "test.source.start" : 12 - }, "meta" : { + "_dd.profiling.ctx" : "test", "_dd.tracer_host" : ${content_meta__dd_tracer_host}, - "test.source.file" : "dummy_source_path", - "test.source.method" : "parameterized_test_succeed(Ljava/lang/String;Z)V", - "test.module" : "testng-7", - "test.status" : "pass", + "component" : "testng", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", "language" : "jvm", - "test.codeowners" : "[\"owner1\",\"owner2\"]", "library_version" : ${content_meta_library_version}, - "test.name" : "parameterized_test_succeed", + "runtime-id" : ${content_meta_runtime_id}, "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "testng", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "testng-7", + "test.name" : "parameterized_test_succeed", + "test.parameters" : "{\"arguments\":{\"0\":\"hello\",\"1\":\"true\"}}", + "test.source.file" : "dummy_source_path", + "test.source.method" : "parameterized_test_succeed(Ljava/lang/String;Z)V", + "test.status" : "pass", "test.suite" : "org.example.TestParameterized", - "runtime-id" : ${content_meta_runtime_id}, "test.type" : "test", - "test_session.name" : "session-name", - "env" : "none", - "dummy_ci_tag" : "dummy_ci_tag_value", - "test.parameters" : "{\"arguments\":{\"0\":\"hello\",\"1\":\"true\"}}", - "component" : "testng", - "_dd.profiling.ctx" : "test", - "test.framework_version" : ${content_meta_test_framework_version}, - "test.framework" : "testng" - } - } -}, { - "type" : "test", - "version" : 2, - "content" : { - "trace_id" : ${content_trace_id_2}, - "span_id" : ${content_span_id_2}, - "parent_id" : ${content_parent_id}, - "test_session_id" : ${content_test_session_id}, - "test_module_id" : ${content_test_module_id}, - "test_suite_id" : ${content_test_suite_id}, - "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", - "name" : "testng.test", - "resource" : "org.example.TestParameterized.parameterized_test_succeed", - "start" : ${content_start_3}, - "duration" : ${content_duration_3}, - "error" : 0, + "test_session.name" : "session-name" + }, "metrics" : { - "process_id" : ${content_metrics_process_id}, + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_2}, "_dd.profiling.enabled" : 0, "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id}, "test.source.end" : 18, "test.source.start" : 12 }, + "name" : "testng.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestParameterized.parameterized_test_succeed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id}, + "start" : ${content_start_2}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_3}, + "error" : 0, "meta" : { + "_dd.profiling.ctx" : "test", "_dd.tracer_host" : ${content_meta__dd_tracer_host}, - "test.source.file" : "dummy_source_path", - "test.source.method" : "parameterized_test_succeed(Ljava/lang/String;Z)V", - "test.module" : "testng-7", - "test.status" : "pass", + "component" : "testng", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", "language" : "jvm", - "test.codeowners" : "[\"owner1\",\"owner2\"]", "library_version" : ${content_meta_library_version}, - "test.name" : "parameterized_test_succeed", + "runtime-id" : ${content_meta_runtime_id}, "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "testng", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "testng-7", + "test.name" : "parameterized_test_succeed", + "test.parameters" : "{\"arguments\":{\"0\":\"\\\"goodbye\\\"\",\"1\":\"false\"}}", + "test.source.file" : "dummy_source_path", + "test.source.method" : "parameterized_test_succeed(Ljava/lang/String;Z)V", + "test.status" : "pass", "test.suite" : "org.example.TestParameterized", - "runtime-id" : ${content_meta_runtime_id}, "test.type" : "test", - "test_session.name" : "session-name", - "env" : "none", - "dummy_ci_tag" : "dummy_ci_tag_value", - "test.parameters" : "{\"arguments\":{\"0\":\"\\\"goodbye\\\"\",\"1\":\"false\"}}", - "component" : "testng", - "_dd.profiling.ctx" : "test", - "test.framework_version" : ${content_meta_test_framework_version}, - "test.framework" : "testng" - } - } + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_3}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id}, + "test.source.end" : 18, + "test.source.start" : 12 + }, + "name" : "testng.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestParameterized.parameterized_test_succeed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id_2}, + "start" : ${content_start_3}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id_2} + }, + "type" : "test", + "version" : 2 }, { - "type" : "test_session_end", - "version" : 1, "content" : { - "test_session_id" : ${content_test_session_id}, - "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", - "name" : "testng.test_session", - "resource" : "testng-7", - "start" : ${content_start_4}, "duration" : ${content_duration_4}, "error" : 0, - "metrics" : { - "process_id" : ${content_metrics_process_id}, - "_dd.profiling.enabled" : 0, - "_dd.trace_span_attribute_schema" : 0 - }, "meta" : { - "test.type" : "test", + "_dd.p.tid" : ${content_meta__dd_p_tid_2}, + "_dd.profiling.ctx" : "test", "_dd.tracer_host" : ${content_meta__dd_tracer_host}, - "test.status" : "pass", - "test.early_flake.enabled" : "true", - "test_session.name" : "session-name", - "language" : "jvm", - "env" : "none", + "component" : "testng", "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "language" : "jvm", "library_version" : ${content_meta_library_version}, - "component" : "testng", - "_dd.profiling.ctx" : "test", - "span.kind" : "test_session_end", "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test_session_end", "test.command" : "testng-7", + "test.early_flake.enabled" : "true", + "test.framework" : "testng", "test.framework_version" : ${content_meta_test_framework_version}, - "test.framework" : "testng" - } - } + "test.status" : "pass", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_4}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "testng.test_session", + "resource" : "testng-7", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_4}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_session_end", + "version" : 1 }, { - "type" : "test_module_end", - "version" : 1, "content" : { - "test_session_id" : ${content_test_session_id}, - "test_module_id" : ${content_test_module_id}, - "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", - "name" : "testng.test_module", - "resource" : "testng-7", - "start" : ${content_start_5}, "duration" : ${content_duration_5}, "error" : 0, - "metrics" : { }, "meta" : { - "test.type" : "test", - "test.module" : "testng-7", - "test.status" : "pass", - "test.early_flake.enabled" : "true", - "test_session.name" : "session-name", - "env" : "none", + "_dd.p.tid" : ${content_meta__dd_p_tid_3}, + "component" : "testng", "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", "library_version" : ${content_meta_library_version}, - "component" : "testng", "span.kind" : "test_module_end", + "test.early_flake.enabled" : "true", + "test.framework" : "testng", "test.framework_version" : ${content_meta_test_framework_version}, - "test.framework" : "testng" - } - } + "test.module" : "testng-7", + "test.status" : "pass", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_5} + }, + "name" : "testng.test_module", + "resource" : "testng-7", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_5}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_module_end", + "version" : 1 } ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-efd-known-test/events.ftl b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-efd-known-test/events.ftl index c6613ad7cfd..df3e613fd0b 100644 --- a/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-efd-known-test/events.ftl +++ b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-efd-known-test/events.ftl @@ -1,140 +1,152 @@ [ { - "type" : "test_suite_end", - "version" : 1, "content" : { - "test_session_id" : ${content_test_session_id}, - "test_module_id" : ${content_test_module_id}, - "test_suite_id" : ${content_test_suite_id}, - "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", - "name" : "testng.test_suite", - "resource" : "org.example.TestSucceed", - "start" : ${content_start}, "duration" : ${content_duration}, "error" : 0, - "metrics" : { }, "meta" : { - "test.type" : "test", - "test.source.file" : "dummy_source_path", - "test.module" : "testng-7", - "test.status" : "pass", - "test_session.name" : "session-name", - "env" : "none", + "_dd.p.tid" : ${content_meta__dd_p_tid}, + "component" : "testng", "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", "library_version" : ${content_meta_library_version}, - "component" : "testng", "span.kind" : "test_suite_end", - "test.suite" : "org.example.TestSucceed", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "testng", "test.framework_version" : ${content_meta_test_framework_version}, - "test.framework" : "testng" - } - } + "test.module" : "testng-7", + "test.source.file" : "dummy_source_path", + "test.status" : "pass", + "test.suite" : "org.example.TestSucceed", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count}, + "test.source.end" : 19, + "test.source.start" : 11 + }, + "name" : "testng.test_suite", + "resource" : "org.example.TestSucceed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id} + }, + "type" : "test_suite_end", + "version" : 1 }, { - "type" : "test", - "version" : 2, "content" : { - "trace_id" : ${content_trace_id}, - "span_id" : ${content_span_id}, - "parent_id" : ${content_parent_id}, - "test_session_id" : ${content_test_session_id}, - "test_module_id" : ${content_test_module_id}, - "test_suite_id" : ${content_test_suite_id}, - "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", - "name" : "testng.test", - "resource" : "org.example.TestSucceed.test_succeed", - "start" : ${content_start_2}, "duration" : ${content_duration_2}, "error" : 0, - "metrics" : { - "process_id" : ${content_metrics_process_id}, - "_dd.profiling.enabled" : 0, - "_dd.trace_span_attribute_schema" : 0, - "test.source.end" : 18, - "test.source.start" : 12 - }, "meta" : { + "_dd.profiling.ctx" : "test", "_dd.tracer_host" : ${content_meta__dd_tracer_host}, - "test.source.file" : "dummy_source_path", - "test.source.method" : "test_succeed()V", - "test.module" : "testng-7", - "test.status" : "pass", + "component" : "testng", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", "language" : "jvm", - "test.codeowners" : "[\"owner1\",\"owner2\"]", "library_version" : ${content_meta_library_version}, - "test.name" : "test_succeed", + "runtime-id" : ${content_meta_runtime_id}, "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "testng", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "testng-7", + "test.name" : "test_succeed", + "test.source.file" : "dummy_source_path", + "test.source.method" : "test_succeed()V", + "test.status" : "pass", "test.suite" : "org.example.TestSucceed", - "runtime-id" : ${content_meta_runtime_id}, "test.type" : "test", - "test_session.name" : "session-name", - "env" : "none", - "dummy_ci_tag" : "dummy_ci_tag_value", - "component" : "testng", - "_dd.profiling.ctx" : "test", - "test.framework_version" : ${content_meta_test_framework_version}, - "test.framework" : "testng" - } - } + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_2}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id}, + "test.source.end" : 18, + "test.source.start" : 12 + }, + "name" : "testng.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestSucceed.test_succeed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id}, + "start" : ${content_start_2}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id} + }, + "type" : "test", + "version" : 2 }, { - "type" : "test_session_end", - "version" : 1, "content" : { - "test_session_id" : ${content_test_session_id}, - "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", - "name" : "testng.test_session", - "resource" : "testng-7", - "start" : ${content_start_3}, "duration" : ${content_duration_3}, "error" : 0, - "metrics" : { - "process_id" : ${content_metrics_process_id}, - "_dd.profiling.enabled" : 0, - "_dd.trace_span_attribute_schema" : 0 - }, "meta" : { - "test.type" : "test", + "_dd.p.tid" : ${content_meta__dd_p_tid_2}, + "_dd.profiling.ctx" : "test", "_dd.tracer_host" : ${content_meta__dd_tracer_host}, - "test.status" : "pass", - "test.early_flake.enabled" : "true", - "test_session.name" : "session-name", - "language" : "jvm", - "env" : "none", + "component" : "testng", "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "language" : "jvm", "library_version" : ${content_meta_library_version}, - "component" : "testng", - "_dd.profiling.ctx" : "test", - "span.kind" : "test_session_end", "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test_session_end", "test.command" : "testng-7", + "test.early_flake.enabled" : "true", + "test.framework" : "testng", "test.framework_version" : ${content_meta_test_framework_version}, - "test.framework" : "testng" - } - } + "test.status" : "pass", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_3}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "testng.test_session", + "resource" : "testng-7", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_3}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_session_end", + "version" : 1 }, { - "type" : "test_module_end", - "version" : 1, "content" : { - "test_session_id" : ${content_test_session_id}, - "test_module_id" : ${content_test_module_id}, - "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", - "name" : "testng.test_module", - "resource" : "testng-7", - "start" : ${content_start_4}, "duration" : ${content_duration_4}, "error" : 0, - "metrics" : { }, "meta" : { - "test.type" : "test", - "test.module" : "testng-7", - "test.status" : "pass", - "test.early_flake.enabled" : "true", - "test_session.name" : "session-name", - "env" : "none", + "_dd.p.tid" : ${content_meta__dd_p_tid_3}, + "component" : "testng", "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", "library_version" : ${content_meta_library_version}, - "component" : "testng", "span.kind" : "test_module_end", + "test.early_flake.enabled" : "true", + "test.framework" : "testng", "test.framework_version" : ${content_meta_test_framework_version}, - "test.framework" : "testng" - } - } + "test.module" : "testng-7", + "test.status" : "pass", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_4} + }, + "name" : "testng.test_module", + "resource" : "testng-7", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_4}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_module_end", + "version" : 1 } ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-efd-known-tests-and-new-test/events.ftl b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-efd-known-tests-and-new-test/events.ftl index 8580f14f878..49d5e2576c8 100644 --- a/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-efd-known-tests-and-new-test/events.ftl +++ b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-efd-known-tests-and-new-test/events.ftl @@ -1,332 +1,350 @@ [ { - "type" : "test_suite_end", - "version" : 1, "content" : { - "test_session_id" : ${content_test_session_id}, - "test_module_id" : ${content_test_module_id}, - "test_suite_id" : ${content_test_suite_id}, - "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", - "name" : "testng.test_suite", - "resource" : "org.example.TestFailedAndSucceed", - "start" : ${content_start}, "duration" : ${content_duration}, "error" : 0, - "metrics" : { }, "meta" : { - "test.type" : "test", - "test.source.file" : "dummy_source_path", - "test.module" : "testng-7", - "test.status" : "fail", - "test_session.name" : "session-name", - "env" : "none", + "_dd.p.tid" : ${content_meta__dd_p_tid}, + "component" : "testng", "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", "library_version" : ${content_meta_library_version}, - "component" : "testng", "span.kind" : "test_suite_end", - "test.suite" : "org.example.TestFailedAndSucceed", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "testng", "test.framework_version" : ${content_meta_test_framework_version}, - "test.framework" : "testng" - } - } + "test.module" : "testng-7", + "test.source.file" : "dummy_source_path", + "test.status" : "fail", + "test.suite" : "org.example.TestFailedAndSucceed", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count}, + "test.source.end" : 19, + "test.source.start" : 11 + }, + "name" : "testng.test_suite", + "resource" : "org.example.TestFailedAndSucceed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id} + }, + "type" : "test_suite_end", + "version" : 1 }, { - "type" : "test", - "version" : 2, "content" : { - "trace_id" : ${content_trace_id}, - "span_id" : ${content_span_id}, - "parent_id" : ${content_parent_id}, - "test_session_id" : ${content_test_session_id}, - "test_module_id" : ${content_test_module_id}, - "test_suite_id" : ${content_test_suite_id}, - "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", - "name" : "testng.test", - "resource" : "org.example.TestFailedAndSucceed.test_another_succeed", - "start" : ${content_start_2}, "duration" : ${content_duration_2}, "error" : 1, - "metrics" : { - "process_id" : ${content_metrics_process_id}, - "_dd.profiling.enabled" : 0, - "_dd.trace_span_attribute_schema" : 0, - "test.source.end" : 18, - "test.source.start" : 12 - }, "meta" : { + "_dd.profiling.ctx" : "test", "_dd.tracer_host" : ${content_meta__dd_tracer_host}, - "test.source.file" : "dummy_source_path", - "test.source.method" : "test_another_succeed()V", - "test.module" : "testng-7", - "test.status" : "fail", + "component" : "testng", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", "language" : "jvm", - "test.is_new" : "true", - "test.codeowners" : "[\"owner1\",\"owner2\"]", "library_version" : ${content_meta_library_version}, - "test.name" : "test_another_succeed", + "runtime-id" : ${content_meta_runtime_id}, "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "testng", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.is_new" : "true", + "test.module" : "testng-7", + "test.name" : "test_another_succeed", + "test.source.file" : "dummy_source_path", + "test.source.method" : "test_another_succeed()V", + "test.status" : "fail", "test.suite" : "org.example.TestFailedAndSucceed", - "runtime-id" : ${content_meta_runtime_id}, "test.type" : "test", - "test_session.name" : "session-name", - "env" : "none", - "dummy_ci_tag" : "dummy_ci_tag_value", - "component" : "testng", - "_dd.profiling.ctx" : "test", - "test.framework_version" : ${content_meta_test_framework_version}, - "test.framework" : "testng" - } - } -}, { - "type" : "test", - "version" : 2, - "content" : { - "trace_id" : ${content_trace_id_2}, - "span_id" : ${content_span_id_2}, - "parent_id" : ${content_parent_id}, - "test_session_id" : ${content_test_session_id}, - "test_module_id" : ${content_test_module_id}, - "test_suite_id" : ${content_test_suite_id}, - "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", - "name" : "testng.test", - "resource" : "org.example.TestFailedAndSucceed.test_another_succeed", - "start" : ${content_start_3}, - "duration" : ${content_duration_3}, - "error" : 1, + "test_session.name" : "session-name" + }, "metrics" : { - "process_id" : ${content_metrics_process_id}, + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_2}, "_dd.profiling.enabled" : 0, "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id}, "test.source.end" : 18, "test.source.start" : 12 }, + "name" : "testng.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestFailedAndSucceed.test_another_succeed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id}, + "start" : ${content_start_2}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_3}, + "error" : 1, "meta" : { + "_dd.profiling.ctx" : "test", "_dd.tracer_host" : ${content_meta__dd_tracer_host}, - "test.source.file" : "dummy_source_path", - "test.source.method" : "test_another_succeed()V", - "test.module" : "testng-7", - "test.status" : "fail", + "component" : "testng", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", "language" : "jvm", - "test.is_new" : "true", - "test.codeowners" : "[\"owner1\",\"owner2\"]", "library_version" : ${content_meta_library_version}, - "test.name" : "test_another_succeed", + "runtime-id" : ${content_meta_runtime_id}, "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "testng", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.is_new" : "true", + "test.is_retry" : "true", + "test.module" : "testng-7", + "test.name" : "test_another_succeed", + "test.retry_reason" : "efd", + "test.source.file" : "dummy_source_path", + "test.source.method" : "test_another_succeed()V", + "test.status" : "fail", "test.suite" : "org.example.TestFailedAndSucceed", - "runtime-id" : ${content_meta_runtime_id}, "test.type" : "test", - "test_session.name" : "session-name", - "env" : "none", - "dummy_ci_tag" : "dummy_ci_tag_value", - "test.is_retry" : "true", - "component" : "testng", - "_dd.profiling.ctx" : "test", - "test.framework_version" : ${content_meta_test_framework_version}, - "test.framework" : "testng" - } - } -}, { - "type" : "test", - "version" : 2, - "content" : { - "trace_id" : ${content_trace_id_3}, - "span_id" : ${content_span_id_3}, - "parent_id" : ${content_parent_id}, - "test_session_id" : ${content_test_session_id}, - "test_module_id" : ${content_test_module_id}, - "test_suite_id" : ${content_test_suite_id}, - "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", - "name" : "testng.test", - "resource" : "org.example.TestFailedAndSucceed.test_another_succeed", - "start" : ${content_start_4}, - "duration" : ${content_duration_4}, - "error" : 0, + "test_session.name" : "session-name" + }, "metrics" : { - "process_id" : ${content_metrics_process_id}, + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_3}, "_dd.profiling.enabled" : 0, "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id}, "test.source.end" : 18, "test.source.start" : 12 }, + "name" : "testng.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestFailedAndSucceed.test_another_succeed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id_2}, + "start" : ${content_start_3}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id_2} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_4}, + "error" : 0, "meta" : { + "_dd.profiling.ctx" : "test", "_dd.tracer_host" : ${content_meta__dd_tracer_host}, - "test.source.file" : "dummy_source_path", - "test.source.method" : "test_another_succeed()V", - "test.module" : "testng-7", - "test.status" : "pass", + "component" : "testng", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", "language" : "jvm", - "test.is_new" : "true", - "test.codeowners" : "[\"owner1\",\"owner2\"]", "library_version" : ${content_meta_library_version}, - "test.name" : "test_another_succeed", + "runtime-id" : ${content_meta_runtime_id}, "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "testng", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.is_new" : "true", + "test.is_retry" : "true", + "test.module" : "testng-7", + "test.name" : "test_another_succeed", + "test.retry_reason" : "efd", + "test.source.file" : "dummy_source_path", + "test.source.method" : "test_another_succeed()V", + "test.status" : "pass", "test.suite" : "org.example.TestFailedAndSucceed", - "runtime-id" : ${content_meta_runtime_id}, "test.type" : "test", - "test_session.name" : "session-name", - "env" : "none", - "dummy_ci_tag" : "dummy_ci_tag_value", - "test.is_retry" : "true", - "component" : "testng", - "_dd.profiling.ctx" : "test", - "test.framework_version" : ${content_meta_test_framework_version}, - "test.framework" : "testng" - } - } -}, { - "type" : "test", - "version" : 2, - "content" : { - "trace_id" : ${content_trace_id_4}, - "span_id" : ${content_span_id_4}, - "parent_id" : ${content_parent_id}, - "test_session_id" : ${content_test_session_id}, - "test_module_id" : ${content_test_module_id}, - "test_suite_id" : ${content_test_suite_id}, - "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", - "name" : "testng.test", - "resource" : "org.example.TestFailedAndSucceed.test_failed", - "start" : ${content_start_5}, - "duration" : ${content_duration_5}, - "error" : 1, + "test_session.name" : "session-name" + }, "metrics" : { - "process_id" : ${content_metrics_process_id}, + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_4}, "_dd.profiling.enabled" : 0, "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id}, "test.source.end" : 18, "test.source.start" : 12 }, + "name" : "testng.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestFailedAndSucceed.test_another_succeed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id_3}, + "start" : ${content_start_4}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id_3} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_5}, + "error" : 1, "meta" : { + "_dd.profiling.ctx" : "test", "_dd.tracer_host" : ${content_meta__dd_tracer_host}, - "test.source.file" : "dummy_source_path", - "test.source.method" : "test_failed()V", - "test.module" : "testng-7", - "test.status" : "fail", + "component" : "testng", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack}, + "error.type" : "java.lang.AssertionError", "language" : "jvm", - "test.codeowners" : "[\"owner1\",\"owner2\"]", "library_version" : ${content_meta_library_version}, - "test.name" : "test_failed", + "runtime-id" : ${content_meta_runtime_id}, "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "testng", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "testng-7", + "test.name" : "test_failed", + "test.source.file" : "dummy_source_path", + "test.source.method" : "test_failed()V", + "test.status" : "fail", "test.suite" : "org.example.TestFailedAndSucceed", - "runtime-id" : ${content_meta_runtime_id}, "test.type" : "test", - "test_session.name" : "session-name", - "env" : "none", - "dummy_ci_tag" : "dummy_ci_tag_value", - "component" : "testng", - "error.type" : "java.lang.AssertionError", - "_dd.profiling.ctx" : "test", - "error.message" : ${content_meta_error_message}, - "error.stack" : ${content_meta_error_stack}, - "test.framework_version" : ${content_meta_test_framework_version}, - "test.framework" : "testng" - } - } -}, { - "type" : "test", - "version" : 2, - "content" : { - "trace_id" : ${content_trace_id_5}, - "span_id" : ${content_span_id_5}, - "parent_id" : ${content_parent_id}, - "test_session_id" : ${content_test_session_id}, - "test_module_id" : ${content_test_module_id}, - "test_suite_id" : ${content_test_suite_id}, - "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", - "name" : "testng.test", - "resource" : "org.example.TestFailedAndSucceed.test_succeed", - "start" : ${content_start_6}, - "duration" : ${content_duration_6}, - "error" : 0, + "test_session.name" : "session-name" + }, "metrics" : { - "process_id" : ${content_metrics_process_id}, + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_5}, "_dd.profiling.enabled" : 0, "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id}, "test.source.end" : 18, "test.source.start" : 12 }, + "name" : "testng.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestFailedAndSucceed.test_failed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id_4}, + "start" : ${content_start_5}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id_4} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_6}, + "error" : 0, "meta" : { + "_dd.profiling.ctx" : "test", "_dd.tracer_host" : ${content_meta__dd_tracer_host}, - "test.source.file" : "dummy_source_path", - "test.source.method" : "test_succeed()V", - "test.module" : "testng-7", - "test.status" : "pass", + "component" : "testng", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", "language" : "jvm", - "test.codeowners" : "[\"owner1\",\"owner2\"]", "library_version" : ${content_meta_library_version}, - "test.name" : "test_succeed", + "runtime-id" : ${content_meta_runtime_id}, "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "testng", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "testng-7", + "test.name" : "test_succeed", + "test.source.file" : "dummy_source_path", + "test.source.method" : "test_succeed()V", + "test.status" : "pass", "test.suite" : "org.example.TestFailedAndSucceed", - "runtime-id" : ${content_meta_runtime_id}, "test.type" : "test", - "test_session.name" : "session-name", - "env" : "none", - "dummy_ci_tag" : "dummy_ci_tag_value", - "component" : "testng", - "_dd.profiling.ctx" : "test", - "test.framework_version" : ${content_meta_test_framework_version}, - "test.framework" : "testng" - } - } + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_6}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id}, + "test.source.end" : 18, + "test.source.start" : 12 + }, + "name" : "testng.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestFailedAndSucceed.test_succeed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id_5}, + "start" : ${content_start_6}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id_5} + }, + "type" : "test", + "version" : 2 }, { - "type" : "test_session_end", - "version" : 1, "content" : { - "test_session_id" : ${content_test_session_id}, - "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", - "name" : "testng.test_session", - "resource" : "testng-7", - "start" : ${content_start_7}, "duration" : ${content_duration_7}, "error" : 0, - "metrics" : { - "process_id" : ${content_metrics_process_id}, - "_dd.profiling.enabled" : 0, - "_dd.trace_span_attribute_schema" : 0 - }, "meta" : { - "test.type" : "test", + "_dd.p.tid" : ${content_meta__dd_p_tid_2}, + "_dd.profiling.ctx" : "test", "_dd.tracer_host" : ${content_meta__dd_tracer_host}, - "test.status" : "fail", - "test.early_flake.enabled" : "true", - "test_session.name" : "session-name", - "language" : "jvm", - "env" : "none", + "component" : "testng", "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "language" : "jvm", "library_version" : ${content_meta_library_version}, - "component" : "testng", - "_dd.profiling.ctx" : "test", - "span.kind" : "test_session_end", "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test_session_end", "test.command" : "testng-7", + "test.early_flake.enabled" : "true", + "test.framework" : "testng", "test.framework_version" : ${content_meta_test_framework_version}, - "test.framework" : "testng" - } - } + "test.status" : "fail", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_7}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "testng.test_session", + "resource" : "testng-7", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_7}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_session_end", + "version" : 1 }, { - "type" : "test_module_end", - "version" : 1, "content" : { - "test_session_id" : ${content_test_session_id}, - "test_module_id" : ${content_test_module_id}, - "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", - "name" : "testng.test_module", - "resource" : "testng-7", - "start" : ${content_start_8}, "duration" : ${content_duration_8}, "error" : 0, - "metrics" : { }, "meta" : { - "test.type" : "test", - "test.module" : "testng-7", - "test.status" : "fail", - "test.early_flake.enabled" : "true", - "test_session.name" : "session-name", - "env" : "none", + "_dd.p.tid" : ${content_meta__dd_p_tid_3}, + "component" : "testng", "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", "library_version" : ${content_meta_library_version}, - "component" : "testng", "span.kind" : "test_module_end", + "test.early_flake.enabled" : "true", + "test.framework" : "testng", "test.framework_version" : ${content_meta_test_framework_version}, - "test.framework" : "testng" - } - } + "test.module" : "testng-7", + "test.status" : "fail", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_8} + }, + "name" : "testng.test_module", + "resource" : "testng-7", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_8}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_module_end", + "version" : 1 } ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-efd-new-parameterized-test/events.ftl b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-efd-new-parameterized-test/events.ftl index b9532c8d203..93a00c2b7eb 100644 --- a/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-efd-new-parameterized-test/events.ftl +++ b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-efd-new-parameterized-test/events.ftl @@ -1,388 +1,409 @@ [ { - "type" : "test_suite_end", - "version" : 1, "content" : { - "test_session_id" : ${content_test_session_id}, - "test_module_id" : ${content_test_module_id}, - "test_suite_id" : ${content_test_suite_id}, - "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", - "name" : "testng.test_suite", - "resource" : "org.example.TestParameterized", - "start" : ${content_start}, "duration" : ${content_duration}, "error" : 0, - "metrics" : { }, "meta" : { - "test.type" : "test", - "test.source.file" : "dummy_source_path", - "test.module" : "testng-7", - "test.status" : "fail", - "test_session.name" : "session-name", - "env" : "none", + "_dd.p.tid" : ${content_meta__dd_p_tid}, + "component" : "testng", "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", "library_version" : ${content_meta_library_version}, - "component" : "testng", "span.kind" : "test_suite_end", - "test.suite" : "org.example.TestParameterized", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "testng", "test.framework_version" : ${content_meta_test_framework_version}, - "test.framework" : "testng" - } - } + "test.module" : "testng-7", + "test.source.file" : "dummy_source_path", + "test.status" : "fail", + "test.suite" : "org.example.TestParameterized", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count}, + "test.source.end" : 19, + "test.source.start" : 11 + }, + "name" : "testng.test_suite", + "resource" : "org.example.TestParameterized", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id} + }, + "type" : "test_suite_end", + "version" : 1 }, { - "type" : "test", - "version" : 2, "content" : { - "trace_id" : ${content_trace_id}, - "span_id" : ${content_span_id}, - "parent_id" : ${content_parent_id}, - "test_session_id" : ${content_test_session_id}, - "test_module_id" : ${content_test_module_id}, - "test_suite_id" : ${content_test_suite_id}, - "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", - "name" : "testng.test", - "resource" : "org.example.TestParameterized.parameterized_test_succeed", - "start" : ${content_start_2}, "duration" : ${content_duration_2}, "error" : 1, - "metrics" : { - "process_id" : ${content_metrics_process_id}, - "_dd.profiling.enabled" : 0, - "_dd.trace_span_attribute_schema" : 0, - "test.source.end" : 18, - "test.source.start" : 12 - }, "meta" : { + "_dd.profiling.ctx" : "test", "_dd.tracer_host" : ${content_meta__dd_tracer_host}, - "test.source.file" : "dummy_source_path", - "test.source.method" : "parameterized_test_succeed(Ljava/lang/String;Z)V", - "test.module" : "testng-7", - "test.status" : "fail", + "component" : "testng", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", "language" : "jvm", - "test.is_new" : "true", - "test.codeowners" : "[\"owner1\",\"owner2\"]", "library_version" : ${content_meta_library_version}, - "test.name" : "parameterized_test_succeed", + "runtime-id" : ${content_meta_runtime_id}, "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "testng", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.is_new" : "true", + "test.module" : "testng-7", + "test.name" : "parameterized_test_succeed", + "test.parameters" : "{\"arguments\":{\"0\":\"hello\",\"1\":\"true\"}}", + "test.source.file" : "dummy_source_path", + "test.source.method" : "parameterized_test_succeed(Ljava/lang/String;Z)V", + "test.status" : "fail", "test.suite" : "org.example.TestParameterized", - "runtime-id" : ${content_meta_runtime_id}, "test.type" : "test", - "test_session.name" : "session-name", - "env" : "none", - "dummy_ci_tag" : "dummy_ci_tag_value", - "test.parameters" : "{\"arguments\":{\"0\":\"hello\",\"1\":\"true\"}}", - "component" : "testng", - "_dd.profiling.ctx" : "test", - "test.framework_version" : ${content_meta_test_framework_version}, - "test.framework" : "testng" - } - } -}, { - "type" : "test", - "version" : 2, - "content" : { - "trace_id" : ${content_trace_id_2}, - "span_id" : ${content_span_id_2}, - "parent_id" : ${content_parent_id}, - "test_session_id" : ${content_test_session_id}, - "test_module_id" : ${content_test_module_id}, - "test_suite_id" : ${content_test_suite_id}, - "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", - "name" : "testng.test", - "resource" : "org.example.TestParameterized.parameterized_test_succeed", - "start" : ${content_start_3}, - "duration" : ${content_duration_3}, - "error" : 1, + "test_session.name" : "session-name" + }, "metrics" : { - "process_id" : ${content_metrics_process_id}, + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_2}, "_dd.profiling.enabled" : 0, "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id}, "test.source.end" : 18, "test.source.start" : 12 }, + "name" : "testng.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestParameterized.parameterized_test_succeed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id}, + "start" : ${content_start_2}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_3}, + "error" : 1, "meta" : { + "_dd.profiling.ctx" : "test", "_dd.tracer_host" : ${content_meta__dd_tracer_host}, - "test.source.file" : "dummy_source_path", - "test.source.method" : "parameterized_test_succeed(Ljava/lang/String;Z)V", - "test.module" : "testng-7", - "test.status" : "fail", + "component" : "testng", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", "language" : "jvm", - "test.is_new" : "true", - "test.codeowners" : "[\"owner1\",\"owner2\"]", "library_version" : ${content_meta_library_version}, - "test.name" : "parameterized_test_succeed", - "span.kind" : "test", - "test.suite" : "org.example.TestParameterized", "runtime-id" : ${content_meta_runtime_id}, - "test.type" : "test", - "test_session.name" : "session-name", - "env" : "none", - "dummy_ci_tag" : "dummy_ci_tag_value", + "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "testng", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.is_new" : "true", "test.is_retry" : "true", + "test.module" : "testng-7", + "test.name" : "parameterized_test_succeed", "test.parameters" : "{\"arguments\":{\"0\":\"hello\",\"1\":\"true\"}}", - "component" : "testng", - "_dd.profiling.ctx" : "test", - "test.framework_version" : ${content_meta_test_framework_version}, - "test.framework" : "testng" - } - } -}, { - "type" : "test", - "version" : 2, - "content" : { - "trace_id" : ${content_trace_id_3}, - "span_id" : ${content_span_id_3}, - "parent_id" : ${content_parent_id}, - "test_session_id" : ${content_test_session_id}, - "test_module_id" : ${content_test_module_id}, - "test_suite_id" : ${content_test_suite_id}, - "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", - "name" : "testng.test", - "resource" : "org.example.TestParameterized.parameterized_test_succeed", - "start" : ${content_start_4}, - "duration" : ${content_duration_4}, - "error" : 0, + "test.retry_reason" : "efd", + "test.source.file" : "dummy_source_path", + "test.source.method" : "parameterized_test_succeed(Ljava/lang/String;Z)V", + "test.status" : "fail", + "test.suite" : "org.example.TestParameterized", + "test.type" : "test", + "test_session.name" : "session-name" + }, "metrics" : { - "process_id" : ${content_metrics_process_id}, + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_3}, "_dd.profiling.enabled" : 0, "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id}, "test.source.end" : 18, "test.source.start" : 12 }, + "name" : "testng.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestParameterized.parameterized_test_succeed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id_2}, + "start" : ${content_start_3}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id_2} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_4}, + "error" : 0, "meta" : { + "_dd.profiling.ctx" : "test", "_dd.tracer_host" : ${content_meta__dd_tracer_host}, - "test.source.file" : "dummy_source_path", - "test.source.method" : "parameterized_test_succeed(Ljava/lang/String;Z)V", - "test.module" : "testng-7", - "test.status" : "pass", + "component" : "testng", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", "language" : "jvm", - "test.is_new" : "true", - "test.codeowners" : "[\"owner1\",\"owner2\"]", "library_version" : ${content_meta_library_version}, - "test.name" : "parameterized_test_succeed", - "span.kind" : "test", - "test.suite" : "org.example.TestParameterized", "runtime-id" : ${content_meta_runtime_id}, - "test.type" : "test", - "test_session.name" : "session-name", - "env" : "none", - "dummy_ci_tag" : "dummy_ci_tag_value", + "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "testng", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.is_new" : "true", "test.is_retry" : "true", + "test.module" : "testng-7", + "test.name" : "parameterized_test_succeed", "test.parameters" : "{\"arguments\":{\"0\":\"hello\",\"1\":\"true\"}}", - "component" : "testng", - "_dd.profiling.ctx" : "test", - "test.framework_version" : ${content_meta_test_framework_version}, - "test.framework" : "testng" - } - } -}, { - "type" : "test", - "version" : 2, - "content" : { - "trace_id" : ${content_trace_id_4}, - "span_id" : ${content_span_id_4}, - "parent_id" : ${content_parent_id}, - "test_session_id" : ${content_test_session_id}, - "test_module_id" : ${content_test_module_id}, - "test_suite_id" : ${content_test_suite_id}, - "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", - "name" : "testng.test", - "resource" : "org.example.TestParameterized.parameterized_test_succeed", - "start" : ${content_start_5}, - "duration" : ${content_duration_5}, - "error" : 1, + "test.retry_reason" : "efd", + "test.source.file" : "dummy_source_path", + "test.source.method" : "parameterized_test_succeed(Ljava/lang/String;Z)V", + "test.status" : "pass", + "test.suite" : "org.example.TestParameterized", + "test.type" : "test", + "test_session.name" : "session-name" + }, "metrics" : { - "process_id" : ${content_metrics_process_id}, + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_4}, "_dd.profiling.enabled" : 0, "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id}, "test.source.end" : 18, "test.source.start" : 12 }, + "name" : "testng.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestParameterized.parameterized_test_succeed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id_3}, + "start" : ${content_start_4}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id_3} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_5}, + "error" : 1, "meta" : { + "_dd.profiling.ctx" : "test", "_dd.tracer_host" : ${content_meta__dd_tracer_host}, - "test.source.file" : "dummy_source_path", - "test.source.method" : "parameterized_test_succeed(Ljava/lang/String;Z)V", - "test.module" : "testng-7", - "test.status" : "fail", + "component" : "testng", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", "language" : "jvm", - "test.is_new" : "true", - "test.codeowners" : "[\"owner1\",\"owner2\"]", "library_version" : ${content_meta_library_version}, - "test.name" : "parameterized_test_succeed", + "runtime-id" : ${content_meta_runtime_id}, "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "testng", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.is_new" : "true", + "test.module" : "testng-7", + "test.name" : "parameterized_test_succeed", + "test.parameters" : "{\"arguments\":{\"0\":\"\\\"goodbye\\\"\",\"1\":\"false\"}}", + "test.source.file" : "dummy_source_path", + "test.source.method" : "parameterized_test_succeed(Ljava/lang/String;Z)V", + "test.status" : "fail", "test.suite" : "org.example.TestParameterized", - "runtime-id" : ${content_meta_runtime_id}, "test.type" : "test", - "test_session.name" : "session-name", - "env" : "none", - "dummy_ci_tag" : "dummy_ci_tag_value", - "test.parameters" : "{\"arguments\":{\"0\":\"\\\"goodbye\\\"\",\"1\":\"false\"}}", - "component" : "testng", - "_dd.profiling.ctx" : "test", - "test.framework_version" : ${content_meta_test_framework_version}, - "test.framework" : "testng" - } - } -}, { - "type" : "test", - "version" : 2, - "content" : { - "trace_id" : ${content_trace_id_5}, - "span_id" : ${content_span_id_5}, - "parent_id" : ${content_parent_id}, - "test_session_id" : ${content_test_session_id}, - "test_module_id" : ${content_test_module_id}, - "test_suite_id" : ${content_test_suite_id}, - "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", - "name" : "testng.test", - "resource" : "org.example.TestParameterized.parameterized_test_succeed", - "start" : ${content_start_6}, - "duration" : ${content_duration_6}, - "error" : 1, + "test_session.name" : "session-name" + }, "metrics" : { - "process_id" : ${content_metrics_process_id}, + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_5}, "_dd.profiling.enabled" : 0, "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id}, "test.source.end" : 18, "test.source.start" : 12 }, + "name" : "testng.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestParameterized.parameterized_test_succeed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id_4}, + "start" : ${content_start_5}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id_4} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_6}, + "error" : 1, "meta" : { + "_dd.profiling.ctx" : "test", "_dd.tracer_host" : ${content_meta__dd_tracer_host}, - "test.source.file" : "dummy_source_path", - "test.source.method" : "parameterized_test_succeed(Ljava/lang/String;Z)V", - "test.module" : "testng-7", - "test.status" : "fail", + "component" : "testng", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", "language" : "jvm", - "test.is_new" : "true", - "test.codeowners" : "[\"owner1\",\"owner2\"]", "library_version" : ${content_meta_library_version}, - "test.name" : "parameterized_test_succeed", - "span.kind" : "test", - "test.suite" : "org.example.TestParameterized", "runtime-id" : ${content_meta_runtime_id}, - "test.type" : "test", - "test_session.name" : "session-name", - "env" : "none", - "dummy_ci_tag" : "dummy_ci_tag_value", + "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "testng", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.is_new" : "true", "test.is_retry" : "true", + "test.module" : "testng-7", + "test.name" : "parameterized_test_succeed", "test.parameters" : "{\"arguments\":{\"0\":\"\\\"goodbye\\\"\",\"1\":\"false\"}}", - "component" : "testng", - "_dd.profiling.ctx" : "test", - "test.framework_version" : ${content_meta_test_framework_version}, - "test.framework" : "testng" - } - } -}, { - "type" : "test", - "version" : 2, - "content" : { - "trace_id" : ${content_trace_id_6}, - "span_id" : ${content_span_id_6}, - "parent_id" : ${content_parent_id}, - "test_session_id" : ${content_test_session_id}, - "test_module_id" : ${content_test_module_id}, - "test_suite_id" : ${content_test_suite_id}, - "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", - "name" : "testng.test", - "resource" : "org.example.TestParameterized.parameterized_test_succeed", - "start" : ${content_start_7}, - "duration" : ${content_duration_7}, - "error" : 0, + "test.retry_reason" : "efd", + "test.source.file" : "dummy_source_path", + "test.source.method" : "parameterized_test_succeed(Ljava/lang/String;Z)V", + "test.status" : "fail", + "test.suite" : "org.example.TestParameterized", + "test.type" : "test", + "test_session.name" : "session-name" + }, "metrics" : { - "process_id" : ${content_metrics_process_id}, + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_6}, "_dd.profiling.enabled" : 0, "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id}, "test.source.end" : 18, "test.source.start" : 12 }, + "name" : "testng.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestParameterized.parameterized_test_succeed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id_5}, + "start" : ${content_start_6}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id_5} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_7}, + "error" : 0, "meta" : { + "_dd.profiling.ctx" : "test", "_dd.tracer_host" : ${content_meta__dd_tracer_host}, - "test.source.file" : "dummy_source_path", - "test.source.method" : "parameterized_test_succeed(Ljava/lang/String;Z)V", - "test.module" : "testng-7", - "test.status" : "pass", + "component" : "testng", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", "language" : "jvm", - "test.is_new" : "true", - "test.codeowners" : "[\"owner1\",\"owner2\"]", "library_version" : ${content_meta_library_version}, - "test.name" : "parameterized_test_succeed", - "span.kind" : "test", - "test.suite" : "org.example.TestParameterized", "runtime-id" : ${content_meta_runtime_id}, - "test.type" : "test", - "test_session.name" : "session-name", - "env" : "none", - "dummy_ci_tag" : "dummy_ci_tag_value", + "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "testng", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.is_new" : "true", "test.is_retry" : "true", + "test.module" : "testng-7", + "test.name" : "parameterized_test_succeed", "test.parameters" : "{\"arguments\":{\"0\":\"\\\"goodbye\\\"\",\"1\":\"false\"}}", - "component" : "testng", - "_dd.profiling.ctx" : "test", - "test.framework_version" : ${content_meta_test_framework_version}, - "test.framework" : "testng" - } - } + "test.retry_reason" : "efd", + "test.source.file" : "dummy_source_path", + "test.source.method" : "parameterized_test_succeed(Ljava/lang/String;Z)V", + "test.status" : "pass", + "test.suite" : "org.example.TestParameterized", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_7}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id}, + "test.source.end" : 18, + "test.source.start" : 12 + }, + "name" : "testng.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestParameterized.parameterized_test_succeed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id_6}, + "start" : ${content_start_7}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id_6} + }, + "type" : "test", + "version" : 2 }, { - "type" : "test_session_end", - "version" : 1, "content" : { - "test_session_id" : ${content_test_session_id}, - "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", - "name" : "testng.test_session", - "resource" : "testng-7", - "start" : ${content_start_8}, "duration" : ${content_duration_8}, "error" : 0, - "metrics" : { - "process_id" : ${content_metrics_process_id}, - "_dd.profiling.enabled" : 0, - "_dd.trace_span_attribute_schema" : 0 - }, "meta" : { - "test.type" : "test", + "_dd.p.tid" : ${content_meta__dd_p_tid_2}, + "_dd.profiling.ctx" : "test", "_dd.tracer_host" : ${content_meta__dd_tracer_host}, - "test.status" : "fail", - "test.early_flake.enabled" : "true", - "test_session.name" : "session-name", - "language" : "jvm", - "test.early_flake.abort_reason" : "faulty", - "env" : "none", + "component" : "testng", "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "language" : "jvm", "library_version" : ${content_meta_library_version}, - "component" : "testng", - "_dd.profiling.ctx" : "test", - "span.kind" : "test_session_end", "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test_session_end", "test.command" : "testng-7", + "test.early_flake.abort_reason" : "faulty", + "test.early_flake.enabled" : "true", + "test.framework" : "testng", "test.framework_version" : ${content_meta_test_framework_version}, - "test.framework" : "testng" - } - } + "test.status" : "fail", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_8}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "testng.test_session", + "resource" : "testng-7", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_8}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_session_end", + "version" : 1 }, { - "type" : "test_module_end", - "version" : 1, "content" : { - "test_session_id" : ${content_test_session_id}, - "test_module_id" : ${content_test_module_id}, - "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", - "name" : "testng.test_module", - "resource" : "testng-7", - "start" : ${content_start_9}, "duration" : ${content_duration_9}, "error" : 0, - "metrics" : { }, "meta" : { - "test.type" : "test", - "test.module" : "testng-7", - "test.status" : "fail", - "test.early_flake.enabled" : "true", - "test_session.name" : "session-name", - "test.early_flake.abort_reason" : "faulty", - "env" : "none", + "_dd.p.tid" : ${content_meta__dd_p_tid_3}, + "component" : "testng", "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", "library_version" : ${content_meta_library_version}, - "component" : "testng", "span.kind" : "test_module_end", + "test.early_flake.abort_reason" : "faulty", + "test.early_flake.enabled" : "true", + "test.framework" : "testng", "test.framework_version" : ${content_meta_test_framework_version}, - "test.framework" : "testng" - } - } + "test.module" : "testng-7", + "test.status" : "fail", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_9} + }, + "name" : "testng.test_module", + "resource" : "testng-7", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_9}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_module_end", + "version" : 1 } ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-efd-new-slow-test/events.ftl b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-efd-new-slow-test/events.ftl index 54f3e3fe25b..6479410e80c 100644 --- a/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-efd-new-slow-test/events.ftl +++ b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-efd-new-slow-test/events.ftl @@ -1,189 +1,203 @@ [ { - "type" : "test_suite_end", - "version" : 1, "content" : { - "test_session_id" : ${content_test_session_id}, - "test_module_id" : ${content_test_module_id}, - "test_suite_id" : ${content_test_suite_id}, - "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", - "name" : "testng.test_suite", - "resource" : "org.example.TestSucceedSlow", - "start" : ${content_start}, "duration" : ${content_duration}, "error" : 0, - "metrics" : { }, "meta" : { - "test.type" : "test", - "test.source.file" : "dummy_source_path", - "test.module" : "testng-7", - "test.status" : "fail", - "test_session.name" : "session-name", - "env" : "none", + "_dd.p.tid" : ${content_meta__dd_p_tid}, + "component" : "testng", "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", "library_version" : ${content_meta_library_version}, - "component" : "testng", "span.kind" : "test_suite_end", - "test.suite" : "org.example.TestSucceedSlow", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "testng", "test.framework_version" : ${content_meta_test_framework_version}, - "test.framework" : "testng" - } - } + "test.module" : "testng-7", + "test.source.file" : "dummy_source_path", + "test.status" : "fail", + "test.suite" : "org.example.TestSucceedSlow", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count}, + "test.source.end" : 19, + "test.source.start" : 11 + }, + "name" : "testng.test_suite", + "resource" : "org.example.TestSucceedSlow", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id} + }, + "type" : "test_suite_end", + "version" : 1 }, { - "type" : "test", - "version" : 2, "content" : { - "trace_id" : ${content_trace_id}, - "span_id" : ${content_span_id}, - "parent_id" : ${content_parent_id}, - "test_session_id" : ${content_test_session_id}, - "test_module_id" : ${content_test_module_id}, - "test_suite_id" : ${content_test_suite_id}, - "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", - "name" : "testng.test", - "resource" : "org.example.TestSucceedSlow.test_succeed", - "start" : ${content_start_2}, "duration" : ${content_duration_2}, "error" : 1, - "metrics" : { - "process_id" : ${content_metrics_process_id}, - "_dd.profiling.enabled" : 0, - "_dd.trace_span_attribute_schema" : 0, - "test.source.end" : 18, - "test.source.start" : 12 - }, "meta" : { + "_dd.profiling.ctx" : "test", "_dd.tracer_host" : ${content_meta__dd_tracer_host}, - "test.source.file" : "dummy_source_path", - "test.source.method" : "test_succeed()V", - "test.module" : "testng-7", - "test.status" : "fail", + "component" : "testng", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", "language" : "jvm", - "test.is_new" : "true", - "test.codeowners" : "[\"owner1\",\"owner2\"]", "library_version" : ${content_meta_library_version}, - "test.name" : "test_succeed", + "runtime-id" : ${content_meta_runtime_id}, "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "testng", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.is_new" : "true", + "test.module" : "testng-7", + "test.name" : "test_succeed", + "test.source.file" : "dummy_source_path", + "test.source.method" : "test_succeed()V", + "test.status" : "fail", "test.suite" : "org.example.TestSucceedSlow", - "runtime-id" : ${content_meta_runtime_id}, "test.type" : "test", - "test_session.name" : "session-name", - "env" : "none", - "dummy_ci_tag" : "dummy_ci_tag_value", - "component" : "testng", - "_dd.profiling.ctx" : "test", - "test.framework_version" : ${content_meta_test_framework_version}, - "test.framework" : "testng" - } - } -}, { - "type" : "test", - "version" : 2, - "content" : { - "trace_id" : ${content_trace_id_2}, - "span_id" : ${content_span_id_2}, - "parent_id" : ${content_parent_id}, - "test_session_id" : ${content_test_session_id}, - "test_module_id" : ${content_test_module_id}, - "test_suite_id" : ${content_test_suite_id}, - "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", - "name" : "testng.test", - "resource" : "org.example.TestSucceedSlow.test_succeed", - "start" : ${content_start_3}, - "duration" : ${content_duration_3}, - "error" : 0, + "test_session.name" : "session-name" + }, "metrics" : { - "process_id" : ${content_metrics_process_id}, + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_2}, "_dd.profiling.enabled" : 0, "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id}, "test.source.end" : 18, "test.source.start" : 12 }, + "name" : "testng.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestSucceedSlow.test_succeed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id}, + "start" : ${content_start_2}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_3}, + "error" : 0, "meta" : { + "_dd.profiling.ctx" : "test", "_dd.tracer_host" : ${content_meta__dd_tracer_host}, - "test.source.file" : "dummy_source_path", - "test.source.method" : "test_succeed()V", - "test.module" : "testng-7", - "test.status" : "pass", + "component" : "testng", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", "language" : "jvm", - "test.is_new" : "true", - "test.codeowners" : "[\"owner1\",\"owner2\"]", "library_version" : ${content_meta_library_version}, - "test.name" : "test_succeed", + "runtime-id" : ${content_meta_runtime_id}, "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "testng", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.is_new" : "true", + "test.is_retry" : "true", + "test.module" : "testng-7", + "test.name" : "test_succeed", + "test.retry_reason" : "efd", + "test.source.file" : "dummy_source_path", + "test.source.method" : "test_succeed()V", + "test.status" : "pass", "test.suite" : "org.example.TestSucceedSlow", - "runtime-id" : ${content_meta_runtime_id}, "test.type" : "test", - "test_session.name" : "session-name", - "env" : "none", - "dummy_ci_tag" : "dummy_ci_tag_value", - "test.is_retry" : "true", - "component" : "testng", - "_dd.profiling.ctx" : "test", - "test.framework_version" : ${content_meta_test_framework_version}, - "test.framework" : "testng" - } - } + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_3}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id}, + "test.source.end" : 18, + "test.source.start" : 12 + }, + "name" : "testng.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestSucceedSlow.test_succeed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id_2}, + "start" : ${content_start_3}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id_2} + }, + "type" : "test", + "version" : 2 }, { - "type" : "test_session_end", - "version" : 1, "content" : { - "test_session_id" : ${content_test_session_id}, - "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", - "name" : "testng.test_session", - "resource" : "testng-7", - "start" : ${content_start_4}, "duration" : ${content_duration_4}, "error" : 0, - "metrics" : { - "process_id" : ${content_metrics_process_id}, - "_dd.profiling.enabled" : 0, - "_dd.trace_span_attribute_schema" : 0 - }, "meta" : { - "test.type" : "test", + "_dd.p.tid" : ${content_meta__dd_p_tid_2}, + "_dd.profiling.ctx" : "test", "_dd.tracer_host" : ${content_meta__dd_tracer_host}, - "test.status" : "fail", - "test.early_flake.enabled" : "true", - "test_session.name" : "session-name", - "language" : "jvm", - "env" : "none", + "component" : "testng", "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "language" : "jvm", "library_version" : ${content_meta_library_version}, - "component" : "testng", - "_dd.profiling.ctx" : "test", - "span.kind" : "test_session_end", "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test_session_end", "test.command" : "testng-7", + "test.early_flake.enabled" : "true", + "test.framework" : "testng", "test.framework_version" : ${content_meta_test_framework_version}, - "test.framework" : "testng" - } - } + "test.status" : "fail", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_4}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "testng.test_session", + "resource" : "testng-7", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_4}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_session_end", + "version" : 1 }, { - "type" : "test_module_end", - "version" : 1, "content" : { - "test_session_id" : ${content_test_session_id}, - "test_module_id" : ${content_test_module_id}, - "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", - "name" : "testng.test_module", - "resource" : "testng-7", - "start" : ${content_start_5}, "duration" : ${content_duration_5}, "error" : 0, - "metrics" : { }, "meta" : { - "test.type" : "test", - "test.module" : "testng-7", - "test.status" : "fail", - "test.early_flake.enabled" : "true", - "test_session.name" : "session-name", - "env" : "none", + "_dd.p.tid" : ${content_meta__dd_p_tid_3}, + "component" : "testng", "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", "library_version" : ${content_meta_library_version}, - "component" : "testng", "span.kind" : "test_module_end", + "test.early_flake.enabled" : "true", + "test.framework" : "testng", "test.framework_version" : ${content_meta_test_framework_version}, - "test.framework" : "testng" - } - } + "test.module" : "testng-7", + "test.status" : "fail", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_5} + }, + "name" : "testng.test_module", + "resource" : "testng-7", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_5}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_module_end", + "version" : 1 } ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-efd-new-test/events.ftl b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-efd-new-test/events.ftl index 6a6b8e4c19c..78c84bafc26 100644 --- a/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-efd-new-test/events.ftl +++ b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-efd-new-test/events.ftl @@ -1,237 +1,253 @@ [ { - "type" : "test_suite_end", - "version" : 1, "content" : { - "test_session_id" : ${content_test_session_id}, - "test_module_id" : ${content_test_module_id}, - "test_suite_id" : ${content_test_suite_id}, - "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", - "name" : "testng.test_suite", - "resource" : "org.example.TestSucceed", - "start" : ${content_start}, "duration" : ${content_duration}, "error" : 0, - "metrics" : { }, "meta" : { - "test.type" : "test", - "test.source.file" : "dummy_source_path", - "test.module" : "testng-7", - "test.status" : "fail", - "test_session.name" : "session-name", - "env" : "none", + "_dd.p.tid" : ${content_meta__dd_p_tid}, + "component" : "testng", "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", "library_version" : ${content_meta_library_version}, - "component" : "testng", "span.kind" : "test_suite_end", - "test.suite" : "org.example.TestSucceed", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "testng", "test.framework_version" : ${content_meta_test_framework_version}, - "test.framework" : "testng" - } - } + "test.module" : "testng-7", + "test.source.file" : "dummy_source_path", + "test.status" : "fail", + "test.suite" : "org.example.TestSucceed", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count}, + "test.source.end" : 19, + "test.source.start" : 11 + }, + "name" : "testng.test_suite", + "resource" : "org.example.TestSucceed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id} + }, + "type" : "test_suite_end", + "version" : 1 }, { - "type" : "test", - "version" : 2, "content" : { - "trace_id" : ${content_trace_id}, - "span_id" : ${content_span_id}, - "parent_id" : ${content_parent_id}, - "test_session_id" : ${content_test_session_id}, - "test_module_id" : ${content_test_module_id}, - "test_suite_id" : ${content_test_suite_id}, - "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", - "name" : "testng.test", - "resource" : "org.example.TestSucceed.test_succeed", - "start" : ${content_start_2}, "duration" : ${content_duration_2}, "error" : 1, - "metrics" : { - "process_id" : ${content_metrics_process_id}, - "_dd.profiling.enabled" : 0, - "_dd.trace_span_attribute_schema" : 0, - "test.source.end" : 18, - "test.source.start" : 12 - }, "meta" : { + "_dd.profiling.ctx" : "test", "_dd.tracer_host" : ${content_meta__dd_tracer_host}, - "test.source.file" : "dummy_source_path", - "test.source.method" : "test_succeed()V", - "test.module" : "testng-7", - "test.status" : "fail", + "component" : "testng", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", "language" : "jvm", - "test.is_new" : "true", - "test.codeowners" : "[\"owner1\",\"owner2\"]", "library_version" : ${content_meta_library_version}, - "test.name" : "test_succeed", + "runtime-id" : ${content_meta_runtime_id}, "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "testng", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.is_new" : "true", + "test.module" : "testng-7", + "test.name" : "test_succeed", + "test.source.file" : "dummy_source_path", + "test.source.method" : "test_succeed()V", + "test.status" : "fail", "test.suite" : "org.example.TestSucceed", - "runtime-id" : ${content_meta_runtime_id}, "test.type" : "test", - "test_session.name" : "session-name", - "env" : "none", - "dummy_ci_tag" : "dummy_ci_tag_value", - "component" : "testng", - "_dd.profiling.ctx" : "test", - "test.framework_version" : ${content_meta_test_framework_version}, - "test.framework" : "testng" - } - } -}, { - "type" : "test", - "version" : 2, - "content" : { - "trace_id" : ${content_trace_id_2}, - "span_id" : ${content_span_id_2}, - "parent_id" : ${content_parent_id}, - "test_session_id" : ${content_test_session_id}, - "test_module_id" : ${content_test_module_id}, - "test_suite_id" : ${content_test_suite_id}, - "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", - "name" : "testng.test", - "resource" : "org.example.TestSucceed.test_succeed", - "start" : ${content_start_3}, - "duration" : ${content_duration_3}, - "error" : 1, + "test_session.name" : "session-name" + }, "metrics" : { - "process_id" : ${content_metrics_process_id}, + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_2}, "_dd.profiling.enabled" : 0, "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id}, "test.source.end" : 18, "test.source.start" : 12 }, + "name" : "testng.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestSucceed.test_succeed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id}, + "start" : ${content_start_2}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_3}, + "error" : 1, "meta" : { + "_dd.profiling.ctx" : "test", "_dd.tracer_host" : ${content_meta__dd_tracer_host}, - "test.source.file" : "dummy_source_path", - "test.source.method" : "test_succeed()V", - "test.module" : "testng-7", - "test.status" : "fail", + "component" : "testng", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", "language" : "jvm", - "test.is_new" : "true", - "test.codeowners" : "[\"owner1\",\"owner2\"]", "library_version" : ${content_meta_library_version}, - "test.name" : "test_succeed", + "runtime-id" : ${content_meta_runtime_id}, "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "testng", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.is_new" : "true", + "test.is_retry" : "true", + "test.module" : "testng-7", + "test.name" : "test_succeed", + "test.retry_reason" : "efd", + "test.source.file" : "dummy_source_path", + "test.source.method" : "test_succeed()V", + "test.status" : "fail", "test.suite" : "org.example.TestSucceed", - "runtime-id" : ${content_meta_runtime_id}, "test.type" : "test", - "test_session.name" : "session-name", - "env" : "none", - "dummy_ci_tag" : "dummy_ci_tag_value", - "test.is_retry" : "true", - "component" : "testng", - "_dd.profiling.ctx" : "test", - "test.framework_version" : ${content_meta_test_framework_version}, - "test.framework" : "testng" - } - } -}, { - "type" : "test", - "version" : 2, - "content" : { - "trace_id" : ${content_trace_id_3}, - "span_id" : ${content_span_id_3}, - "parent_id" : ${content_parent_id}, - "test_session_id" : ${content_test_session_id}, - "test_module_id" : ${content_test_module_id}, - "test_suite_id" : ${content_test_suite_id}, - "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", - "name" : "testng.test", - "resource" : "org.example.TestSucceed.test_succeed", - "start" : ${content_start_4}, - "duration" : ${content_duration_4}, - "error" : 0, + "test_session.name" : "session-name" + }, "metrics" : { - "process_id" : ${content_metrics_process_id}, + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_3}, "_dd.profiling.enabled" : 0, "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id}, "test.source.end" : 18, "test.source.start" : 12 }, + "name" : "testng.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestSucceed.test_succeed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id_2}, + "start" : ${content_start_3}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id_2} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_4}, + "error" : 0, "meta" : { + "_dd.profiling.ctx" : "test", "_dd.tracer_host" : ${content_meta__dd_tracer_host}, - "test.source.file" : "dummy_source_path", - "test.source.method" : "test_succeed()V", - "test.module" : "testng-7", - "test.status" : "pass", + "component" : "testng", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", "language" : "jvm", - "test.is_new" : "true", - "test.codeowners" : "[\"owner1\",\"owner2\"]", "library_version" : ${content_meta_library_version}, - "test.name" : "test_succeed", + "runtime-id" : ${content_meta_runtime_id}, "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "testng", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.is_new" : "true", + "test.is_retry" : "true", + "test.module" : "testng-7", + "test.name" : "test_succeed", + "test.retry_reason" : "efd", + "test.source.file" : "dummy_source_path", + "test.source.method" : "test_succeed()V", + "test.status" : "pass", "test.suite" : "org.example.TestSucceed", - "runtime-id" : ${content_meta_runtime_id}, "test.type" : "test", - "test_session.name" : "session-name", - "env" : "none", - "dummy_ci_tag" : "dummy_ci_tag_value", - "test.is_retry" : "true", - "component" : "testng", - "_dd.profiling.ctx" : "test", - "test.framework_version" : ${content_meta_test_framework_version}, - "test.framework" : "testng" - } - } + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_4}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id}, + "test.source.end" : 18, + "test.source.start" : 12 + }, + "name" : "testng.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestSucceed.test_succeed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id_3}, + "start" : ${content_start_4}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id_3} + }, + "type" : "test", + "version" : 2 }, { - "type" : "test_session_end", - "version" : 1, "content" : { - "test_session_id" : ${content_test_session_id}, - "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", - "name" : "testng.test_session", - "resource" : "testng-7", - "start" : ${content_start_5}, "duration" : ${content_duration_5}, "error" : 0, - "metrics" : { - "process_id" : ${content_metrics_process_id}, - "_dd.profiling.enabled" : 0, - "_dd.trace_span_attribute_schema" : 0 - }, "meta" : { - "test.type" : "test", + "_dd.p.tid" : ${content_meta__dd_p_tid_2}, + "_dd.profiling.ctx" : "test", "_dd.tracer_host" : ${content_meta__dd_tracer_host}, - "test.status" : "fail", - "test.early_flake.enabled" : "true", - "test_session.name" : "session-name", - "language" : "jvm", - "env" : "none", + "component" : "testng", "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "language" : "jvm", "library_version" : ${content_meta_library_version}, - "component" : "testng", - "_dd.profiling.ctx" : "test", - "span.kind" : "test_session_end", "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test_session_end", "test.command" : "testng-7", + "test.early_flake.enabled" : "true", + "test.framework" : "testng", "test.framework_version" : ${content_meta_test_framework_version}, - "test.framework" : "testng" - } - } + "test.status" : "fail", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_5}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "testng.test_session", + "resource" : "testng-7", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_5}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_session_end", + "version" : 1 }, { - "type" : "test_module_end", - "version" : 1, "content" : { - "test_session_id" : ${content_test_session_id}, - "test_module_id" : ${content_test_module_id}, - "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", - "name" : "testng.test_module", - "resource" : "testng-7", - "start" : ${content_start_6}, "duration" : ${content_duration_6}, "error" : 0, - "metrics" : { }, "meta" : { - "test.type" : "test", - "test.module" : "testng-7", - "test.status" : "fail", - "test.early_flake.enabled" : "true", - "test_session.name" : "session-name", - "env" : "none", + "_dd.p.tid" : ${content_meta__dd_p_tid_3}, + "component" : "testng", "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", "library_version" : ${content_meta_library_version}, - "component" : "testng", "span.kind" : "test_module_end", + "test.early_flake.enabled" : "true", + "test.framework" : "testng", "test.framework_version" : ${content_meta_test_framework_version}, - "test.framework" : "testng" - } - } + "test.module" : "testng-7", + "test.status" : "fail", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_6} + }, + "name" : "testng.test_module", + "resource" : "testng-7", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_6}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_module_end", + "version" : 1 } ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-efd-new-very-slow-test/events.ftl b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-efd-new-very-slow-test/events.ftl index 84910662b61..e6460f40dd4 100644 --- a/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-efd-new-very-slow-test/events.ftl +++ b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-efd-new-very-slow-test/events.ftl @@ -1,141 +1,153 @@ [ { - "type" : "test_suite_end", - "version" : 1, "content" : { - "test_session_id" : ${content_test_session_id}, - "test_module_id" : ${content_test_module_id}, - "test_suite_id" : ${content_test_suite_id}, - "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", - "name" : "testng.test_suite", - "resource" : "org.example.TestSucceedVerySlow", - "start" : ${content_start}, "duration" : ${content_duration}, "error" : 0, - "metrics" : { }, "meta" : { - "test.type" : "test", - "test.source.file" : "dummy_source_path", - "test.module" : "testng-7", - "test.status" : "pass", - "test_session.name" : "session-name", - "env" : "none", + "_dd.p.tid" : ${content_meta__dd_p_tid}, + "component" : "testng", "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", "library_version" : ${content_meta_library_version}, - "component" : "testng", "span.kind" : "test_suite_end", - "test.suite" : "org.example.TestSucceedVerySlow", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "testng", "test.framework_version" : ${content_meta_test_framework_version}, - "test.framework" : "testng" - } - } + "test.module" : "testng-7", + "test.source.file" : "dummy_source_path", + "test.status" : "pass", + "test.suite" : "org.example.TestSucceedVerySlow", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count}, + "test.source.end" : 19, + "test.source.start" : 11 + }, + "name" : "testng.test_suite", + "resource" : "org.example.TestSucceedVerySlow", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id} + }, + "type" : "test_suite_end", + "version" : 1 }, { - "type" : "test", - "version" : 2, "content" : { - "trace_id" : ${content_trace_id}, - "span_id" : ${content_span_id}, - "parent_id" : ${content_parent_id}, - "test_session_id" : ${content_test_session_id}, - "test_module_id" : ${content_test_module_id}, - "test_suite_id" : ${content_test_suite_id}, - "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", - "name" : "testng.test", - "resource" : "org.example.TestSucceedVerySlow.test_succeed", - "start" : ${content_start_2}, "duration" : ${content_duration_2}, "error" : 0, - "metrics" : { - "process_id" : ${content_metrics_process_id}, - "_dd.profiling.enabled" : 0, - "_dd.trace_span_attribute_schema" : 0, - "test.source.end" : 18, - "test.source.start" : 12 - }, "meta" : { + "_dd.profiling.ctx" : "test", "_dd.tracer_host" : ${content_meta__dd_tracer_host}, - "test.source.file" : "dummy_source_path", - "test.source.method" : "test_succeed()V", - "test.module" : "testng-7", - "test.status" : "pass", + "component" : "testng", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", "language" : "jvm", - "test.is_new" : "true", - "test.codeowners" : "[\"owner1\",\"owner2\"]", "library_version" : ${content_meta_library_version}, - "test.name" : "test_succeed", + "runtime-id" : ${content_meta_runtime_id}, "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "testng", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.is_new" : "true", + "test.module" : "testng-7", + "test.name" : "test_succeed", + "test.source.file" : "dummy_source_path", + "test.source.method" : "test_succeed()V", + "test.status" : "pass", "test.suite" : "org.example.TestSucceedVerySlow", - "runtime-id" : ${content_meta_runtime_id}, "test.type" : "test", - "test_session.name" : "session-name", - "env" : "none", - "dummy_ci_tag" : "dummy_ci_tag_value", - "component" : "testng", - "_dd.profiling.ctx" : "test", - "test.framework_version" : ${content_meta_test_framework_version}, - "test.framework" : "testng" - } - } + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_2}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id}, + "test.source.end" : 18, + "test.source.start" : 12 + }, + "name" : "testng.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestSucceedVerySlow.test_succeed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id}, + "start" : ${content_start_2}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id} + }, + "type" : "test", + "version" : 2 }, { - "type" : "test_session_end", - "version" : 1, "content" : { - "test_session_id" : ${content_test_session_id}, - "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", - "name" : "testng.test_session", - "resource" : "testng-7", - "start" : ${content_start_3}, "duration" : ${content_duration_3}, "error" : 0, - "metrics" : { - "process_id" : ${content_metrics_process_id}, - "_dd.profiling.enabled" : 0, - "_dd.trace_span_attribute_schema" : 0 - }, "meta" : { - "test.type" : "test", + "_dd.p.tid" : ${content_meta__dd_p_tid_2}, + "_dd.profiling.ctx" : "test", "_dd.tracer_host" : ${content_meta__dd_tracer_host}, - "test.status" : "pass", - "test.early_flake.enabled" : "true", - "test_session.name" : "session-name", - "language" : "jvm", - "env" : "none", + "component" : "testng", "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "language" : "jvm", "library_version" : ${content_meta_library_version}, - "component" : "testng", - "_dd.profiling.ctx" : "test", - "span.kind" : "test_session_end", "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test_session_end", "test.command" : "testng-7", + "test.early_flake.enabled" : "true", + "test.framework" : "testng", "test.framework_version" : ${content_meta_test_framework_version}, - "test.framework" : "testng" - } - } + "test.status" : "pass", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_3}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "testng.test_session", + "resource" : "testng-7", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_3}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_session_end", + "version" : 1 }, { - "type" : "test_module_end", - "version" : 1, "content" : { - "test_session_id" : ${content_test_session_id}, - "test_module_id" : ${content_test_module_id}, - "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", - "name" : "testng.test_module", - "resource" : "testng-7", - "start" : ${content_start_4}, "duration" : ${content_duration_4}, "error" : 0, - "metrics" : { }, "meta" : { - "test.type" : "test", - "test.module" : "testng-7", - "test.status" : "pass", - "test.early_flake.enabled" : "true", - "test_session.name" : "session-name", - "env" : "none", + "_dd.p.tid" : ${content_meta__dd_p_tid_3}, + "component" : "testng", "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", "library_version" : ${content_meta_library_version}, - "component" : "testng", "span.kind" : "test_module_end", + "test.early_flake.enabled" : "true", + "test.framework" : "testng", "test.framework_version" : ${content_meta_test_framework_version}, - "test.framework" : "testng" - } - } + "test.module" : "testng-7", + "test.status" : "pass", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_4} + }, + "name" : "testng.test_module", + "resource" : "testng-7", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_4}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_module_end", + "version" : 1 } ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-7/events.ftl b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-7/events.ftl index 090f035a082..e4095851791 100644 --- a/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-7/events.ftl +++ b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-7/events.ftl @@ -54,6 +54,7 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "testng", "test.framework_version" : ${content_meta_test_framework_version}, + "test.management.is_quarantined" : "true", "test.module" : "testng-7", "test.name" : "test_failed", "test.source.file" : "dummy_source_path", @@ -150,4 +151,4 @@ }, "type" : "test_module_end", "version" : 1 -} ] \ No newline at end of file +} ] diff --git a/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-atr-7/events.ftl b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-atr-7/events.ftl index 94397e26158..fa67c4a2fca 100644 --- a/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-atr-7/events.ftl +++ b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-atr-7/events.ftl @@ -54,6 +54,7 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "testng", "test.framework_version" : ${content_meta_test_framework_version}, + "test.management.is_quarantined" : "true", "test.module" : "testng-7", "test.name" : "test_failed", "test.source.file" : "dummy_source_path", @@ -105,6 +106,7 @@ "test.framework" : "testng", "test.framework_version" : ${content_meta_test_framework_version}, "test.is_retry" : "true", + "test.management.is_quarantined" : "true", "test.module" : "testng-7", "test.name" : "test_failed", "test.retry_reason" : "atr", @@ -157,6 +159,7 @@ "test.framework" : "testng", "test.framework_version" : ${content_meta_test_framework_version}, "test.is_retry" : "true", + "test.management.is_quarantined" : "true", "test.module" : "testng-7", "test.name" : "test_failed", "test.retry_reason" : "atr", @@ -209,6 +212,7 @@ "test.framework" : "testng", "test.framework_version" : ${content_meta_test_framework_version}, "test.is_retry" : "true", + "test.management.is_quarantined" : "true", "test.module" : "testng-7", "test.name" : "test_failed", "test.retry_reason" : "atr", @@ -261,6 +265,7 @@ "test.framework" : "testng", "test.framework_version" : ${content_meta_test_framework_version}, "test.is_retry" : "true", + "test.management.is_quarantined" : "true", "test.module" : "testng-7", "test.name" : "test_failed", "test.retry_reason" : "atr", diff --git a/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-efd/events.ftl b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-efd/events.ftl index 993a1c17b0f..2c151bf7171 100644 --- a/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-efd/events.ftl +++ b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-efd/events.ftl @@ -55,6 +55,7 @@ "test.framework" : "testng", "test.framework_version" : ${content_meta_test_framework_version}, "test.is_new" : "true", + "test.management.is_quarantined" : "true", "test.module" : "testng-7", "test.name" : "test_failed", "test.source.file" : "dummy_source_path", @@ -107,6 +108,7 @@ "test.framework_version" : ${content_meta_test_framework_version}, "test.is_new" : "true", "test.is_retry" : "true", + "test.management.is_quarantined" : "true", "test.module" : "testng-7", "test.name" : "test_failed", "test.retry_reason" : "efd", @@ -160,6 +162,7 @@ "test.framework_version" : ${content_meta_test_framework_version}, "test.is_new" : "true", "test.is_retry" : "true", + "test.management.is_quarantined" : "true", "test.module" : "testng-7", "test.name" : "test_failed", "test.retry_reason" : "efd", diff --git a/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-parameterized/events.ftl b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-parameterized/events.ftl index fd3e510422b..25f435dc2fb 100644 --- a/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-parameterized/events.ftl +++ b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-parameterized/events.ftl @@ -51,6 +51,7 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "testng", "test.framework_version" : ${content_meta_test_framework_version}, + "test.management.is_quarantined" : "true", "test.module" : "testng-7", "test.name" : "parameterized_test_succeed", "test.parameters" : "{\"arguments\":{\"0\":\"hello\",\"1\":\"true\"}}", @@ -101,6 +102,7 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "testng", "test.framework_version" : ${content_meta_test_framework_version}, + "test.management.is_quarantined" : "true", "test.module" : "testng-7", "test.name" : "parameterized_test_succeed", "test.parameters" : "{\"arguments\":{\"0\":\"\\\"goodbye\\\"\",\"1\":\"false\"}}", From 9ec150b113a908e748df806440df364c2861b8bc Mon Sep 17 00:00:00 2001 From: Nikita Tkachenko Date: Mon, 3 Feb 2025 14:02:40 +0100 Subject: [PATCH 3/5] Has failed all retries tagging --- .../trace/civisibility/domain/TestImpl.java | 4 + .../events/NoOpTestEventsHandler.java | 7 +- .../events/TestEventsHandlerImpl.java | 34 ++++--- .../execution/RetryUntilSuccessful.java | 10 +- .../civisibility/execution/RunNTimes.java | 8 +- .../junit4/CucumberTracingListener.java | 15 ++- .../junit4/JUnit4CucumberInstrumentation.java | 6 +- .../Cucumber4ExecutionInstrumentation.java | 5 +- .../junit4/MUnitInstrumentation.java | 6 +- .../junit4/MUnitTracingListener.java | 19 ++-- .../MUnitExecutionInstrumentation.java | 5 +- .../junit4/JUnit4Instrumentation.java | 6 +- .../junit4/JUnit4TracingListener.java | 15 ++- .../JUnit4ExecutionInstrumentation.java | 5 +- .../junit5/CucumberTracingListener.java | 8 +- .../junit5/SpockTracingListener.java | 8 +- ...ParameterizedExecutionInstrumentation.java | 2 +- .../SpockParameterizedExecutionListener.java | 2 +- .../junit5/JUnitPlatformUtils.java | 12 --- .../junit5/TestEventsHandlerHolder.java | 25 +++++ .../junit5/TracingListener.java | 8 +- .../JUnit5ExecutionInstrumentation.java | 31 ++----- .../JUnit5ExecutionStoreInstrumentation.java | 91 +++++++++++++++++++ ...it5NodeTestTaskContextInstrumentation.java | 2 +- .../TestDescriptorHandle.java | 2 +- .../{retry => execution}/TestTaskHandle.java | 2 +- .../ThrowableCollectorFactoryWrapper.java | 2 +- .../KarateExecutionInstrumentation.java | 6 +- .../karate/KarateTracingHook.java | 12 +-- .../instrumentation/karate/KarateUtils.java | 4 +- .../scalatest/DatadogReporter.java | 29 ++++-- .../instrumentation/scalatest/RunContext.java | 5 +- .../ScalatestExecutionInstrumentation.java | 2 +- .../testng/TracingListener.java | 18 ++-- .../testng/execution/RetryAnalyzer.java | 3 +- .../weaver/DatadogWeaverReporter.java | 8 +- .../events/TestEventsHandler.java | 13 +-- .../execution/TestExecutionHistory.java | 20 ++++ .../execution/TestExecutionPolicy.java | 18 +--- 39 files changed, 293 insertions(+), 185 deletions(-) rename dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/main/java/datadog/trace/instrumentation/junit5/{retry => execution}/JUnit5SpockParameterizedExecutionInstrumentation.java (97%) rename dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/main/java/datadog/trace/instrumentation/junit5/{retry => execution}/SpockParameterizedExecutionListener.java (96%) rename dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/{retry => execution}/JUnit5ExecutionInstrumentation.java (89%) create mode 100644 dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/execution/JUnit5ExecutionStoreInstrumentation.java rename dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/{retry => execution}/JUnit5NodeTestTaskContextInstrumentation.java (97%) rename dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/{retry => execution}/TestDescriptorHandle.java (97%) rename dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/{retry => execution}/TestTaskHandle.java (99%) rename dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/{retry => execution}/ThrowableCollectorFactoryWrapper.java (95%) create mode 100644 internal-api/src/main/java/datadog/trace/api/civisibility/execution/TestExecutionHistory.java diff --git a/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/domain/TestImpl.java b/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/domain/TestImpl.java index be035b82528..aad4395aff6 100644 --- a/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/domain/TestImpl.java +++ b/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/domain/TestImpl.java @@ -192,6 +192,10 @@ public TestIdentifier getIdentifier() { return identifier; } + public boolean hasFailed() { + return span.isError(); + } + @Override public void setTag(String key, Object value) { span.setTag(key, value); diff --git a/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/events/NoOpTestEventsHandler.java b/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/events/NoOpTestEventsHandler.java index 70f3827923a..02bfe1aaca7 100644 --- a/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/events/NoOpTestEventsHandler.java +++ b/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/events/NoOpTestEventsHandler.java @@ -5,8 +5,8 @@ import datadog.trace.api.civisibility.config.TestIdentifier; import datadog.trace.api.civisibility.config.TestSourceData; import datadog.trace.api.civisibility.events.TestEventsHandler; +import datadog.trace.api.civisibility.execution.TestExecutionHistory; import datadog.trace.api.civisibility.execution.TestExecutionPolicy; -import datadog.trace.api.civisibility.telemetry.tag.RetryReason; import datadog.trace.api.civisibility.telemetry.tag.SkipReason; import datadog.trace.api.civisibility.telemetry.tag.TestFrameworkInstrumentation; import datadog.trace.bootstrap.ContextStore; @@ -58,8 +58,6 @@ public void onTestStart( @Nullable String testParameters, @Nullable Collection categories, @Nonnull TestSourceData testSourceData, - RetryReason retryReason, - boolean hasFailedAllRetries, @Nullable Long startTime) { // do nothing } @@ -75,7 +73,8 @@ public void onTestFailure(TestKey descriptor, @Nullable Throwable throwable) { } @Override - public void onTestFinish(TestKey descriptor, @Nullable Long endTime) { + public void onTestFinish( + TestKey descriptor, @Nullable Long endTime, @Nullable TestExecutionHistory executionHistory) { // do nothing } diff --git a/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/events/TestEventsHandlerImpl.java b/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/events/TestEventsHandlerImpl.java index de443756dea..553f172cb26 100644 --- a/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/events/TestEventsHandlerImpl.java +++ b/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/events/TestEventsHandlerImpl.java @@ -8,6 +8,7 @@ import datadog.trace.api.civisibility.config.TestIdentifier; import datadog.trace.api.civisibility.config.TestSourceData; import datadog.trace.api.civisibility.events.TestEventsHandler; +import datadog.trace.api.civisibility.execution.TestExecutionHistory; import datadog.trace.api.civisibility.execution.TestExecutionPolicy; import datadog.trace.api.civisibility.telemetry.CiVisibilityCountMetric; import datadog.trace.api.civisibility.telemetry.CiVisibilityMetricCollector; @@ -139,8 +140,6 @@ public void onTestStart( final @Nullable String testParameters, final @Nullable Collection categories, final @Nonnull TestSourceData testSourceData, - final @Nullable RetryReason retryReason, - final boolean hasFailedAllRetries, final @Nullable Long startTime) { if (skipTrace(testSourceData.getTestClass())) { return; @@ -171,10 +170,6 @@ public void onTestStart( test.setTag(Tags.TEST_MANAGEMENT_IS_QUARANTINED, true); } - if (hasFailedAllRetries) { - test.setTag(Tags.TEST_HAS_FAILED_ALL_RETRIES, true); - } - if (testFramework != null) { test.setTag(Tags.TEST_FRAMEWORK, testFramework); if (testFrameworkVersion != null) { @@ -207,11 +202,6 @@ public void onTestStart( } } - if (retryReason != null) { - test.setTag(Tags.TEST_IS_RETRY, true); - test.setTag(Tags.TEST_RETRY_REASON, retryReason); - } - inProgressTests.put(descriptor, test); } @@ -236,12 +226,28 @@ public void onTestFailure(TestKey descriptor, @Nullable Throwable throwable) { } @Override - public void onTestFinish(TestKey descriptor, @Nullable Long endTime) { + public void onTestFinish( + TestKey descriptor, + @Nullable Long endTime, + @Nullable TestExecutionHistory testExecutionHistory) { TestImpl test = inProgressTests.remove(descriptor); if (test == null) { log.debug("Ignoring finish event, could not find test {}", descriptor); return; } + + if (testExecutionHistory != null) { + RetryReason retryReason = testExecutionHistory.currentExecutionRetryReason(); + if (retryReason != null) { + test.setTag(Tags.TEST_IS_RETRY, true); + test.setTag(Tags.TEST_RETRY_REASON, retryReason); + } + + if (test.hasFailed() && testExecutionHistory.hasFailedAllRetries()) { + test.setTag(Tags.TEST_HAS_FAILED_ALL_RETRIES, true); + } + } + test.end(endTime); } @@ -265,11 +271,9 @@ public void onTestIgnore( testParameters, categories, testSourceData, - null, - false, null); onTestSkip(testDescriptor, reason); - onTestFinish(testDescriptor, null); + onTestFinish(testDescriptor, null, null); } @Override diff --git a/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/execution/RetryUntilSuccessful.java b/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/execution/RetryUntilSuccessful.java index 66fe97609f5..0bfe1220a75 100644 --- a/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/execution/RetryUntilSuccessful.java +++ b/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/execution/RetryUntilSuccessful.java @@ -26,18 +26,18 @@ public RetryUntilSuccessful( @Override public boolean applicable() { - return currentExecutionIsNotLast() || suppressFailures; + return !currentExecutionIsLast() || suppressFailures; } @Override public boolean suppressFailures() { // do not suppress failures for last execution // (unless flag to suppress all failures is set) - return currentExecutionIsNotLast() || suppressFailures; + return !currentExecutionIsLast() || suppressFailures; } - private boolean currentExecutionIsNotLast() { - return executions < maxExecutions - 1; + private boolean currentExecutionIsLast() { + return executions == maxExecutions - 1; } @Override @@ -63,6 +63,6 @@ private boolean currentExecutionIsRetry() { @Override public boolean hasFailedAllRetries() { - return executions == maxExecutions && !successfulExecutionSeen; + return currentExecutionIsLast() && !successfulExecutionSeen; } } diff --git a/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/execution/RunNTimes.java b/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/execution/RunNTimes.java index 5c6f64197f2..ac5fdd9d124 100644 --- a/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/execution/RunNTimes.java +++ b/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/execution/RunNTimes.java @@ -24,11 +24,11 @@ public RunNTimes( @Override public boolean applicable() { - return currentExecutionIsNotLast() || suppressFailures(); + return !currentExecutionIsLast() || suppressFailures(); } - private boolean currentExecutionIsNotLast() { - return executions < maxExecutions - 1; + private boolean currentExecutionIsLast() { + return executions == maxExecutions - 1; } @Override @@ -57,6 +57,6 @@ private boolean currentExecutionIsRetry() { @Override public boolean hasFailedAllRetries() { - return executions == maxExecutions && !successfulExecutionSeen; + return currentExecutionIsLast() && !successfulExecutionSeen; } } diff --git a/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/main/java/datadog/trace/instrumentation/junit4/CucumberTracingListener.java b/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/main/java/datadog/trace/instrumentation/junit4/CucumberTracingListener.java index 5b12ce4024b..6e7d36f4300 100644 --- a/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/main/java/datadog/trace/instrumentation/junit4/CucumberTracingListener.java +++ b/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/main/java/datadog/trace/instrumentation/junit4/CucumberTracingListener.java @@ -4,7 +4,7 @@ import datadog.trace.api.civisibility.coverage.CoveragePerTestBridge; import datadog.trace.api.civisibility.events.TestDescriptor; import datadog.trace.api.civisibility.events.TestSuiteDescriptor; -import datadog.trace.api.civisibility.execution.TestExecutionPolicy; +import datadog.trace.api.civisibility.execution.TestExecutionHistory; import datadog.trace.api.civisibility.telemetry.tag.TestFrameworkInstrumentation; import datadog.trace.bootstrap.ContextStore; import io.cucumber.core.gherkin.Pickle; @@ -29,13 +29,13 @@ public class CucumberTracingListener extends TracingListener { public static final String FRAMEWORK_NAME = "cucumber"; public static final String FRAMEWORK_VERSION = CucumberUtils.getVersion(); - private final ContextStore executionPolicies; + private final ContextStore executionHistories; private final Map pickleById; public CucumberTracingListener( - ContextStore executionPolicies, + ContextStore executionHistories, List> featureRunners) { - this.executionPolicies = executionPolicies; + this.executionHistories = executionHistories; pickleById = CucumberUtils.getPicklesById(featureRunners); } @@ -71,7 +71,6 @@ public void testStarted(final Description description) { String testName = CucumberUtils.getTestNameForScenario(description); List categories = getCategories(description); - TestExecutionPolicy executionPolicy = executionPolicies.get(description); TestEventsHandlerHolder.TEST_EVENTS_HANDLER.onTestStart( new TestSuiteDescriptor(testSuiteName, null), CucumberUtils.toTestDescriptor(description), @@ -81,8 +80,6 @@ public void testStarted(final Description description) { null, categories, TestSourceData.UNKNOWN, - executionPolicy != null ? executionPolicy.currentExecutionRetryReason() : null, - executionPolicy != null && executionPolicy.hasFailedAllRetries(), null); recordFeatureFileCodeCoverage(description); @@ -101,7 +98,9 @@ private static void recordFeatureFileCodeCoverage(Description scenarioDescriptio @Override public void testFinished(final Description description) { TestDescriptor testDescriptor = CucumberUtils.toTestDescriptor(description); - TestEventsHandlerHolder.TEST_EVENTS_HANDLER.onTestFinish(testDescriptor, null); + TestExecutionHistory executionHistory = executionHistories.get(description); + TestEventsHandlerHolder.TEST_EVENTS_HANDLER.onTestFinish( + testDescriptor, null, executionHistory); } // same callback is executed both for test cases and test suites (for setup/teardown errors) diff --git a/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/main/java/datadog/trace/instrumentation/junit4/JUnit4CucumberInstrumentation.java b/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/main/java/datadog/trace/instrumentation/junit4/JUnit4CucumberInstrumentation.java index 6101c51f18c..5c9737b33a4 100644 --- a/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/main/java/datadog/trace/instrumentation/junit4/JUnit4CucumberInstrumentation.java +++ b/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/main/java/datadog/trace/instrumentation/junit4/JUnit4CucumberInstrumentation.java @@ -7,7 +7,7 @@ import datadog.trace.agent.tooling.Instrumenter; import datadog.trace.agent.tooling.InstrumenterModule; import datadog.trace.agent.tooling.muzzle.Reference; -import datadog.trace.api.civisibility.execution.TestExecutionPolicy; +import datadog.trace.api.civisibility.execution.TestExecutionHistory; import datadog.trace.bootstrap.InstrumentationContext; import java.util.Collections; import java.util.List; @@ -46,7 +46,7 @@ public String[] helperClassNames() { @Override public Map contextStore() { return Collections.singletonMap( - "org.junit.runner.Description", TestExecutionPolicy.class.getName()); + "org.junit.runner.Description", TestExecutionHistory.class.getName()); } @Override @@ -84,7 +84,7 @@ public static void addTracingListener( replacedNotifier.addListener( new CucumberTracingListener( - InstrumentationContext.get(Description.class, TestExecutionPolicy.class), children)); + InstrumentationContext.get(Description.class, TestExecutionHistory.class), children)); runNotifier = replacedNotifier; } } diff --git a/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/main/java/datadog/trace/instrumentation/junit4/execution/Cucumber4ExecutionInstrumentation.java b/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/main/java/datadog/trace/instrumentation/junit4/execution/Cucumber4ExecutionInstrumentation.java index f7f673aa04d..7c169002193 100644 --- a/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/main/java/datadog/trace/instrumentation/junit4/execution/Cucumber4ExecutionInstrumentation.java +++ b/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/main/java/datadog/trace/instrumentation/junit4/execution/Cucumber4ExecutionInstrumentation.java @@ -10,6 +10,7 @@ import datadog.trace.api.Config; import datadog.trace.api.civisibility.config.TestIdentifier; import datadog.trace.api.civisibility.config.TestSourceData; +import datadog.trace.api.civisibility.execution.TestExecutionHistory; import datadog.trace.api.civisibility.execution.TestExecutionPolicy; import datadog.trace.bootstrap.InstrumentationContext; import datadog.trace.instrumentation.junit4.CucumberUtils; @@ -62,7 +63,7 @@ public String[] helperClassNames() { @Override public Map contextStore() { return Collections.singletonMap( - "org.junit.runner.Description", TestExecutionPolicy.class.getName()); + "org.junit.runner.Description", TestExecutionHistory.class.getName()); } @Override @@ -103,7 +104,7 @@ public static Boolean execute( return null; } - InstrumentationContext.get(Description.class, TestExecutionPolicy.class) + InstrumentationContext.get(Description.class, TestExecutionHistory.class) .put(description, executionPolicy); FailureSuppressingNotifier failureSuppressingNotifier = diff --git a/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/main/java/datadog/trace/instrumentation/junit4/MUnitInstrumentation.java b/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/main/java/datadog/trace/instrumentation/junit4/MUnitInstrumentation.java index 26329630dcd..04a7b05b9ba 100644 --- a/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/main/java/datadog/trace/instrumentation/junit4/MUnitInstrumentation.java +++ b/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/main/java/datadog/trace/instrumentation/junit4/MUnitInstrumentation.java @@ -6,7 +6,7 @@ import com.google.auto.service.AutoService; import datadog.trace.agent.tooling.Instrumenter; import datadog.trace.agent.tooling.InstrumenterModule; -import datadog.trace.api.civisibility.execution.TestExecutionPolicy; +import datadog.trace.api.civisibility.execution.TestExecutionHistory; import datadog.trace.bootstrap.InstrumentationContext; import java.util.Collections; import java.util.List; @@ -44,7 +44,7 @@ public String[] helperClassNames() { @Override public Map contextStore() { return Collections.singletonMap( - "org.junit.runner.Description", TestExecutionPolicy.class.getName()); + "org.junit.runner.Description", TestExecutionHistory.class.getName()); } @Override @@ -75,7 +75,7 @@ public static void addTracingListener( replacedNotifier.addListener( new MUnitTracingListener( - InstrumentationContext.get(Description.class, TestExecutionPolicy.class))); + InstrumentationContext.get(Description.class, TestExecutionHistory.class))); runNotifier = replacedNotifier; } } diff --git a/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/main/java/datadog/trace/instrumentation/junit4/MUnitTracingListener.java b/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/main/java/datadog/trace/instrumentation/junit4/MUnitTracingListener.java index 45341cb6a22..c5a7fea7704 100644 --- a/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/main/java/datadog/trace/instrumentation/junit4/MUnitTracingListener.java +++ b/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/main/java/datadog/trace/instrumentation/junit4/MUnitTracingListener.java @@ -2,7 +2,7 @@ import datadog.trace.api.civisibility.events.TestDescriptor; import datadog.trace.api.civisibility.events.TestSuiteDescriptor; -import datadog.trace.api.civisibility.execution.TestExecutionPolicy; +import datadog.trace.api.civisibility.execution.TestExecutionHistory; import datadog.trace.api.civisibility.telemetry.tag.TestFrameworkInstrumentation; import datadog.trace.bootstrap.ContextStore; import datadog.trace.bootstrap.instrumentation.api.AgentScope; @@ -23,10 +23,10 @@ public class MUnitTracingListener extends TracingListener { public static final String FRAMEWORK_NAME = "munit"; public static final String FRAMEWORK_VERSION = getVersion(); - private final ContextStore executionPolicies; + private final ContextStore executionHistories; - public MUnitTracingListener(ContextStore executionPolicies) { - this.executionPolicies = executionPolicies; + public MUnitTracingListener(ContextStore executionHistories) { + this.executionHistories = executionHistories; } public static String getVersion() { @@ -76,7 +76,6 @@ public void testStarted(final Description description) { TestDescriptor testDescriptor = MUnitUtils.toTestDescriptor(description); String testName = description.getMethodName(); List categories = getCategories(description); - TestExecutionPolicy executionPolicy = executionPolicies.get(description); TestEventsHandlerHolder.TEST_EVENTS_HANDLER.onTestStart( suiteDescriptor, testDescriptor, @@ -86,15 +85,15 @@ public void testStarted(final Description description) { null, categories, JUnit4Utils.toTestSourceData(description), - executionPolicy != null ? executionPolicy.currentExecutionRetryReason() : null, - executionPolicy != null && executionPolicy.hasFailedAllRetries(), null); } @Override public void testFinished(final Description description) { TestDescriptor testDescriptor = MUnitUtils.toTestDescriptor(description); - TestEventsHandlerHolder.TEST_EVENTS_HANDLER.onTestFinish(testDescriptor, null); + TestExecutionHistory executionHistory = executionHistories.get(description); + TestEventsHandlerHolder.TEST_EVENTS_HANDLER.onTestFinish( + testDescriptor, null, executionHistory); } // same callback is executed both for test cases and test suites (for setup/teardown errors) @@ -161,12 +160,10 @@ public void testIgnored(final Description description) { null, categories, JUnit4Utils.toTestSourceData(description), - null, - false, null); } TestEventsHandlerHolder.TEST_EVENTS_HANDLER.onTestSkip(testDescriptor, null); - TestEventsHandlerHolder.TEST_EVENTS_HANDLER.onTestFinish(testDescriptor, null); + TestEventsHandlerHolder.TEST_EVENTS_HANDLER.onTestFinish(testDescriptor, null, null); } else if (testClass != null) { TestSuiteDescriptor suiteDescriptor = MUnitUtils.toSuiteDescriptor(description); diff --git a/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/main/java/datadog/trace/instrumentation/junit4/execution/MUnitExecutionInstrumentation.java b/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/main/java/datadog/trace/instrumentation/junit4/execution/MUnitExecutionInstrumentation.java index 7d929694c75..0126950be92 100644 --- a/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/main/java/datadog/trace/instrumentation/junit4/execution/MUnitExecutionInstrumentation.java +++ b/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/main/java/datadog/trace/instrumentation/junit4/execution/MUnitExecutionInstrumentation.java @@ -9,6 +9,7 @@ import datadog.trace.api.Config; import datadog.trace.api.civisibility.config.TestIdentifier; import datadog.trace.api.civisibility.config.TestSourceData; +import datadog.trace.api.civisibility.execution.TestExecutionHistory; import datadog.trace.api.civisibility.execution.TestExecutionPolicy; import datadog.trace.bootstrap.InstrumentationContext; import datadog.trace.instrumentation.junit4.JUnit4Utils; @@ -62,7 +63,7 @@ public String[] helperClassNames() { @Override public Map contextStore() { return Collections.singletonMap( - "org.junit.runner.Description", TestExecutionPolicy.class.getName()); + "org.junit.runner.Description", TestExecutionHistory.class.getName()); } @Override @@ -97,7 +98,7 @@ public static Future apply( return null; } - InstrumentationContext.get(Description.class, TestExecutionPolicy.class) + InstrumentationContext.get(Description.class, TestExecutionHistory.class) .put(description, executionPolicy); Future result = Future.successful(false); diff --git a/dd-java-agent/instrumentation/junit-4.10/src/main/java/datadog/trace/instrumentation/junit4/JUnit4Instrumentation.java b/dd-java-agent/instrumentation/junit-4.10/src/main/java/datadog/trace/instrumentation/junit4/JUnit4Instrumentation.java index 86671bf134e..abd72ed85b9 100644 --- a/dd-java-agent/instrumentation/junit-4.10/src/main/java/datadog/trace/instrumentation/junit4/JUnit4Instrumentation.java +++ b/dd-java-agent/instrumentation/junit-4.10/src/main/java/datadog/trace/instrumentation/junit4/JUnit4Instrumentation.java @@ -9,7 +9,7 @@ import com.google.auto.service.AutoService; import datadog.trace.agent.tooling.Instrumenter; import datadog.trace.agent.tooling.InstrumenterModule; -import datadog.trace.api.civisibility.execution.TestExecutionPolicy; +import datadog.trace.api.civisibility.execution.TestExecutionHistory; import datadog.trace.bootstrap.InstrumentationContext; import java.util.Collections; import java.util.List; @@ -75,7 +75,7 @@ public String[] helperClassNames() { @Override public Map contextStore() { return Collections.singletonMap( - "org.junit.runner.Description", TestExecutionPolicy.class.getName()); + "org.junit.runner.Description", TestExecutionHistory.class.getName()); } @Override @@ -116,7 +116,7 @@ public static void addTracingListener( final TracingListener tracingListener = new JUnit4TracingListener( - InstrumentationContext.get(Description.class, TestExecutionPolicy.class)); + InstrumentationContext.get(Description.class, TestExecutionHistory.class)); runNotifier.addListener(tracingListener); } diff --git a/dd-java-agent/instrumentation/junit-4.10/src/main/java/datadog/trace/instrumentation/junit4/JUnit4TracingListener.java b/dd-java-agent/instrumentation/junit-4.10/src/main/java/datadog/trace/instrumentation/junit4/JUnit4TracingListener.java index 4fa292924d7..cf06034c701 100644 --- a/dd-java-agent/instrumentation/junit-4.10/src/main/java/datadog/trace/instrumentation/junit4/JUnit4TracingListener.java +++ b/dd-java-agent/instrumentation/junit-4.10/src/main/java/datadog/trace/instrumentation/junit4/JUnit4TracingListener.java @@ -3,7 +3,7 @@ import datadog.trace.api.civisibility.config.TestSourceData; import datadog.trace.api.civisibility.events.TestDescriptor; import datadog.trace.api.civisibility.events.TestSuiteDescriptor; -import datadog.trace.api.civisibility.execution.TestExecutionPolicy; +import datadog.trace.api.civisibility.execution.TestExecutionHistory; import datadog.trace.api.civisibility.telemetry.tag.TestFrameworkInstrumentation; import datadog.trace.bootstrap.ContextStore; import java.lang.reflect.Method; @@ -18,10 +18,10 @@ public class JUnit4TracingListener extends TracingListener { private static final String FRAMEWORK_NAME = "junit4"; private static final String FRAMEWORK_VERSION = Version.id(); - private final ContextStore executionPolicies; + private final ContextStore executionHistories; - public JUnit4TracingListener(ContextStore executionPolicies) { - this.executionPolicies = executionPolicies; + public JUnit4TracingListener(ContextStore executionHistories) { + this.executionHistories = executionHistories; } public void testSuiteStarted(final Description description) { @@ -74,7 +74,6 @@ public void testStarted(final Description description) { String testParameters = JUnit4Utils.getParameters(description); List categories = JUnit4Utils.getCategories(testSourceData.getTestClass(), testSourceData.getTestMethod()); - TestExecutionPolicy executionPolicy = executionPolicies.get(description); TestEventsHandlerHolder.TEST_EVENTS_HANDLER.onTestStart( suiteDescriptor, @@ -85,8 +84,6 @@ public void testStarted(final Description description) { testParameters, categories, testSourceData, - executionPolicy != null ? executionPolicy.currentExecutionRetryReason() : null, - executionPolicy != null && executionPolicy.hasFailedAllRetries(), null); } @@ -97,7 +94,9 @@ public void testFinished(final Description description) { } TestDescriptor testDescriptor = JUnit4Utils.toTestDescriptor(description); - TestEventsHandlerHolder.TEST_EVENTS_HANDLER.onTestFinish(testDescriptor, null); + TestExecutionHistory executionHistory = executionHistories.get(description); + TestEventsHandlerHolder.TEST_EVENTS_HANDLER.onTestFinish( + testDescriptor, null, executionHistory); } // same callback is executed both for test cases and test suites (for setup/teardown errors) diff --git a/dd-java-agent/instrumentation/junit-4.10/src/main/java/datadog/trace/instrumentation/junit4/execution/JUnit4ExecutionInstrumentation.java b/dd-java-agent/instrumentation/junit-4.10/src/main/java/datadog/trace/instrumentation/junit4/execution/JUnit4ExecutionInstrumentation.java index 75ad0ca68ca..ad25f41a9f5 100644 --- a/dd-java-agent/instrumentation/junit-4.10/src/main/java/datadog/trace/instrumentation/junit4/execution/JUnit4ExecutionInstrumentation.java +++ b/dd-java-agent/instrumentation/junit-4.10/src/main/java/datadog/trace/instrumentation/junit4/execution/JUnit4ExecutionInstrumentation.java @@ -10,6 +10,7 @@ import datadog.trace.api.Config; import datadog.trace.api.civisibility.config.TestIdentifier; import datadog.trace.api.civisibility.config.TestSourceData; +import datadog.trace.api.civisibility.execution.TestExecutionHistory; import datadog.trace.api.civisibility.execution.TestExecutionPolicy; import datadog.trace.bootstrap.InstrumentationContext; import datadog.trace.instrumentation.junit4.JUnit4Utils; @@ -69,7 +70,7 @@ public String[] helperClassNames() { @Override public Map contextStore() { return Collections.singletonMap( - "org.junit.runner.Description", TestExecutionPolicy.class.getName()); + "org.junit.runner.Description", TestExecutionHistory.class.getName()); } @Override @@ -107,7 +108,7 @@ public static Boolean apply( return null; } - InstrumentationContext.get(Description.class, TestExecutionPolicy.class) + InstrumentationContext.get(Description.class, TestExecutionHistory.class) .put(description, executionPolicy); FailureSuppressingNotifier failureSuppressingNotifier = diff --git a/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/main/java/datadog/trace/instrumentation/junit5/CucumberTracingListener.java b/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/main/java/datadog/trace/instrumentation/junit5/CucumberTracingListener.java index d97b78e5be3..6ad4b1c62c4 100644 --- a/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/main/java/datadog/trace/instrumentation/junit5/CucumberTracingListener.java +++ b/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/main/java/datadog/trace/instrumentation/junit5/CucumberTracingListener.java @@ -3,6 +3,7 @@ import datadog.trace.api.Pair; import datadog.trace.api.civisibility.config.TestSourceData; import datadog.trace.api.civisibility.coverage.CoveragePerTestBridge; +import datadog.trace.api.civisibility.execution.TestExecutionHistory; import datadog.trace.api.civisibility.telemetry.tag.TestFrameworkInstrumentation; import java.util.List; import java.util.stream.Collectors; @@ -123,8 +124,6 @@ private void testResourceExecutionStarted( null, tags, TestSourceData.UNKNOWN, - JUnitPlatformUtils.retryReason(testDescriptor), - JUnitPlatformUtils.hasFailedAllRetries(testDescriptor), null); CoveragePerTestBridge.recordCoverage(classpathResourceName); @@ -149,7 +148,10 @@ private void testResourceExecutionFinished( TestEventsHandlerHolder.TEST_EVENTS_HANDLER.onTestFailure(testDescriptor, throwable); } } - TestEventsHandlerHolder.TEST_EVENTS_HANDLER.onTestFinish(testDescriptor, null); + TestExecutionHistory executionHistory = + TestEventsHandlerHolder.getExecutionHistory(testDescriptor); + TestEventsHandlerHolder.TEST_EVENTS_HANDLER.onTestFinish( + testDescriptor, null, executionHistory); } @Override diff --git a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/main/java/datadog/trace/instrumentation/junit5/SpockTracingListener.java b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/main/java/datadog/trace/instrumentation/junit5/SpockTracingListener.java index 53cb8244040..18ec1f2610a 100644 --- a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/main/java/datadog/trace/instrumentation/junit5/SpockTracingListener.java +++ b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/main/java/datadog/trace/instrumentation/junit5/SpockTracingListener.java @@ -1,6 +1,7 @@ package datadog.trace.instrumentation.junit5; import datadog.trace.api.civisibility.config.TestSourceData; +import datadog.trace.api.civisibility.execution.TestExecutionHistory; import datadog.trace.api.civisibility.telemetry.tag.TestFrameworkInstrumentation; import java.util.List; import java.util.stream.Collectors; @@ -124,8 +125,6 @@ private void testMethodExecutionStarted(TestDescriptor testDescriptor, MethodSou testParameters, tags, testSourceData, - JUnitPlatformUtils.retryReason(testDescriptor), - JUnitPlatformUtils.hasFailedAllRetries(testDescriptor), null); } @@ -148,7 +147,10 @@ private static void testMethodExecutionFinished( TestEventsHandlerHolder.TEST_EVENTS_HANDLER.onTestFailure(testDescriptor, throwable); } } - TestEventsHandlerHolder.TEST_EVENTS_HANDLER.onTestFinish(testDescriptor, null); + TestExecutionHistory executionHistory = + TestEventsHandlerHolder.getExecutionHistory(testDescriptor); + TestEventsHandlerHolder.TEST_EVENTS_HANDLER.onTestFinish( + testDescriptor, null, executionHistory); } @Override diff --git a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/main/java/datadog/trace/instrumentation/junit5/retry/JUnit5SpockParameterizedExecutionInstrumentation.java b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/main/java/datadog/trace/instrumentation/junit5/execution/JUnit5SpockParameterizedExecutionInstrumentation.java similarity index 97% rename from dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/main/java/datadog/trace/instrumentation/junit5/retry/JUnit5SpockParameterizedExecutionInstrumentation.java rename to dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/main/java/datadog/trace/instrumentation/junit5/execution/JUnit5SpockParameterizedExecutionInstrumentation.java index 9074313fbed..a7642ad3259 100644 --- a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/main/java/datadog/trace/instrumentation/junit5/retry/JUnit5SpockParameterizedExecutionInstrumentation.java +++ b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/main/java/datadog/trace/instrumentation/junit5/execution/JUnit5SpockParameterizedExecutionInstrumentation.java @@ -1,4 +1,4 @@ -package datadog.trace.instrumentation.junit5.retry; +package datadog.trace.instrumentation.junit5.execution; import static net.bytebuddy.matcher.ElementMatchers.isConstructor; diff --git a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/main/java/datadog/trace/instrumentation/junit5/retry/SpockParameterizedExecutionListener.java b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/main/java/datadog/trace/instrumentation/junit5/execution/SpockParameterizedExecutionListener.java similarity index 96% rename from dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/main/java/datadog/trace/instrumentation/junit5/retry/SpockParameterizedExecutionListener.java rename to dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/main/java/datadog/trace/instrumentation/junit5/execution/SpockParameterizedExecutionListener.java index 813fb768e08..1fd3649a079 100644 --- a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/main/java/datadog/trace/instrumentation/junit5/retry/SpockParameterizedExecutionListener.java +++ b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/main/java/datadog/trace/instrumentation/junit5/execution/SpockParameterizedExecutionListener.java @@ -1,4 +1,4 @@ -package datadog.trace.instrumentation.junit5.retry; +package datadog.trace.instrumentation.junit5.execution; import datadog.trace.instrumentation.junit5.JUnitPlatformUtils; import java.util.Map; diff --git a/dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/JUnitPlatformUtils.java b/dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/JUnitPlatformUtils.java index ef03ba502a0..ba9382c6f9f 100644 --- a/dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/JUnitPlatformUtils.java +++ b/dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/JUnitPlatformUtils.java @@ -4,7 +4,6 @@ import datadog.trace.api.civisibility.config.TestIdentifier; import datadog.trace.api.civisibility.config.TestSourceData; -import datadog.trace.api.civisibility.telemetry.tag.RetryReason; import datadog.trace.bootstrap.instrumentation.api.AgentScope; import datadog.trace.bootstrap.instrumentation.api.AgentSpan; import datadog.trace.bootstrap.instrumentation.api.AgentTracer; @@ -35,9 +34,7 @@ */ public abstract class JUnitPlatformUtils { - public static final String RETRY_DESCRIPTOR_REASON_SUFFIX = "retry-reason"; public static final String RETRY_DESCRIPTOR_ID_SUFFIX = "retry-attempt"; - public static final String HAS_FAILED_ALL_RETRIES_SUFFIX = "failed-all-retries"; private static final Logger LOGGER = LoggerFactory.getLogger(JUnitPlatformUtils.class); @@ -187,19 +184,10 @@ public static boolean isParameterizedTest(TestDescriptor testDescriptor) { return "test-template".equals(lastSegment.getType()); } - public static RetryReason retryReason(TestDescriptor testDescriptor) { - String retryReasonSegment = getIDSegmentValue(testDescriptor, RETRY_DESCRIPTOR_REASON_SUFFIX); - return retryReasonSegment != null ? RetryReason.valueOf(retryReasonSegment) : null; - } - public static boolean isRetry(TestDescriptor testDescriptor) { return getIDSegmentValue(testDescriptor, RETRY_DESCRIPTOR_ID_SUFFIX) != null; } - public static boolean hasFailedAllRetries(TestDescriptor testDescriptor) { - return getIDSegmentValue(testDescriptor, HAS_FAILED_ALL_RETRIES_SUFFIX) != null; - } - private static String getIDSegmentValue(TestDescriptor testDescriptor, String segmentName) { UniqueId uniqueId = testDescriptor.getUniqueId(); List segments = uniqueId.getSegments(); diff --git a/dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/TestEventsHandlerHolder.java b/dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/TestEventsHandlerHolder.java index 13f9f1b188a..cb209741bb1 100644 --- a/dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/TestEventsHandlerHolder.java +++ b/dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/TestEventsHandlerHolder.java @@ -4,6 +4,7 @@ import datadog.trace.api.civisibility.DDTestSuite; import datadog.trace.api.civisibility.InstrumentationBridge; import datadog.trace.api.civisibility.events.TestEventsHandler; +import datadog.trace.api.civisibility.execution.TestExecutionHistory; import datadog.trace.bootstrap.ContextStore; import datadog.trace.util.AgentThreadFactory; import org.junit.platform.engine.TestDescriptor; @@ -13,6 +14,8 @@ public abstract class TestEventsHandlerHolder { public static volatile TestEventsHandler TEST_EVENTS_HANDLER; private static ContextStore SUITE_STORE; private static ContextStore TEST_STORE; + private static volatile ContextStore + EXECUTION_HISTORY_STORE; static { Runtime.getRuntime() @@ -34,6 +37,28 @@ public static synchronized void setContextStores( } } + public static synchronized void setExecutionHistoryStore( + ContextStore executionHistoryStore) { + if (EXECUTION_HISTORY_STORE == null) { + EXECUTION_HISTORY_STORE = executionHistoryStore; + } + } + + public static void setExecutionHistory( + TestDescriptor testDescriptor, TestExecutionHistory history) { + if (EXECUTION_HISTORY_STORE != null) { + EXECUTION_HISTORY_STORE.put(testDescriptor, history); + } + } + + public static TestExecutionHistory getExecutionHistory(TestDescriptor testDescriptor) { + if (EXECUTION_HISTORY_STORE != null) { + return EXECUTION_HISTORY_STORE.get(testDescriptor); + } else { + return null; + } + } + public static synchronized void start() { if (TEST_EVENTS_HANDLER == null) { TEST_EVENTS_HANDLER = diff --git a/dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/TracingListener.java b/dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/TracingListener.java index 47a4bbeaade..eaa73ce2773 100644 --- a/dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/TracingListener.java +++ b/dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/TracingListener.java @@ -1,6 +1,7 @@ package datadog.trace.instrumentation.junit5; import datadog.trace.api.civisibility.config.TestSourceData; +import datadog.trace.api.civisibility.execution.TestExecutionHistory; import datadog.trace.api.civisibility.telemetry.tag.TestFrameworkInstrumentation; import java.util.List; import java.util.stream.Collectors; @@ -124,8 +125,6 @@ private void testMethodExecutionStarted(TestDescriptor testDescriptor, MethodSou testParameters, tags, testSourceData, - JUnitPlatformUtils.retryReason(testDescriptor), - JUnitPlatformUtils.hasFailedAllRetries(testDescriptor), null); } @@ -148,7 +147,10 @@ private static void testMethodExecutionFinished( TestEventsHandlerHolder.TEST_EVENTS_HANDLER.onTestFailure(testDescriptor, throwable); } } - TestEventsHandlerHolder.TEST_EVENTS_HANDLER.onTestFinish(testDescriptor, null); + TestExecutionHistory executionHistory = + TestEventsHandlerHolder.getExecutionHistory(testDescriptor); + TestEventsHandlerHolder.TEST_EVENTS_HANDLER.onTestFinish( + testDescriptor, null, executionHistory); } @Override diff --git a/dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/retry/JUnit5ExecutionInstrumentation.java b/dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/execution/JUnit5ExecutionInstrumentation.java similarity index 89% rename from dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/retry/JUnit5ExecutionInstrumentation.java rename to dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/execution/JUnit5ExecutionInstrumentation.java index 56942d4e1ca..53bdd76a58f 100644 --- a/dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/retry/JUnit5ExecutionInstrumentation.java +++ b/dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/execution/JUnit5ExecutionInstrumentation.java @@ -1,4 +1,4 @@ -package datadog.trace.instrumentation.junit5.retry; +package datadog.trace.instrumentation.junit5.execution; import static datadog.trace.agent.tooling.bytebuddy.matcher.NameMatchers.named; import static net.bytebuddy.matcher.ElementMatchers.isConstructor; @@ -15,7 +15,6 @@ import datadog.trace.api.civisibility.config.TestSourceData; import datadog.trace.api.civisibility.execution.TestExecutionPolicy; import datadog.trace.bootstrap.CallDepthThreadLocalMap; -import datadog.trace.bootstrap.InstrumentationContext; import datadog.trace.instrumentation.junit5.JUnitPlatformUtils; import datadog.trace.instrumentation.junit5.TestDataFactory; import datadog.trace.instrumentation.junit5.TestEventsHandlerHolder; @@ -23,7 +22,6 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import java.util.ArrayList; import java.util.Collections; -import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; @@ -68,13 +66,6 @@ public String[] helperClassNames() { }; } - @Override - public Map contextStore() { - return Collections.singletonMap( - "org.junit.platform.engine.TestDescriptor", - "datadog.trace.api.civisibility.execution.TestExecutionPolicy"); - } - @Override public ReferenceProvider runtimeMuzzleReferences() { return new TestTaskHandle.MuzzleHelper(); @@ -152,6 +143,8 @@ public static Boolean execute(@Advice.This HierarchicalTestExecutorService.TestT return null; } + TestEventsHandlerHolder.setExecutionHistory(testDescriptor, executionPolicy); + ThrowableCollectorFactoryWrapper factory = (ThrowableCollectorFactoryWrapper) taskHandle.getThrowableCollectorFactory(); EngineExecutionContext parentContext = taskHandle.getParentContext(); @@ -182,23 +175,15 @@ public static Boolean execute(@Advice.This HierarchicalTestExecutorService.TestT * require every test execution to have a distinct unique ID. * Rerunning a test with the ID that was executed previously will cause errors. */ - Map suffixes = new HashMap<>(); - suffixes.put( - JUnitPlatformUtils.RETRY_DESCRIPTOR_REASON_SUFFIX, - executionPolicy.currentExecutionRetryReason()); - suffixes.put( - JUnitPlatformUtils.RETRY_DESCRIPTOR_ID_SUFFIX, String.valueOf(++retryAttemptIdx)); - - if (executionPolicy.hasFailedAllRetries()) { - suffixes.put(JUnitPlatformUtils.HAS_FAILED_ALL_RETRIES_SUFFIX, "true"); - } + Map suffix = + Collections.singletonMap( + JUnitPlatformUtils.RETRY_DESCRIPTOR_ID_SUFFIX, String.valueOf(++retryAttemptIdx)); - TestDescriptor retryDescriptor = descriptorHandle.withIdSuffix(suffixes); + TestDescriptor retryDescriptor = descriptorHandle.withIdSuffix(suffix); taskHandle.setTestDescriptor(retryDescriptor); taskHandle.setNode((Node) retryDescriptor); taskHandle.getListener().dynamicTestRegistered(retryDescriptor); - InstrumentationContext.get(TestDescriptor.class, TestExecutionPolicy.class) - .put(retryDescriptor, executionPolicy); + TestEventsHandlerHolder.setExecutionHistory(retryDescriptor, executionPolicy); // restore parent context, since the reference is overwritten with null after execution taskHandle.setParentContext(parentContext); diff --git a/dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/execution/JUnit5ExecutionStoreInstrumentation.java b/dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/execution/JUnit5ExecutionStoreInstrumentation.java new file mode 100644 index 00000000000..99d7e294b7c --- /dev/null +++ b/dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/execution/JUnit5ExecutionStoreInstrumentation.java @@ -0,0 +1,91 @@ +package datadog.trace.instrumentation.junit5.execution; + +import static datadog.trace.agent.tooling.bytebuddy.matcher.HierarchyMatchers.implementsInterface; +import static datadog.trace.agent.tooling.bytebuddy.matcher.NameMatchers.named; +import static net.bytebuddy.matcher.ElementMatchers.not; +import static net.bytebuddy.matcher.ElementMatchers.takesArgument; + +import com.google.auto.service.AutoService; +import datadog.trace.agent.tooling.Instrumenter; +import datadog.trace.agent.tooling.InstrumenterModule; +import datadog.trace.api.civisibility.execution.TestExecutionHistory; +import datadog.trace.bootstrap.ContextStore; +import datadog.trace.bootstrap.InstrumentationContext; +import datadog.trace.instrumentation.junit5.JUnitPlatformUtils; +import datadog.trace.instrumentation.junit5.TestEventsHandlerHolder; +import datadog.trace.util.Strings; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; +import java.util.Collections; +import java.util.Map; +import net.bytebuddy.asm.Advice; +import net.bytebuddy.description.type.TypeDescription; +import net.bytebuddy.matcher.ElementMatcher; +import org.junit.platform.engine.TestDescriptor; +import org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService; + +@AutoService(InstrumenterModule.class) +public class JUnit5ExecutionStoreInstrumentation extends InstrumenterModule.CiVisibility + implements Instrumenter.ForTypeHierarchy, Instrumenter.HasMethodAdvice { + + private final String parentPackageName = + Strings.getPackageName(JUnitPlatformUtils.class.getName()); + + public JUnit5ExecutionStoreInstrumentation() { + super("ci-visibility", "junit-5", "test-retry"); + } + + @Override + public String hierarchyMarkerType() { + return "org.junit.platform.engine.TestEngine"; + } + + @Override + public ElementMatcher hierarchyMatcher() { + return implementsInterface(named(hierarchyMarkerType())) + // JUnit 4 has a dedicated instrumentation + .and(not(named("org.junit.vintage.engine.VintageTestEngine"))) + // suites are only used to organize other test engines + .and(not(named("org.junit.platform.suite.engine.SuiteTestEngine"))); + } + + @Override + public String[] helperClassNames() { + return new String[] { + parentPackageName + ".TestEventsHandlerHolder", + }; + } + + @Override + public Map contextStore() { + return Collections.singletonMap( + "org.junit.platform.engine.TestDescriptor", + "datadog.trace.api.civisibility.execution.TestExecutionHistory"); + } + + @Override + public void methodAdvice(MethodTransformer transformer) { + transformer.applyAdvice( + named("discover") + .and( + takesArgument(0, named("org.junit.platform.engine.EngineDiscoveryRequest")) + .and(takesArgument(1, named("org.junit.platform.engine.UniqueId")))), + JUnit5ExecutionStoreInstrumentation.class.getName() + "$ContextStoreAdvice"); + } + + public static class ContextStoreAdvice { + @SuppressFBWarnings( + value = "UC_USELESS_OBJECT", + justification = "executionRequest is the argument of the original method") + @Advice.OnMethodEnter + public static void setContextStores() { + ContextStore contextStore = + InstrumentationContext.get(TestDescriptor.class, TestExecutionHistory.class); + TestEventsHandlerHolder.setExecutionHistoryStore(contextStore); + } + + // JUnit 5.3.0 and above + public static void muzzleCheck(final SameThreadHierarchicalTestExecutorService service) { + service.invokeAll(null); + } + } +} diff --git a/dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/retry/JUnit5NodeTestTaskContextInstrumentation.java b/dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/execution/JUnit5NodeTestTaskContextInstrumentation.java similarity index 97% rename from dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/retry/JUnit5NodeTestTaskContextInstrumentation.java rename to dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/execution/JUnit5NodeTestTaskContextInstrumentation.java index 2525ba73829..73b0e41fe51 100644 --- a/dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/retry/JUnit5NodeTestTaskContextInstrumentation.java +++ b/dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/execution/JUnit5NodeTestTaskContextInstrumentation.java @@ -1,4 +1,4 @@ -package datadog.trace.instrumentation.junit5.retry; +package datadog.trace.instrumentation.junit5.execution; import static net.bytebuddy.matcher.ElementMatchers.isConstructor; diff --git a/dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/retry/TestDescriptorHandle.java b/dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/execution/TestDescriptorHandle.java similarity index 97% rename from dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/retry/TestDescriptorHandle.java rename to dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/execution/TestDescriptorHandle.java index 9637f74106c..b89fc1113e4 100644 --- a/dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/retry/TestDescriptorHandle.java +++ b/dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/execution/TestDescriptorHandle.java @@ -1,4 +1,4 @@ -package datadog.trace.instrumentation.junit5.retry; +package datadog.trace.instrumentation.junit5.execution; import datadog.trace.agent.tooling.muzzle.Reference; import datadog.trace.util.MethodHandles; diff --git a/dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/retry/TestTaskHandle.java b/dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/execution/TestTaskHandle.java similarity index 99% rename from dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/retry/TestTaskHandle.java rename to dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/execution/TestTaskHandle.java index 802c4354d13..af50a2aef5b 100644 --- a/dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/retry/TestTaskHandle.java +++ b/dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/execution/TestTaskHandle.java @@ -1,4 +1,4 @@ -package datadog.trace.instrumentation.junit5.retry; +package datadog.trace.instrumentation.junit5.execution; import datadog.trace.agent.tooling.muzzle.Reference; import datadog.trace.agent.tooling.muzzle.ReferenceProvider; diff --git a/dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/retry/ThrowableCollectorFactoryWrapper.java b/dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/execution/ThrowableCollectorFactoryWrapper.java similarity index 95% rename from dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/retry/ThrowableCollectorFactoryWrapper.java rename to dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/execution/ThrowableCollectorFactoryWrapper.java index 6a5074ccefa..f9f0dc23c17 100644 --- a/dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/retry/ThrowableCollectorFactoryWrapper.java +++ b/dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/execution/ThrowableCollectorFactoryWrapper.java @@ -1,4 +1,4 @@ -package datadog.trace.instrumentation.junit5.retry; +package datadog.trace.instrumentation.junit5.execution; import org.junit.platform.engine.support.hierarchical.ThrowableCollector; diff --git a/dd-java-agent/instrumentation/karate/src/main/java/datadog/trace/instrumentation/karate/KarateExecutionInstrumentation.java b/dd-java-agent/instrumentation/karate/src/main/java/datadog/trace/instrumentation/karate/KarateExecutionInstrumentation.java index bda51313ce5..5e2304fa082 100644 --- a/dd-java-agent/instrumentation/karate/src/main/java/datadog/trace/instrumentation/karate/KarateExecutionInstrumentation.java +++ b/dd-java-agent/instrumentation/karate/src/main/java/datadog/trace/instrumentation/karate/KarateExecutionInstrumentation.java @@ -104,11 +104,7 @@ public static void afterExecute(@Advice.This ScenarioRuntime scenarioRuntime) { while (executionPolicy.retry(!context.getAndResetFailed(), duration)) { ScenarioRuntime retry = new ScenarioRuntime(scenarioRuntime.featureRuntime, scenarioRuntime.scenario); - retry.magicVariables.put( - KarateUtils.RETRY_MAGIC_VARIABLE, executionPolicy.currentExecutionRetryReason()); - retry.magicVariables.put( - KarateUtils.HAS_FAILED_ALL_RETRIES_MAGIC_VARIABLE, - executionPolicy.hasFailedAllRetries()); + retry.magicVariables.put(KarateUtils.EXECUTION_HISTORY_MAGIC_VARIABLE, executionPolicy); retry.run(); retry.featureRuntime.result.addResult(retry.result); finalResult = retry.result; diff --git a/dd-java-agent/instrumentation/karate/src/main/java/datadog/trace/instrumentation/karate/KarateTracingHook.java b/dd-java-agent/instrumentation/karate/src/main/java/datadog/trace/instrumentation/karate/KarateTracingHook.java index 36c49cda52d..f216316063b 100644 --- a/dd-java-agent/instrumentation/karate/src/main/java/datadog/trace/instrumentation/karate/KarateTracingHook.java +++ b/dd-java-agent/instrumentation/karate/src/main/java/datadog/trace/instrumentation/karate/KarateTracingHook.java @@ -19,7 +19,7 @@ import datadog.trace.api.civisibility.config.TestSourceData; import datadog.trace.api.civisibility.events.TestDescriptor; import datadog.trace.api.civisibility.events.TestSuiteDescriptor; -import datadog.trace.api.civisibility.telemetry.tag.RetryReason; +import datadog.trace.api.civisibility.execution.TestExecutionHistory; import datadog.trace.api.civisibility.telemetry.tag.SkipReason; import datadog.trace.api.civisibility.telemetry.tag.TestFrameworkInstrumentation; import datadog.trace.bootstrap.ContextStore; @@ -144,10 +144,6 @@ public boolean beforeScenario(ScenarioRuntime sr) { parameters, categories, TestSourceData.UNKNOWN, - (RetryReason) sr.magicVariables.get(KarateUtils.RETRY_MAGIC_VARIABLE), - (Boolean) - sr.magicVariables.getOrDefault( - KarateUtils.HAS_FAILED_ALL_RETRIES_MAGIC_VARIABLE, Boolean.FALSE), null); return true; } @@ -165,7 +161,11 @@ public void afterScenario(ScenarioRuntime sr) { } else if (result.getStepResults().isEmpty()) { TestEventsHandlerHolder.TEST_EVENTS_HANDLER.onTestSkip(testDescriptor, null); } - TestEventsHandlerHolder.TEST_EVENTS_HANDLER.onTestFinish(testDescriptor, null); + + TestExecutionHistory executionHistory = + (TestExecutionHistory) sr.magicVariables.get(KarateUtils.EXECUTION_HISTORY_MAGIC_VARIABLE); + TestEventsHandlerHolder.TEST_EVENTS_HANDLER.onTestFinish( + testDescriptor, null, executionHistory); Boolean runHooksManually = manualFeatureHooks.remove(sr.featureRuntime); if (runHooksManually != null && runHooksManually) { diff --git a/dd-java-agent/instrumentation/karate/src/main/java/datadog/trace/instrumentation/karate/KarateUtils.java b/dd-java-agent/instrumentation/karate/src/main/java/datadog/trace/instrumentation/karate/KarateUtils.java index acda6d26c3f..04691f95d5f 100644 --- a/dd-java-agent/instrumentation/karate/src/main/java/datadog/trace/instrumentation/karate/KarateUtils.java +++ b/dd-java-agent/instrumentation/karate/src/main/java/datadog/trace/instrumentation/karate/KarateUtils.java @@ -21,9 +21,7 @@ public abstract class KarateUtils { - public static final String RETRY_MAGIC_VARIABLE = "__datadog_retry"; - public static final String HAS_FAILED_ALL_RETRIES_MAGIC_VARIABLE = - "__datadog_has_failed_all_retries"; + public static final String EXECUTION_HISTORY_MAGIC_VARIABLE = "__datadog_execution_history"; private KarateUtils() {} diff --git a/dd-java-agent/instrumentation/scalatest/src/main/java/datadog/trace/instrumentation/scalatest/DatadogReporter.java b/dd-java-agent/instrumentation/scalatest/src/main/java/datadog/trace/instrumentation/scalatest/DatadogReporter.java index ba64c659f3e..c5734ac3c30 100644 --- a/dd-java-agent/instrumentation/scalatest/src/main/java/datadog/trace/instrumentation/scalatest/DatadogReporter.java +++ b/dd-java-agent/instrumentation/scalatest/src/main/java/datadog/trace/instrumentation/scalatest/DatadogReporter.java @@ -6,7 +6,7 @@ import datadog.trace.api.civisibility.events.TestDescriptor; import datadog.trace.api.civisibility.events.TestEventsHandler; import datadog.trace.api.civisibility.events.TestSuiteDescriptor; -import datadog.trace.api.civisibility.execution.TestExecutionPolicy; +import datadog.trace.api.civisibility.execution.TestExecutionHistory; import datadog.trace.api.civisibility.telemetry.tag.SkipReason; import datadog.trace.api.civisibility.telemetry.tag.TestFrameworkInstrumentation; import datadog.trace.instrumentation.scalatest.execution.SuppressedTestFailedException; @@ -145,7 +145,6 @@ private static void onTestStart(TestStarting event) { categories = Collections.emptyList(); } Class testClass = ScalatestUtils.getClass(event.suiteClassName()); - TestExecutionPolicy executionPolicy = context.popExecutionPolicy(testIdentifier); eventHandler.onTestStart( new TestSuiteDescriptor(testSuiteName, testClass), @@ -156,8 +155,6 @@ private static void onTestStart(TestStarting event) { testParameters, categories, new TestSourceData(testClass, null, null), - executionPolicy != null ? executionPolicy.currentExecutionRetryReason() : null, - executionPolicy != null && executionPolicy.hasFailedAllRetries(), null); } @@ -173,7 +170,11 @@ private static void onTestSuccess(TestSucceeded event) { String testParameters = null; TestDescriptor testDescriptor = new TestDescriptor(testSuiteName, testClass, testName, testParameters, testQualifier); - eventHandler.onTestFinish(testDescriptor, null); + + TestIdentifier testIdentifier = new TestIdentifier(testSuiteName, testName, null); + TestExecutionHistory executionHistory = context.popExecutionHistory(testIdentifier); + + eventHandler.onTestFinish(testDescriptor, null, executionHistory); } private static void onTestFailure(TestFailed event) { @@ -189,8 +190,12 @@ private static void onTestFailure(TestFailed event) { Throwable throwable = event.throwable().getOrElse(null); TestDescriptor testDescriptor = new TestDescriptor(testSuiteName, testClass, testName, testParameters, testQualifier); + + TestIdentifier testIdentifier = new TestIdentifier(testSuiteName, testName, null); + TestExecutionHistory executionHistory = context.popExecutionHistory(testIdentifier); + eventHandler.onTestFailure(testDescriptor, throwable); - eventHandler.onTestFinish(testDescriptor, null); + eventHandler.onTestFinish(testDescriptor, null, executionHistory); } private static void onTestIgnore(TestIgnored event) { @@ -240,7 +245,11 @@ private static void onTestCancel(TestCanceled event) { } else { eventHandler.onTestSkip(testDescriptor, reason); } - eventHandler.onTestFinish(testDescriptor, null); + + TestIdentifier testIdentifier = new TestIdentifier(testSuiteName, testName, null); + TestExecutionHistory executionHistory = context.popExecutionHistory(testIdentifier); + + eventHandler.onTestFinish(testDescriptor, null, executionHistory); } private static void onTestPending(TestPending event) { @@ -258,6 +267,10 @@ private static void onTestPending(TestPending event) { TestDescriptor testDescriptor = new TestDescriptor(testSuiteName, testClass, testName, testParameters, testQualifier); eventHandler.onTestSkip(testDescriptor, reason); - eventHandler.onTestFinish(testDescriptor, null); + + TestIdentifier testIdentifier = new TestIdentifier(testSuiteName, testName, null); + TestExecutionHistory executionHistory = context.popExecutionHistory(testIdentifier); + + eventHandler.onTestFinish(testDescriptor, null, executionHistory); } } diff --git a/dd-java-agent/instrumentation/scalatest/src/main/java/datadog/trace/instrumentation/scalatest/RunContext.java b/dd-java-agent/instrumentation/scalatest/src/main/java/datadog/trace/instrumentation/scalatest/RunContext.java index bce38d35c10..22ca2e8b05e 100644 --- a/dd-java-agent/instrumentation/scalatest/src/main/java/datadog/trace/instrumentation/scalatest/RunContext.java +++ b/dd-java-agent/instrumentation/scalatest/src/main/java/datadog/trace/instrumentation/scalatest/RunContext.java @@ -6,6 +6,7 @@ import datadog.trace.api.civisibility.events.TestDescriptor; import datadog.trace.api.civisibility.events.TestEventsHandler; import datadog.trace.api.civisibility.events.TestSuiteDescriptor; +import datadog.trace.api.civisibility.execution.TestExecutionHistory; import datadog.trace.api.civisibility.execution.TestExecutionPolicy; import datadog.trace.api.civisibility.telemetry.tag.SkipReason; import java.util.ArrayList; @@ -128,14 +129,14 @@ private boolean isItrUnskippable(TestIdentifier test, Map> t return testTags != null && testTags.contains(InstrumentationBridge.ITR_UNSKIPPABLE_TAG); } - public TestExecutionPolicy executionPolicy( + public TestExecutionPolicy getOrCreateExecutionPolicy( TestIdentifier testIdentifier, TestSourceData testSourceData) { return executionPolicies.computeIfAbsent( testIdentifier, test -> eventHandler.executionPolicy(test, testSourceData)); } @Nullable - public TestExecutionPolicy popExecutionPolicy(TestIdentifier testIdentifier) { + public TestExecutionHistory popExecutionHistory(TestIdentifier testIdentifier) { TestExecutionPolicy[] holder = new TestExecutionPolicy[1]; executionPolicies.computeIfPresent( testIdentifier, diff --git a/dd-java-agent/instrumentation/scalatest/src/main/java/datadog/trace/instrumentation/scalatest/execution/ScalatestExecutionInstrumentation.java b/dd-java-agent/instrumentation/scalatest/src/main/java/datadog/trace/instrumentation/scalatest/execution/ScalatestExecutionInstrumentation.java index a006bf757d0..dc054666c9c 100644 --- a/dd-java-agent/instrumentation/scalatest/src/main/java/datadog/trace/instrumentation/scalatest/execution/ScalatestExecutionInstrumentation.java +++ b/dd-java-agent/instrumentation/scalatest/src/main/java/datadog/trace/instrumentation/scalatest/execution/ScalatestExecutionInstrumentation.java @@ -87,7 +87,7 @@ public static void beforeTest( TestIdentifier testIdentifier = new TestIdentifier(suite.suiteId(), testName, null); TestSourceData testSourceData = new TestSourceData(suite.getClass(), null, null); TestExecutionPolicy executionPolicy = - context.executionPolicy(testIdentifier, testSourceData); + context.getOrCreateExecutionPolicy(testIdentifier, testSourceData); invokeWithFixture = new TestExecutionWrapper(invokeWithFixture, executionPolicy); } diff --git a/dd-java-agent/instrumentation/testng/src/main/java/datadog/trace/instrumentation/testng/TracingListener.java b/dd-java-agent/instrumentation/testng/src/main/java/datadog/trace/instrumentation/testng/TracingListener.java index 21e37383b41..eeefac8c484 100644 --- a/dd-java-agent/instrumentation/testng/src/main/java/datadog/trace/instrumentation/testng/TracingListener.java +++ b/dd-java-agent/instrumentation/testng/src/main/java/datadog/trace/instrumentation/testng/TracingListener.java @@ -2,7 +2,7 @@ import datadog.trace.api.civisibility.config.TestSourceData; import datadog.trace.api.civisibility.events.TestSuiteDescriptor; -import datadog.trace.api.civisibility.execution.TestExecutionPolicy; +import datadog.trace.api.civisibility.execution.TestExecutionHistory; import datadog.trace.api.civisibility.telemetry.tag.TestFrameworkInstrumentation; import datadog.trace.instrumentation.testng.execution.RetryAnalyzer; import java.util.List; @@ -83,7 +83,6 @@ public void onTestStart(final ITestResult result) { List groups = TestNGUtils.getGroups(result); TestSourceData testSourceData = TestNGUtils.toTestSourceData(result); - TestExecutionPolicy executionPolicy = executionPolicy(result); TestEventsHandlerHolder.TEST_EVENTS_HANDLER.onTestStart( suiteDescriptor, result, @@ -93,31 +92,31 @@ public void onTestStart(final ITestResult result) { testParameters, groups, testSourceData, - executionPolicy != null ? executionPolicy.currentExecutionRetryReason() : null, - executionPolicy != null && executionPolicy.hasFailedAllRetries(), null); } @Nullable - private TestExecutionPolicy executionPolicy(final ITestResult result) { + private TestExecutionHistory executionHistory(final ITestResult result) { IRetryAnalyzer retryAnalyzer = TestNGUtils.getRetryAnalyzer(result); if (retryAnalyzer instanceof RetryAnalyzer) { RetryAnalyzer datadogAnalyzer = (RetryAnalyzer) retryAnalyzer; - return datadogAnalyzer.getExecutionPolicy(); + return datadogAnalyzer.getExecutionHistory(); } return null; } @Override public void onTestSuccess(final ITestResult result) { - TestEventsHandlerHolder.TEST_EVENTS_HANDLER.onTestFinish(result, null); + TestExecutionHistory executionHistory = executionHistory(result); + TestEventsHandlerHolder.TEST_EVENTS_HANDLER.onTestFinish(result, null, executionHistory); } @Override public void onTestFailure(final ITestResult result) { Throwable throwable = result.getThrowable(); + TestExecutionHistory executionHistory = executionHistory(result); TestEventsHandlerHolder.TEST_EVENTS_HANDLER.onTestFailure(result, throwable); - TestEventsHandlerHolder.TEST_EVENTS_HANDLER.onTestFinish(result, null); + TestEventsHandlerHolder.TEST_EVENTS_HANDLER.onTestFinish(result, null, executionHistory); } @Override @@ -139,6 +138,7 @@ public void onTestSkipped(final ITestResult result) { String reason = throwable != null ? throwable.getMessage() : null; TestEventsHandlerHolder.TEST_EVENTS_HANDLER.onTestSkip(result, reason); } - TestEventsHandlerHolder.TEST_EVENTS_HANDLER.onTestFinish(result, null); + TestExecutionHistory executionHistory = executionHistory(result); + TestEventsHandlerHolder.TEST_EVENTS_HANDLER.onTestFinish(result, null, executionHistory); } } diff --git a/dd-java-agent/instrumentation/testng/src/main/java/datadog/trace/instrumentation/testng/execution/RetryAnalyzer.java b/dd-java-agent/instrumentation/testng/src/main/java/datadog/trace/instrumentation/testng/execution/RetryAnalyzer.java index c85b50a80c7..1fa64bbfb41 100644 --- a/dd-java-agent/instrumentation/testng/src/main/java/datadog/trace/instrumentation/testng/execution/RetryAnalyzer.java +++ b/dd-java-agent/instrumentation/testng/src/main/java/datadog/trace/instrumentation/testng/execution/RetryAnalyzer.java @@ -2,6 +2,7 @@ import datadog.trace.api.civisibility.config.TestIdentifier; import datadog.trace.api.civisibility.config.TestSourceData; +import datadog.trace.api.civisibility.execution.TestExecutionHistory; import datadog.trace.api.civisibility.execution.TestExecutionPolicy; import datadog.trace.instrumentation.testng.TestEventsHandlerHolder; import datadog.trace.instrumentation.testng.TestNGUtils; @@ -32,7 +33,7 @@ public boolean retry(ITestResult result) { result.isSuccess(), result.getEndMillis() - result.getStartMillis()); } - public TestExecutionPolicy getExecutionPolicy() { + public TestExecutionHistory getExecutionHistory() { return executionPolicy; } diff --git a/dd-java-agent/instrumentation/weaver/src/main/java/datadog/trace/instrumentation/weaver/DatadogWeaverReporter.java b/dd-java-agent/instrumentation/weaver/src/main/java/datadog/trace/instrumentation/weaver/DatadogWeaverReporter.java index 9e9cb78f68d..7a9837945fd 100644 --- a/dd-java-agent/instrumentation/weaver/src/main/java/datadog/trace/instrumentation/weaver/DatadogWeaverReporter.java +++ b/dd-java-agent/instrumentation/weaver/src/main/java/datadog/trace/instrumentation/weaver/DatadogWeaverReporter.java @@ -5,7 +5,7 @@ import datadog.trace.api.civisibility.events.TestDescriptor; import datadog.trace.api.civisibility.events.TestEventsHandler; import datadog.trace.api.civisibility.events.TestSuiteDescriptor; -import datadog.trace.api.civisibility.telemetry.tag.RetryReason; +import datadog.trace.api.civisibility.execution.TestExecutionHistory; import datadog.trace.api.civisibility.telemetry.tag.TestFrameworkInstrumentation; import datadog.trace.api.time.SystemTimeSource; import datadog.trace.util.AgentThreadFactory; @@ -92,7 +92,7 @@ public static void onTestFinished(TestFinished event, TaskDef taskDef) { new TestDescriptor(testSuiteName, testClass, testName, testParameters, testQualifier); String testMethodName = null; Method testMethod = null; - RetryReason retryReason = null; + TestExecutionHistory executionHistory = null; // Only test finish is reported, so fake test start timestamp long endMicros = SystemTimeSource.INSTANCE.getCurrentTimeMicros(); @@ -106,8 +106,6 @@ public static void onTestFinished(TestFinished event, TaskDef taskDef) { testParameters, categories, new TestSourceData(testClass, testMethod, testMethodName), - retryReason, - false, startMicros); if (testOutcome.result() instanceof Result.Ignored) { @@ -132,6 +130,6 @@ public static void onTestFinished(TestFinished event, TaskDef taskDef) { TEST_EVENTS_HANDLER.onTestFailure(testDescriptor, throwable); } - TEST_EVENTS_HANDLER.onTestFinish(testDescriptor, endMicros); + TEST_EVENTS_HANDLER.onTestFinish(testDescriptor, endMicros, executionHistory); } } diff --git a/internal-api/src/main/java/datadog/trace/api/civisibility/events/TestEventsHandler.java b/internal-api/src/main/java/datadog/trace/api/civisibility/events/TestEventsHandler.java index 7048e1c374a..4a4bb5d8d2b 100644 --- a/internal-api/src/main/java/datadog/trace/api/civisibility/events/TestEventsHandler.java +++ b/internal-api/src/main/java/datadog/trace/api/civisibility/events/TestEventsHandler.java @@ -4,8 +4,8 @@ import datadog.trace.api.civisibility.DDTestSuite; import datadog.trace.api.civisibility.config.TestIdentifier; import datadog.trace.api.civisibility.config.TestSourceData; +import datadog.trace.api.civisibility.execution.TestExecutionHistory; import datadog.trace.api.civisibility.execution.TestExecutionPolicy; -import datadog.trace.api.civisibility.telemetry.tag.RetryReason; import datadog.trace.api.civisibility.telemetry.tag.SkipReason; import datadog.trace.api.civisibility.telemetry.tag.TestFrameworkInstrumentation; import datadog.trace.bootstrap.ContextStore; @@ -52,10 +52,6 @@ void onTestSuiteStart( * case * @param categories test categories (or test tags) if the test case is marked with any * @param testSourceData metadata for locating the source code for the test case - * @param retryReason if this is a retry of the previously executed test case, the reason for - * retrying - * @param hasFailedAllRetries {@code true} if this test was executed multiple times, and all the - * executions failed * @param startTime the timestamp of the test execution start ({@code null} for current timestamp) */ void onTestStart( @@ -67,15 +63,16 @@ void onTestStart( @Nullable String testParameters, @Nullable Collection categories, @Nonnull TestSourceData testSourceData, - @Nullable RetryReason retryReason, - boolean hasFailedAllRetries, @Nullable Long startTime); void onTestSkip(TestKey descriptor, @Nullable String reason); void onTestFailure(TestKey descriptor, @Nullable Throwable throwable); - void onTestFinish(TestKey descriptor, @Nullable Long endTime); + void onTestFinish( + TestKey descriptor, + @Nullable Long endTime, + @Nullable TestExecutionHistory testExecutionHistory); void onTestIgnore( SuiteKey suiteDescriptor, diff --git a/internal-api/src/main/java/datadog/trace/api/civisibility/execution/TestExecutionHistory.java b/internal-api/src/main/java/datadog/trace/api/civisibility/execution/TestExecutionHistory.java new file mode 100644 index 00000000000..adeef1aa716 --- /dev/null +++ b/internal-api/src/main/java/datadog/trace/api/civisibility/execution/TestExecutionHistory.java @@ -0,0 +1,20 @@ +package datadog.trace.api.civisibility.execution; + +import datadog.trace.api.civisibility.telemetry.tag.RetryReason; +import javax.annotation.Nullable; + +public interface TestExecutionHistory { + + /** + * @return retry reason for current test execution ({@code null} if current execution is not a + * retry) + */ + @Nullable + RetryReason currentExecutionRetryReason(); + + /** + * @return {@code true} if the test has failed all retry attempts (only for policies that allow + * multiple retries) + */ + boolean hasFailedAllRetries(); +} diff --git a/internal-api/src/main/java/datadog/trace/api/civisibility/execution/TestExecutionPolicy.java b/internal-api/src/main/java/datadog/trace/api/civisibility/execution/TestExecutionPolicy.java index 01fceb6d9b9..5489a809548 100644 --- a/internal-api/src/main/java/datadog/trace/api/civisibility/execution/TestExecutionPolicy.java +++ b/internal-api/src/main/java/datadog/trace/api/civisibility/execution/TestExecutionPolicy.java @@ -1,9 +1,6 @@ package datadog.trace.api.civisibility.execution; -import datadog.trace.api.civisibility.telemetry.tag.RetryReason; -import javax.annotation.Nullable; - -public interface TestExecutionPolicy { +public interface TestExecutionPolicy extends TestExecutionHistory { /** * @return {@code true} if the next execution of the test will be altered in any way. This method @@ -25,17 +22,4 @@ public interface TestExecutionPolicy { * @return {@code true} if another execution of the same test should be done */ boolean retry(boolean successful, long durationMillis); - - /** - * @return retry reason for current test execution ({@code null} if current execution is not a - * retry) - */ - @Nullable - RetryReason currentExecutionRetryReason(); - - /** - * @return {@code true} if the test has failed all retry attempts (only for policies that allow - * multiple retries) - */ - boolean hasFailedAllRetries(); } From f5c4b8f301db9a5cc4108881f9d042aa35643e22 Mon Sep 17 00:00:00 2001 From: Nikita Tkachenko Date: Mon, 3 Feb 2025 14:49:14 +0100 Subject: [PATCH 4/5] Fix TestNG retry listener ordering problem --- .../events/NoOpTestEventsHandler.java | 3 ++- .../events/TestEventsHandlerImpl.java | 18 +++++++++++------- .../junit4/CucumberTracingListener.java | 3 ++- .../junit4/MUnitTracingListener.java | 4 +++- .../junit4/JUnit4TracingListener.java | 3 ++- .../junit5/CucumberTracingListener.java | 3 ++- .../junit5/SpockTracingListener.java | 3 ++- .../junit5/TracingListener.java | 3 ++- .../karate/KarateExecutionInstrumentation.java | 2 +- .../karate/KarateTracingHook.java | 5 +++-- .../instrumentation/karate/KarateUtils.java | 2 +- .../scalatest/DatadogReporter.java | 3 ++- .../instrumentation/scalatest/RunContext.java | 5 +++++ .../testng/TracingListener.java | 3 ++- .../weaver/DatadogWeaverReporter.java | 3 ++- .../civisibility/events/TestEventsHandler.java | 4 +++- 16 files changed, 45 insertions(+), 22 deletions(-) diff --git a/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/events/NoOpTestEventsHandler.java b/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/events/NoOpTestEventsHandler.java index 02bfe1aaca7..fc8b4613b82 100644 --- a/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/events/NoOpTestEventsHandler.java +++ b/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/events/NoOpTestEventsHandler.java @@ -58,7 +58,8 @@ public void onTestStart( @Nullable String testParameters, @Nullable Collection categories, @Nonnull TestSourceData testSourceData, - @Nullable Long startTime) { + @Nullable Long startTime, + @Nullable TestExecutionHistory testExecutionHistory) { // do nothing } diff --git a/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/events/TestEventsHandlerImpl.java b/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/events/TestEventsHandlerImpl.java index 553f172cb26..d5c9693e3dc 100644 --- a/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/events/TestEventsHandlerImpl.java +++ b/dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/events/TestEventsHandlerImpl.java @@ -140,7 +140,8 @@ public void onTestStart( final @Nullable String testParameters, final @Nullable Collection categories, final @Nonnull TestSourceData testSourceData, - final @Nullable Long startTime) { + final @Nullable Long startTime, + final @Nullable TestExecutionHistory testExecutionHistory) { if (skipTrace(testSourceData.getTestClass())) { return; } @@ -170,6 +171,14 @@ public void onTestStart( test.setTag(Tags.TEST_MANAGEMENT_IS_QUARANTINED, true); } + if (testExecutionHistory != null) { + RetryReason retryReason = testExecutionHistory.currentExecutionRetryReason(); + if (retryReason != null) { + test.setTag(Tags.TEST_IS_RETRY, true); + test.setTag(Tags.TEST_RETRY_REASON, retryReason); + } + } + if (testFramework != null) { test.setTag(Tags.TEST_FRAMEWORK, testFramework); if (testFrameworkVersion != null) { @@ -237,12 +246,6 @@ public void onTestFinish( } if (testExecutionHistory != null) { - RetryReason retryReason = testExecutionHistory.currentExecutionRetryReason(); - if (retryReason != null) { - test.setTag(Tags.TEST_IS_RETRY, true); - test.setTag(Tags.TEST_RETRY_REASON, retryReason); - } - if (test.hasFailed() && testExecutionHistory.hasFailedAllRetries()) { test.setTag(Tags.TEST_HAS_FAILED_ALL_RETRIES, true); } @@ -271,6 +274,7 @@ public void onTestIgnore( testParameters, categories, testSourceData, + null, null); onTestSkip(testDescriptor, reason); onTestFinish(testDescriptor, null, null); diff --git a/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/main/java/datadog/trace/instrumentation/junit4/CucumberTracingListener.java b/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/main/java/datadog/trace/instrumentation/junit4/CucumberTracingListener.java index 6e7d36f4300..4de59bbef9b 100644 --- a/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/main/java/datadog/trace/instrumentation/junit4/CucumberTracingListener.java +++ b/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/main/java/datadog/trace/instrumentation/junit4/CucumberTracingListener.java @@ -80,7 +80,8 @@ public void testStarted(final Description description) { null, categories, TestSourceData.UNKNOWN, - null); + null, + executionHistories.get(description)); recordFeatureFileCodeCoverage(description); } diff --git a/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/main/java/datadog/trace/instrumentation/junit4/MUnitTracingListener.java b/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/main/java/datadog/trace/instrumentation/junit4/MUnitTracingListener.java index c5a7fea7704..56814b0a8b2 100644 --- a/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/main/java/datadog/trace/instrumentation/junit4/MUnitTracingListener.java +++ b/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/main/java/datadog/trace/instrumentation/junit4/MUnitTracingListener.java @@ -85,7 +85,8 @@ public void testStarted(final Description description) { null, categories, JUnit4Utils.toTestSourceData(description), - null); + null, + executionHistories.get(description)); } @Override @@ -160,6 +161,7 @@ public void testIgnored(final Description description) { null, categories, JUnit4Utils.toTestSourceData(description), + null, null); } TestEventsHandlerHolder.TEST_EVENTS_HANDLER.onTestSkip(testDescriptor, null); diff --git a/dd-java-agent/instrumentation/junit-4.10/src/main/java/datadog/trace/instrumentation/junit4/JUnit4TracingListener.java b/dd-java-agent/instrumentation/junit-4.10/src/main/java/datadog/trace/instrumentation/junit4/JUnit4TracingListener.java index cf06034c701..db57d2af4f1 100644 --- a/dd-java-agent/instrumentation/junit-4.10/src/main/java/datadog/trace/instrumentation/junit4/JUnit4TracingListener.java +++ b/dd-java-agent/instrumentation/junit-4.10/src/main/java/datadog/trace/instrumentation/junit4/JUnit4TracingListener.java @@ -84,7 +84,8 @@ public void testStarted(final Description description) { testParameters, categories, testSourceData, - null); + null, + executionHistories.get(description)); } @Override diff --git a/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/main/java/datadog/trace/instrumentation/junit5/CucumberTracingListener.java b/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/main/java/datadog/trace/instrumentation/junit5/CucumberTracingListener.java index 6ad4b1c62c4..381de8066a7 100644 --- a/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/main/java/datadog/trace/instrumentation/junit5/CucumberTracingListener.java +++ b/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/main/java/datadog/trace/instrumentation/junit5/CucumberTracingListener.java @@ -124,7 +124,8 @@ private void testResourceExecutionStarted( null, tags, TestSourceData.UNKNOWN, - null); + null, + TestEventsHandlerHolder.getExecutionHistory(testDescriptor)); CoveragePerTestBridge.recordCoverage(classpathResourceName); } diff --git a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/main/java/datadog/trace/instrumentation/junit5/SpockTracingListener.java b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/main/java/datadog/trace/instrumentation/junit5/SpockTracingListener.java index 18ec1f2610a..449ee106326 100644 --- a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/main/java/datadog/trace/instrumentation/junit5/SpockTracingListener.java +++ b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/main/java/datadog/trace/instrumentation/junit5/SpockTracingListener.java @@ -125,7 +125,8 @@ private void testMethodExecutionStarted(TestDescriptor testDescriptor, MethodSou testParameters, tags, testSourceData, - null); + null, + TestEventsHandlerHolder.getExecutionHistory(testDescriptor)); } private void testCaseExecutionFinished( diff --git a/dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/TracingListener.java b/dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/TracingListener.java index eaa73ce2773..32874780b13 100644 --- a/dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/TracingListener.java +++ b/dd-java-agent/instrumentation/junit-5.3/src/main/java/datadog/trace/instrumentation/junit5/TracingListener.java @@ -125,7 +125,8 @@ private void testMethodExecutionStarted(TestDescriptor testDescriptor, MethodSou testParameters, tags, testSourceData, - null); + null, + TestEventsHandlerHolder.getExecutionHistory(testDescriptor)); } private void testCaseExecutionFinished( diff --git a/dd-java-agent/instrumentation/karate/src/main/java/datadog/trace/instrumentation/karate/KarateExecutionInstrumentation.java b/dd-java-agent/instrumentation/karate/src/main/java/datadog/trace/instrumentation/karate/KarateExecutionInstrumentation.java index 5e2304fa082..6f02d49d039 100644 --- a/dd-java-agent/instrumentation/karate/src/main/java/datadog/trace/instrumentation/karate/KarateExecutionInstrumentation.java +++ b/dd-java-agent/instrumentation/karate/src/main/java/datadog/trace/instrumentation/karate/KarateExecutionInstrumentation.java @@ -104,7 +104,7 @@ public static void afterExecute(@Advice.This ScenarioRuntime scenarioRuntime) { while (executionPolicy.retry(!context.getAndResetFailed(), duration)) { ScenarioRuntime retry = new ScenarioRuntime(scenarioRuntime.featureRuntime, scenarioRuntime.scenario); - retry.magicVariables.put(KarateUtils.EXECUTION_HISTORY_MAGIC_VARIABLE, executionPolicy); + retry.magicVariables.put(KarateUtils.EXECUTION_HISTORY_MAGICVARIABLE, executionPolicy); retry.run(); retry.featureRuntime.result.addResult(retry.result); finalResult = retry.result; diff --git a/dd-java-agent/instrumentation/karate/src/main/java/datadog/trace/instrumentation/karate/KarateTracingHook.java b/dd-java-agent/instrumentation/karate/src/main/java/datadog/trace/instrumentation/karate/KarateTracingHook.java index f216316063b..475fc0f9166 100644 --- a/dd-java-agent/instrumentation/karate/src/main/java/datadog/trace/instrumentation/karate/KarateTracingHook.java +++ b/dd-java-agent/instrumentation/karate/src/main/java/datadog/trace/instrumentation/karate/KarateTracingHook.java @@ -144,7 +144,8 @@ public boolean beforeScenario(ScenarioRuntime sr) { parameters, categories, TestSourceData.UNKNOWN, - null); + null, + (TestExecutionHistory) sr.magicVariables.get(KarateUtils.EXECUTION_HISTORY_MAGICVARIABLE)); return true; } @@ -163,7 +164,7 @@ public void afterScenario(ScenarioRuntime sr) { } TestExecutionHistory executionHistory = - (TestExecutionHistory) sr.magicVariables.get(KarateUtils.EXECUTION_HISTORY_MAGIC_VARIABLE); + (TestExecutionHistory) sr.magicVariables.get(KarateUtils.EXECUTION_HISTORY_MAGICVARIABLE); TestEventsHandlerHolder.TEST_EVENTS_HANDLER.onTestFinish( testDescriptor, null, executionHistory); diff --git a/dd-java-agent/instrumentation/karate/src/main/java/datadog/trace/instrumentation/karate/KarateUtils.java b/dd-java-agent/instrumentation/karate/src/main/java/datadog/trace/instrumentation/karate/KarateUtils.java index 04691f95d5f..d96697a2c63 100644 --- a/dd-java-agent/instrumentation/karate/src/main/java/datadog/trace/instrumentation/karate/KarateUtils.java +++ b/dd-java-agent/instrumentation/karate/src/main/java/datadog/trace/instrumentation/karate/KarateUtils.java @@ -21,7 +21,7 @@ public abstract class KarateUtils { - public static final String EXECUTION_HISTORY_MAGIC_VARIABLE = "__datadog_execution_history"; + public static final String EXECUTION_HISTORY_MAGICVARIABLE = "__datadog_execution_history"; private KarateUtils() {} diff --git a/dd-java-agent/instrumentation/scalatest/src/main/java/datadog/trace/instrumentation/scalatest/DatadogReporter.java b/dd-java-agent/instrumentation/scalatest/src/main/java/datadog/trace/instrumentation/scalatest/DatadogReporter.java index c5734ac3c30..e8cae890252 100644 --- a/dd-java-agent/instrumentation/scalatest/src/main/java/datadog/trace/instrumentation/scalatest/DatadogReporter.java +++ b/dd-java-agent/instrumentation/scalatest/src/main/java/datadog/trace/instrumentation/scalatest/DatadogReporter.java @@ -155,7 +155,8 @@ private static void onTestStart(TestStarting event) { testParameters, categories, new TestSourceData(testClass, null, null), - null); + null, + context.popExecutionHistory(testIdentifier)); } private static void onTestSuccess(TestSucceeded event) { diff --git a/dd-java-agent/instrumentation/scalatest/src/main/java/datadog/trace/instrumentation/scalatest/RunContext.java b/dd-java-agent/instrumentation/scalatest/src/main/java/datadog/trace/instrumentation/scalatest/RunContext.java index 22ca2e8b05e..9d67dc38699 100644 --- a/dd-java-agent/instrumentation/scalatest/src/main/java/datadog/trace/instrumentation/scalatest/RunContext.java +++ b/dd-java-agent/instrumentation/scalatest/src/main/java/datadog/trace/instrumentation/scalatest/RunContext.java @@ -135,6 +135,11 @@ public TestExecutionPolicy getOrCreateExecutionPolicy( testIdentifier, test -> eventHandler.executionPolicy(test, testSourceData)); } + @Nullable + public TestExecutionHistory getExecutionHistory(TestIdentifier testIdentifier) { + return executionPolicies.get(testIdentifier); + } + @Nullable public TestExecutionHistory popExecutionHistory(TestIdentifier testIdentifier) { TestExecutionPolicy[] holder = new TestExecutionPolicy[1]; diff --git a/dd-java-agent/instrumentation/testng/src/main/java/datadog/trace/instrumentation/testng/TracingListener.java b/dd-java-agent/instrumentation/testng/src/main/java/datadog/trace/instrumentation/testng/TracingListener.java index eeefac8c484..6b131b2f250 100644 --- a/dd-java-agent/instrumentation/testng/src/main/java/datadog/trace/instrumentation/testng/TracingListener.java +++ b/dd-java-agent/instrumentation/testng/src/main/java/datadog/trace/instrumentation/testng/TracingListener.java @@ -92,7 +92,8 @@ public void onTestStart(final ITestResult result) { testParameters, groups, testSourceData, - null); + null, + executionHistory(result)); } @Nullable diff --git a/dd-java-agent/instrumentation/weaver/src/main/java/datadog/trace/instrumentation/weaver/DatadogWeaverReporter.java b/dd-java-agent/instrumentation/weaver/src/main/java/datadog/trace/instrumentation/weaver/DatadogWeaverReporter.java index 7a9837945fd..19b59a1370e 100644 --- a/dd-java-agent/instrumentation/weaver/src/main/java/datadog/trace/instrumentation/weaver/DatadogWeaverReporter.java +++ b/dd-java-agent/instrumentation/weaver/src/main/java/datadog/trace/instrumentation/weaver/DatadogWeaverReporter.java @@ -106,7 +106,8 @@ public static void onTestFinished(TestFinished event, TaskDef taskDef) { testParameters, categories, new TestSourceData(testClass, testMethod, testMethodName), - startMicros); + startMicros, + executionHistory); if (testOutcome.result() instanceof Result.Ignored) { Result.Ignored result = (Result.Ignored) testOutcome.result(); diff --git a/internal-api/src/main/java/datadog/trace/api/civisibility/events/TestEventsHandler.java b/internal-api/src/main/java/datadog/trace/api/civisibility/events/TestEventsHandler.java index 4a4bb5d8d2b..7f683c515e8 100644 --- a/internal-api/src/main/java/datadog/trace/api/civisibility/events/TestEventsHandler.java +++ b/internal-api/src/main/java/datadog/trace/api/civisibility/events/TestEventsHandler.java @@ -53,6 +53,7 @@ void onTestSuiteStart( * @param categories test categories (or test tags) if the test case is marked with any * @param testSourceData metadata for locating the source code for the test case * @param startTime the timestamp of the test execution start ({@code null} for current timestamp) + * @param testExecutionHistory the history of executions of this test case */ void onTestStart( SuiteKey suiteDescriptor, @@ -63,7 +64,8 @@ void onTestStart( @Nullable String testParameters, @Nullable Collection categories, @Nonnull TestSourceData testSourceData, - @Nullable Long startTime); + @Nullable Long startTime, + @Nullable TestExecutionHistory testExecutionHistory); void onTestSkip(TestKey descriptor, @Nullable String reason); From c80ed84ecc343410c96fb0df35292fb980241dd5 Mon Sep 17 00:00:00 2001 From: Nikita Tkachenko Date: Mon, 3 Feb 2025 15:28:36 +0100 Subject: [PATCH 5/5] Update test fixtures --- .../src/test/groovy/CucumberTest.groovy | 6 +- .../test-quarantined-failed-atr/events.ftl | 1 + .../test-quarantined-failed-efd/events.ftl | 1 + .../coverages.ftl | 8 + .../test-quarantined-failed-known/events.ftl | 148 +++++++++++++++++ .../test-quarantined-failed/events.ftl | 2 +- .../resources/test-retry-failure/events.ftl | 1 + .../events.ftl | 1 + .../src/test/groovy/MUnitTest.groovy | 6 +- .../test-quarantined-failed-atr/events.ftl | 1 + .../test-quarantined-failed-efd/events.ftl | 1 + .../coverages.ftl | 1 + .../test-quarantined-failed-known/events.ftl | 154 +++++++++++++++++ .../test-quarantined-failed/events.ftl | 2 +- .../resources/test-retry-failed/events.ftl | 1 + .../src/test/groovy/JUnit4Test.groovy | 6 +- .../events.ftl | 1 + .../test-quarantined-failed-atr/events.ftl | 1 + .../test-quarantined-failed-efd/events.ftl | 1 + .../coverages.ftl | 1 + .../test-quarantined-failed-known/events.ftl | 155 +++++++++++++++++ .../test-quarantined-failed/events.ftl | 2 +- .../resources/test-retry-failed/events.ftl | 1 + .../test-retry-parameterized/events.ftl | 1 + .../src/test/groovy/CucumberTest.groovy | 6 +- .../test-failed-then-succeed/events.ftl | 2 +- .../test-quarantined-failed-atr/events.ftl | 1 + .../test-quarantined-failed-efd/events.ftl | 1 + .../coverages.ftl | 8 + .../test-quarantined-failed-known/events.ftl | 148 +++++++++++++++++ .../test-quarantined-failed/events.ftl | 2 +- .../events.ftl | 1 + .../events.ftl | 1 + .../resources/test-retry-failed/events.ftl | 1 + .../src/test/groovy/SpockTest.groovy | 7 +- .../events.ftl | 1 + .../test-failed-then-succeed/events.ftl | 4 - .../src/test/resources/test-failed/events.ftl | 2 +- .../events.ftl | 2 - .../events.ftl | 2 - .../events.ftl | 2 - .../test-itr-skipping-spec-setup/events.ftl | 2 - .../resources/test-itr-skipping/events.ftl | 1 - .../test-itr-unskippable-suite/events.ftl | 1 - .../resources/test-itr-unskippable/events.ftl | 1 - .../events.ftl | 6 +- .../test-quarantined-failed-atr/events.ftl | 6 +- .../test-quarantined-failed-efd/events.ftl | 1 + .../coverages.ftl | 1 + .../test-quarantined-failed-known/events.ftl | 156 ++++++++++++++++++ .../events.ftl | 2 - .../test-quarantined-failed/events.ftl | 2 +- .../resources/test-retry-failed/events.ftl | 6 +- .../test-retry-parameterized/events.ftl | 7 +- .../test-succeed-impacted/events.ftl | 1 - .../test-succeed-parameterized/events.ftl | 2 - .../test/resources/test-succeed/events.ftl | 1 - .../src/test/groovy/JUnit5Test.groovy | 6 +- .../events.ftl | 1 + .../test-quarantined-failed-atr/events.ftl | 1 + .../test-quarantined-failed-efd/events.ftl | 1 + .../coverages.ftl | 1 + .../test-quarantined-failed-known/events.ftl | 156 ++++++++++++++++++ .../test-quarantined-failed/events.ftl | 2 +- .../resources/test-retry-factory/events.ftl | 1 + .../resources/test-retry-failed/events.ftl | 1 + .../test-retry-parameterized/events.ftl | 2 + .../resources/test-retry-template/events.ftl | 1 + .../resources/test-retry-failed/events.ftl | 1 + .../test-retry-parameterized/events.ftl | 1 + .../scalatest/DatadogReporter.java | 2 +- .../src/test/groovy/ScalatestTest.groovy | 6 +- .../test-quarantined-failed-atr/events.ftl | 1 + .../test-quarantined-failed-efd/events.ftl | 1 + .../coverages.ftl | 1 + .../test-quarantined-failed-known/events.ftl | 153 +++++++++++++++++ .../test-quarantined-failed/events.ftl | 2 +- .../resources/test-retry-failed/events.ftl | 1 + .../test-retry-parameterized/events.ftl | 1 + .../instrumentation/testng/TestNGTest.groovy | 6 +- .../events.ftl | 1 + .../test-quarantined-failed-7/events.ftl | 2 +- .../test-quarantined-failed-atr-7/events.ftl | 1 + .../test-quarantined-failed-efd/events.ftl | 1 + .../coverages.ftl | 1 + .../test-quarantined-failed-known/events.ftl | 156 ++++++++++++++++++ .../resources/test-retry-error/events.ftl | 1 + .../resources/test-retry-failed-7/events.ftl | 1 + .../test-retry-parameterized/events.ftl | 1 + 89 files changed, 1326 insertions(+), 78 deletions(-) create mode 100644 dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-quarantined-failed-known/coverages.ftl create mode 100644 dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-quarantined-failed-known/events.ftl create mode 100644 dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-quarantined-failed-known/coverages.ftl create mode 100644 dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-quarantined-failed-known/events.ftl create mode 100644 dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-quarantined-failed-known/coverages.ftl create mode 100644 dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-quarantined-failed-known/events.ftl create mode 100644 dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-quarantined-failed-known/coverages.ftl create mode 100644 dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-quarantined-failed-known/events.ftl create mode 100644 dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed-known/coverages.ftl create mode 100644 dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed-known/events.ftl create mode 100644 dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed-known/coverages.ftl create mode 100644 dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed-known/events.ftl create mode 100644 dd-java-agent/instrumentation/scalatest/src/test/resources/test-quarantined-failed-known/coverages.ftl create mode 100644 dd-java-agent/instrumentation/scalatest/src/test/resources/test-quarantined-failed-known/events.ftl create mode 100644 dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-known/coverages.ftl create mode 100644 dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-known/events.ftl diff --git a/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/groovy/CucumberTest.groovy b/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/groovy/CucumberTest.groovy index ee81affbf97..7ab44abc90d 100644 --- a/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/groovy/CucumberTest.groovy +++ b/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/groovy/CucumberTest.groovy @@ -138,13 +138,13 @@ class CucumberTest extends CiVisibilityInstrumentationTest { assertSpansData(testcaseName) where: - testcaseName | features | quarantined | known - "test-quarantined-failed" | ["org/example/cucumber/calculator/basic_arithmetic_failed.feature"] | [ + testcaseName | features | quarantined | known + "test-quarantined-failed-known" | ["org/example/cucumber/calculator/basic_arithmetic_failed.feature"] | [ new TestIdentifier("classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic", "Addition", null) ] | [ new TestIdentifier("classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic", "Addition", null) ] - "test-quarantined-failed-efd" | ["org/example/cucumber/calculator/basic_arithmetic_failed.feature"] | [ + "test-quarantined-failed-efd" | ["org/example/cucumber/calculator/basic_arithmetic_failed.feature"] | [ new TestIdentifier("classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic", "Addition", null) ] | [] } diff --git a/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-quarantined-failed-atr/events.ftl b/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-quarantined-failed-atr/events.ftl index 0d01488f22f..f1393968ce4 100644 --- a/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-quarantined-failed-atr/events.ftl +++ b/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-quarantined-failed-atr/events.ftl @@ -243,6 +243,7 @@ "span.kind" : "test", "test.framework" : "cucumber", "test.framework_version" : ${content_meta_test_framework_version}, + "test.has_failed_all_retries" : "true", "test.is_retry" : "true", "test.management.is_quarantined" : "true", "test.module" : "cucumber-junit-4", diff --git a/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-quarantined-failed-efd/events.ftl b/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-quarantined-failed-efd/events.ftl index d4c17a0458c..fa19404348d 100644 --- a/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-quarantined-failed-efd/events.ftl +++ b/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-quarantined-failed-efd/events.ftl @@ -147,6 +147,7 @@ "span.kind" : "test", "test.framework" : "cucumber", "test.framework_version" : ${content_meta_test_framework_version}, + "test.has_failed_all_retries" : "true", "test.is_new" : "true", "test.is_retry" : "true", "test.management.is_quarantined" : "true", diff --git a/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-quarantined-failed-known/coverages.ftl b/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-quarantined-failed-known/coverages.ftl new file mode 100644 index 00000000000..e48f884bdbe --- /dev/null +++ b/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-quarantined-failed-known/coverages.ftl @@ -0,0 +1,8 @@ +[ { + "files" : [ { + "filename" : "org/example/cucumber/calculator/basic_arithmetic_failed.feature" + } ], + "span_id" : ${content_span_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id} +} ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-quarantined-failed-known/events.ftl b/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-quarantined-failed-known/events.ftl new file mode 100644 index 00000000000..ac1976f8ed8 --- /dev/null +++ b/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-quarantined-failed-known/events.ftl @@ -0,0 +1,148 @@ +[ { + "content" : { + "duration" : ${content_duration}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "library_version" : ${content_meta_library_version}, + "span.kind" : "test_suite_end", + "test.framework" : "cucumber", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "cucumber-junit-4", + "test.status" : "fail", + "test.suite" : "classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count} + }, + "name" : "junit.test_suite", + "resource" : "classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id} + }, + "type" : "test_suite_end", + "version" : 1 +}, { + "content" : { + "duration" : ${content_duration_2}, + "error" : 1, + "meta" : { + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack}, + "error.type" : "java.lang.AssertionError", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test", + "test.framework" : "cucumber", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.management.is_quarantined" : "true", + "test.module" : "cucumber-junit-4", + "test.name" : "Addition", + "test.status" : "fail", + "test.suite" : "classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic", + "test.traits" : "{\"category\":[\"foo\"]}", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_2}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "junit.test", + "parent_id" : ${content_parent_id}, + "resource" : "classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic.Addition", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id}, + "start" : ${content_start_2}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_3}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_2}, + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test_session_end", + "test.command" : "cucumber-junit-4", + "test.early_flake.enabled" : "true", + "test.framework" : "cucumber", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.status" : "fail", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_3}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "junit.test_session", + "resource" : "cucumber-junit-4", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_3}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_session_end", + "version" : 1 +}, { + "content" : { + "duration" : ${content_duration_4}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_3}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "library_version" : ${content_meta_library_version}, + "span.kind" : "test_module_end", + "test.early_flake.enabled" : "true", + "test.framework" : "cucumber", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "cucumber-junit-4", + "test.status" : "fail", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_4} + }, + "name" : "junit.test_module", + "resource" : "cucumber-junit-4", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_4}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_module_end", + "version" : 1 +} ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-quarantined-failed/events.ftl b/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-quarantined-failed/events.ftl index 8645e3118df..962da0e4e21 100644 --- a/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-quarantined-failed/events.ftl +++ b/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-quarantined-failed/events.ftl @@ -143,4 +143,4 @@ }, "type" : "test_module_end", "version" : 1 -} ] +} ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-retry-failure/events.ftl b/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-retry-failure/events.ftl index a28cbaf5b8a..e68e6daa057 100644 --- a/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-retry-failure/events.ftl +++ b/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-retry-failure/events.ftl @@ -239,6 +239,7 @@ "span.kind" : "test", "test.framework" : "cucumber", "test.framework_version" : ${content_meta_test_framework_version}, + "test.has_failed_all_retries" : "true", "test.is_retry" : "true", "test.module" : "cucumber-junit-4", "test.name" : "Addition", diff --git a/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-retry-scenario-outline-5.4.0/events.ftl b/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-retry-scenario-outline-5.4.0/events.ftl index 7499518a591..5d05ced5b68 100644 --- a/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-retry-scenario-outline-5.4.0/events.ftl +++ b/dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-retry-scenario-outline-5.4.0/events.ftl @@ -325,6 +325,7 @@ "span.kind" : "test", "test.framework" : "cucumber", "test.framework_version" : ${content_meta_test_framework_version}, + "test.has_failed_all_retries" : "true", "test.is_retry" : "true", "test.module" : "cucumber-junit-4", "test.name" : "Many additions", diff --git a/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/groovy/MUnitTest.groovy b/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/groovy/MUnitTest.groovy index bef5f160b14..ab757fcdd80 100644 --- a/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/groovy/MUnitTest.groovy +++ b/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/groovy/MUnitTest.groovy @@ -122,9 +122,9 @@ class MUnitTest extends CiVisibilityInstrumentationTest { assertSpansData(testcaseName) where: - testcaseName | tests | quarantined | known - "test-quarantined-failed" | [TestFailedMUnit] | [new TestIdentifier("org.example.TestFailedMUnit", "Calculator.add", null)] | [new TestIdentifier("org.example.TestFailedMUnit", "Calculator.add", null)] - "test-quarantined-failed-efd" | [TestFailedMUnit] | [new TestIdentifier("org.example.TestFailedMUnit", "Calculator.add", null)] | [] + testcaseName | tests | quarantined | known + "test-quarantined-failed-known" | [TestFailedMUnit] | [new TestIdentifier("org.example.TestFailedMUnit", "Calculator.add", null)] | [new TestIdentifier("org.example.TestFailedMUnit", "Calculator.add", null)] + "test-quarantined-failed-efd" | [TestFailedMUnit] | [new TestIdentifier("org.example.TestFailedMUnit", "Calculator.add", null)] | [] } private void runTests(Collection> tests, boolean expectSuccess = true) { diff --git a/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-quarantined-failed-atr/events.ftl b/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-quarantined-failed-atr/events.ftl index b2c467b953b..04497596505 100644 --- a/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-quarantined-failed-atr/events.ftl +++ b/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-quarantined-failed-atr/events.ftl @@ -322,6 +322,7 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "munit", "test.framework_version" : ${content_meta_test_framework_version}, + "test.has_failed_all_retries" : "true", "test.is_retry" : "true", "test.management.is_quarantined" : "true", "test.module" : "munit-junit-4", diff --git a/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-quarantined-failed-efd/events.ftl b/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-quarantined-failed-efd/events.ftl index d51ce34dd3e..571e11423f8 100644 --- a/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-quarantined-failed-efd/events.ftl +++ b/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-quarantined-failed-efd/events.ftl @@ -224,6 +224,7 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "munit", "test.framework_version" : ${content_meta_test_framework_version}, + "test.has_failed_all_retries" : "true", "test.is_new" : "true", "test.is_retry" : "true", "test.management.is_quarantined" : "true", diff --git a/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-quarantined-failed-known/coverages.ftl b/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-quarantined-failed-known/coverages.ftl new file mode 100644 index 00000000000..8878e547a79 --- /dev/null +++ b/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-quarantined-failed-known/coverages.ftl @@ -0,0 +1 @@ +[ ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-quarantined-failed-known/events.ftl b/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-quarantined-failed-known/events.ftl new file mode 100644 index 00000000000..773f3cfd3f8 --- /dev/null +++ b/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-quarantined-failed-known/events.ftl @@ -0,0 +1,154 @@ +[ { + "content" : { + "duration" : ${content_duration}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid}, + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test_session_end", + "test.command" : "munit-junit-4", + "test.early_flake.enabled" : "true", + "test.framework" : "munit", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.status" : "fail", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "junit.test_session", + "resource" : "munit-junit-4", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_session_end", + "version" : 1 +}, { + "content" : { + "duration" : ${content_duration_2}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_2}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "library_version" : ${content_meta_library_version}, + "span.kind" : "test_module_end", + "test.early_flake.enabled" : "true", + "test.framework" : "munit", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "munit-junit-4", + "test.status" : "fail", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_2} + }, + "name" : "junit.test_module", + "resource" : "munit-junit-4", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_2}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_module_end", + "version" : 1 +}, { + "content" : { + "duration" : ${content_duration_3}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_3}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "library_version" : ${content_meta_library_version}, + "span.kind" : "test_suite_end", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "munit", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "munit-junit-4", + "test.source.file" : "dummy_source_path", + "test.status" : "fail", + "test.suite" : "org.example.TestFailedMUnit", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_3}, + "test.source.end" : 19, + "test.source.start" : 11 + }, + "name" : "junit.test_suite", + "resource" : "org.example.TestFailedMUnit", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_3}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id} + }, + "type" : "test_suite_end", + "version" : 1 +}, { + "content" : { + "duration" : ${content_duration_4}, + "error" : 1, + "meta" : { + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack}, + "error.type" : "munit.ComparisonFailException", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "munit", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.management.is_quarantined" : "true", + "test.module" : "munit-junit-4", + "test.name" : "Calculator.add", + "test.source.file" : "dummy_source_path", + "test.status" : "fail", + "test.suite" : "org.example.TestFailedMUnit", + "test.traits" : "{\"category\":[\"myTag\"]}", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_4}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "junit.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestFailedMUnit.Calculator.add", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id}, + "start" : ${content_start_4}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id} + }, + "type" : "test", + "version" : 2 +} ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-quarantined-failed/events.ftl b/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-quarantined-failed/events.ftl index 2b2523e4fe8..84feb9b6f22 100644 --- a/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-quarantined-failed/events.ftl +++ b/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-quarantined-failed/events.ftl @@ -149,4 +149,4 @@ }, "type" : "test", "version" : 2 -} ] +} ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-retry-failed/events.ftl b/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-retry-failed/events.ftl index 9824b20b206..ddd8c1d5e36 100644 --- a/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-retry-failed/events.ftl +++ b/dd-java-agent/instrumentation/junit-4.10/munit-junit-4/src/test/resources/test-retry-failed/events.ftl @@ -318,6 +318,7 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "munit", "test.framework_version" : ${content_meta_test_framework_version}, + "test.has_failed_all_retries" : "true", "test.is_retry" : "true", "test.module" : "munit-junit-4", "test.name" : "Calculator.add", diff --git a/dd-java-agent/instrumentation/junit-4.10/src/test/groovy/JUnit4Test.groovy b/dd-java-agent/instrumentation/junit-4.10/src/test/groovy/JUnit4Test.groovy index e3cc0cb86bd..54d352f7156 100644 --- a/dd-java-agent/instrumentation/junit-4.10/src/test/groovy/JUnit4Test.groovy +++ b/dd-java-agent/instrumentation/junit-4.10/src/test/groovy/JUnit4Test.groovy @@ -170,9 +170,9 @@ class JUnit4Test extends CiVisibilityInstrumentationTest { assertSpansData(testcaseName) where: - testcaseName | tests | quarantined | known - "test-quarantined-failed" | [TestFailed] | [new TestIdentifier("org.example.TestFailed", "test_failed", null)] | [new TestIdentifier("org.example.TestFailed", "test_failed", null)] - "test-quarantined-failed-efd" | [TestFailed] | [new TestIdentifier("org.example.TestFailed", "test_failed", null)] | [] + testcaseName | tests | quarantined | known + "test-quarantined-failed-known" | [TestFailed] | [new TestIdentifier("org.example.TestFailed", "test_failed", null)] | [new TestIdentifier("org.example.TestFailed", "test_failed", null)] + "test-quarantined-failed-efd" | [TestFailed] | [new TestIdentifier("org.example.TestFailed", "test_failed", null)] | [] } private void runTests(Collection> tests, boolean expectSuccess = true) { diff --git a/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-efd-faulty-session-threshold/events.ftl b/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-efd-faulty-session-threshold/events.ftl index 6c81c7fb448..183ebd55f7e 100644 --- a/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-efd-faulty-session-threshold/events.ftl +++ b/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-efd-faulty-session-threshold/events.ftl @@ -373,6 +373,7 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "junit4", "test.framework_version" : ${content_meta_test_framework_version}, + "test.has_failed_all_retries" : "true", "test.is_new" : "true", "test.is_retry" : "true", "test.module" : "junit-4.10", diff --git a/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-quarantined-failed-atr/events.ftl b/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-quarantined-failed-atr/events.ftl index b82c949ba2e..01e9eb9ba7c 100644 --- a/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-quarantined-failed-atr/events.ftl +++ b/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-quarantined-failed-atr/events.ftl @@ -325,6 +325,7 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "junit4", "test.framework_version" : ${content_meta_test_framework_version}, + "test.has_failed_all_retries" : "true", "test.is_retry" : "true", "test.management.is_quarantined" : "true", "test.module" : "junit-4.10", diff --git a/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-quarantined-failed-efd/events.ftl b/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-quarantined-failed-efd/events.ftl index 8531b99c004..f1b6e55176f 100644 --- a/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-quarantined-failed-efd/events.ftl +++ b/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-quarantined-failed-efd/events.ftl @@ -225,6 +225,7 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "junit4", "test.framework_version" : ${content_meta_test_framework_version}, + "test.has_failed_all_retries" : "true", "test.is_new" : "true", "test.is_retry" : "true", "test.management.is_quarantined" : "true", diff --git a/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-quarantined-failed-known/coverages.ftl b/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-quarantined-failed-known/coverages.ftl new file mode 100644 index 00000000000..8878e547a79 --- /dev/null +++ b/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-quarantined-failed-known/coverages.ftl @@ -0,0 +1 @@ +[ ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-quarantined-failed-known/events.ftl b/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-quarantined-failed-known/events.ftl new file mode 100644 index 00000000000..837ccef8468 --- /dev/null +++ b/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-quarantined-failed-known/events.ftl @@ -0,0 +1,155 @@ +[ { + "content" : { + "duration" : ${content_duration}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid}, + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test_session_end", + "test.command" : "junit-4.10", + "test.early_flake.enabled" : "true", + "test.framework" : "junit4", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.status" : "fail", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "junit.test_session", + "resource" : "junit-4.10", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_session_end", + "version" : 1 +}, { + "content" : { + "duration" : ${content_duration_2}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_2}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "library_version" : ${content_meta_library_version}, + "span.kind" : "test_module_end", + "test.early_flake.enabled" : "true", + "test.framework" : "junit4", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "junit-4.10", + "test.status" : "fail", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_2} + }, + "name" : "junit.test_module", + "resource" : "junit-4.10", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_2}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_module_end", + "version" : 1 +}, { + "content" : { + "duration" : ${content_duration_3}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_3}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "library_version" : ${content_meta_library_version}, + "span.kind" : "test_suite_end", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "junit4", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "junit-4.10", + "test.source.file" : "dummy_source_path", + "test.status" : "fail", + "test.suite" : "org.example.TestFailed", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_3}, + "test.source.end" : 19, + "test.source.start" : 11 + }, + "name" : "junit.test_suite", + "resource" : "org.example.TestFailed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_3}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id} + }, + "type" : "test_suite_end", + "version" : 1 +}, { + "content" : { + "duration" : ${content_duration_4}, + "error" : 1, + "meta" : { + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.stack" : ${content_meta_error_stack}, + "error.type" : "java.lang.AssertionError", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "junit4", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.management.is_quarantined" : "true", + "test.module" : "junit-4.10", + "test.name" : "test_failed", + "test.source.file" : "dummy_source_path", + "test.source.method" : "test_failed()V", + "test.status" : "fail", + "test.suite" : "org.example.TestFailed", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_4}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id}, + "test.source.end" : 18, + "test.source.start" : 12 + }, + "name" : "junit.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestFailed.test_failed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id}, + "start" : ${content_start_4}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id} + }, + "type" : "test", + "version" : 2 +} ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-quarantined-failed/events.ftl b/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-quarantined-failed/events.ftl index f44789bd26a..743ea4e0b55 100644 --- a/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-quarantined-failed/events.ftl +++ b/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-quarantined-failed/events.ftl @@ -150,4 +150,4 @@ }, "type" : "test", "version" : 2 -} ] +} ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-retry-failed/events.ftl b/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-retry-failed/events.ftl index d4d008f55a7..54ef0c228dc 100644 --- a/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-retry-failed/events.ftl +++ b/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-retry-failed/events.ftl @@ -321,6 +321,7 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "junit4", "test.framework_version" : ${content_meta_test_framework_version}, + "test.has_failed_all_retries" : "true", "test.is_retry" : "true", "test.module" : "junit-4.10", "test.name" : "test_failed", diff --git a/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-retry-parameterized/events.ftl b/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-retry-parameterized/events.ftl index 18c64db1fbd..e86722f0024 100644 --- a/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-retry-parameterized/events.ftl +++ b/dd-java-agent/instrumentation/junit-4.10/src/test/resources/test-retry-parameterized/events.ftl @@ -330,6 +330,7 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "junit4", "test.framework_version" : ${content_meta_test_framework_version}, + "test.has_failed_all_retries" : "true", "test.is_retry" : "true", "test.module" : "junit-4.10", "test.name" : "test_failed_parameterized", diff --git a/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/groovy/CucumberTest.groovy b/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/groovy/CucumberTest.groovy index f52b798eb4f..b57a0a52b4c 100644 --- a/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/groovy/CucumberTest.groovy +++ b/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/groovy/CucumberTest.groovy @@ -148,13 +148,13 @@ class CucumberTest extends CiVisibilityInstrumentationTest { assertSpansData(testcaseName) where: - testcaseName | features | quarantined | known - "test-quarantined-failed" | ["org/example/cucumber/calculator/basic_arithmetic_failed.feature"] | [ + testcaseName | features | quarantined | known + "test-quarantined-failed-known" | ["org/example/cucumber/calculator/basic_arithmetic_failed.feature"] | [ new TestIdentifier("classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic", "Addition", null) ] | [ new TestIdentifier("classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic", "Addition", null) ] - "test-quarantined-failed-efd" | ["org/example/cucumber/calculator/basic_arithmetic_failed.feature"] | [ + "test-quarantined-failed-efd" | ["org/example/cucumber/calculator/basic_arithmetic_failed.feature"] | [ new TestIdentifier("classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic", "Addition", null) ] | [] } diff --git a/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-failed-then-succeed/events.ftl b/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-failed-then-succeed/events.ftl index 45e54ef7fc9..d6f9898d3e3 100644 --- a/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-failed-then-succeed/events.ftl +++ b/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-failed-then-succeed/events.ftl @@ -233,4 +233,4 @@ }, "type" : "test_module_end", "version" : 1 -} ] +} ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-quarantined-failed-atr/events.ftl b/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-quarantined-failed-atr/events.ftl index 14858b6c7e7..d3b57289a18 100644 --- a/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-quarantined-failed-atr/events.ftl +++ b/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-quarantined-failed-atr/events.ftl @@ -243,6 +243,7 @@ "span.kind" : "test", "test.framework" : "cucumber", "test.framework_version" : ${content_meta_test_framework_version}, + "test.has_failed_all_retries" : "true", "test.is_retry" : "true", "test.management.is_quarantined" : "true", "test.module" : "cucumber-junit-5", diff --git a/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-quarantined-failed-efd/events.ftl b/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-quarantined-failed-efd/events.ftl index 86949c3073c..0aae442aa7b 100644 --- a/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-quarantined-failed-efd/events.ftl +++ b/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-quarantined-failed-efd/events.ftl @@ -147,6 +147,7 @@ "span.kind" : "test", "test.framework" : "cucumber", "test.framework_version" : ${content_meta_test_framework_version}, + "test.has_failed_all_retries" : "true", "test.is_new" : "true", "test.is_retry" : "true", "test.management.is_quarantined" : "true", diff --git a/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-quarantined-failed-known/coverages.ftl b/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-quarantined-failed-known/coverages.ftl new file mode 100644 index 00000000000..e48f884bdbe --- /dev/null +++ b/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-quarantined-failed-known/coverages.ftl @@ -0,0 +1,8 @@ +[ { + "files" : [ { + "filename" : "org/example/cucumber/calculator/basic_arithmetic_failed.feature" + } ], + "span_id" : ${content_span_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id} +} ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-quarantined-failed-known/events.ftl b/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-quarantined-failed-known/events.ftl new file mode 100644 index 00000000000..f128c440822 --- /dev/null +++ b/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-quarantined-failed-known/events.ftl @@ -0,0 +1,148 @@ +[ { + "content" : { + "duration" : ${content_duration}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "library_version" : ${content_meta_library_version}, + "span.kind" : "test_suite_end", + "test.framework" : "cucumber", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "cucumber-junit-5", + "test.status" : "fail", + "test.suite" : "classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count} + }, + "name" : "junit.test_suite", + "resource" : "classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id} + }, + "type" : "test_suite_end", + "version" : 1 +}, { + "content" : { + "duration" : ${content_duration_2}, + "error" : 1, + "meta" : { + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack}, + "error.type" : "java.lang.AssertionError", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test", + "test.framework" : "cucumber", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.management.is_quarantined" : "true", + "test.module" : "cucumber-junit-5", + "test.name" : "Addition", + "test.status" : "fail", + "test.suite" : "classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic", + "test.traits" : "{\"category\":[\"foo\"]}", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_2}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "junit.test", + "parent_id" : ${content_parent_id}, + "resource" : "classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic.Addition", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id}, + "start" : ${content_start_2}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_3}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_2}, + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test_session_end", + "test.command" : "cucumber-junit-5", + "test.early_flake.enabled" : "true", + "test.framework" : "cucumber", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.status" : "fail", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_3}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "junit.test_session", + "resource" : "cucumber-junit-5", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_3}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_session_end", + "version" : 1 +}, { + "content" : { + "duration" : ${content_duration_4}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_3}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "library_version" : ${content_meta_library_version}, + "span.kind" : "test_module_end", + "test.early_flake.enabled" : "true", + "test.framework" : "cucumber", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "cucumber-junit-5", + "test.status" : "fail", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_4} + }, + "name" : "junit.test_module", + "resource" : "cucumber-junit-5", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_4}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_module_end", + "version" : 1 +} ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-quarantined-failed/events.ftl b/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-quarantined-failed/events.ftl index a4084dc3282..94bee36a5bd 100644 --- a/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-quarantined-failed/events.ftl +++ b/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-quarantined-failed/events.ftl @@ -143,4 +143,4 @@ }, "type" : "test_module_end", "version" : 1 -} ] +} ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-retry-failed-scenario-outline-5.4.0/events.ftl b/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-retry-failed-scenario-outline-5.4.0/events.ftl index 04cab3cde63..b1c40e20884 100644 --- a/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-retry-failed-scenario-outline-5.4.0/events.ftl +++ b/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-retry-failed-scenario-outline-5.4.0/events.ftl @@ -239,6 +239,7 @@ "span.kind" : "test", "test.framework" : "cucumber", "test.framework_version" : ${content_meta_test_framework_version}, + "test.has_failed_all_retries" : "true", "test.is_retry" : "true", "test.module" : "cucumber-junit-5", "test.name" : "Many additions.Single digits.Example #1", diff --git a/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-retry-failed-scenario-outline-latest/events.ftl b/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-retry-failed-scenario-outline-latest/events.ftl index 4d5946a9922..6d2470d7706 100644 --- a/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-retry-failed-scenario-outline-latest/events.ftl +++ b/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-retry-failed-scenario-outline-latest/events.ftl @@ -239,6 +239,7 @@ "span.kind" : "test", "test.framework" : "cucumber", "test.framework_version" : ${content_meta_test_framework_version}, + "test.has_failed_all_retries" : "true", "test.is_retry" : "true", "test.module" : "cucumber-junit-5", "test.name" : "Many additions.Single digits.Example #1.1", diff --git a/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-retry-failed/events.ftl b/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-retry-failed/events.ftl index bb58917bee1..b09a96c433a 100644 --- a/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-retry-failed/events.ftl +++ b/dd-java-agent/instrumentation/junit-5.3/cucumber-junit-5/src/test/resources/test-retry-failed/events.ftl @@ -239,6 +239,7 @@ "span.kind" : "test", "test.framework" : "cucumber", "test.framework_version" : ${content_meta_test_framework_version}, + "test.has_failed_all_retries" : "true", "test.is_retry" : "true", "test.module" : "cucumber-junit-5", "test.name" : "Addition", diff --git a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/groovy/SpockTest.groovy b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/groovy/SpockTest.groovy index 0f1be0dd8ed..1f76fb7d93d 100644 --- a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/groovy/SpockTest.groovy +++ b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/groovy/SpockTest.groovy @@ -38,7 +38,6 @@ class SpockTest extends CiVisibilityInstrumentationTest { @Override void configurePreAgent() { super.configurePreAgent() - givenTestsOrder(CIConstants.FAIL_FAST_TEST_ORDER) } def "test #testcaseName"() { @@ -177,9 +176,9 @@ class SpockTest extends CiVisibilityInstrumentationTest { assertSpansData(testcaseName) where: - testcaseName | tests | quarantined | known - "test-quarantined-failed" | [TestFailedSpock] | [new TestIdentifier("org.example.TestFailedSpock", "test failed", null)] | [new TestIdentifier("org.example.TestFailedSpock", "test failed", null)] - "test-quarantined-failed-efd" | [TestFailedSpock] | [new TestIdentifier("org.example.TestFailedSpock", "test failed", null)] | [] + testcaseName | tests | quarantined | known + "test-quarantined-failed-known" | [TestFailedSpock] | [new TestIdentifier("org.example.TestFailedSpock", "test failed", null)] | [new TestIdentifier("org.example.TestFailedSpock", "test failed", null)] + "test-quarantined-failed-efd" | [TestFailedSpock] | [new TestIdentifier("org.example.TestFailedSpock", "test failed", null)] | [] } private static void runTests(List> classes, boolean expectSuccess = true) { diff --git a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-efd-faulty-session-threshold/events.ftl b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-efd-faulty-session-threshold/events.ftl index e49450e4e9f..53653b19bc6 100644 --- a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-efd-faulty-session-threshold/events.ftl +++ b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-efd-faulty-session-threshold/events.ftl @@ -206,6 +206,7 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "spock", "test.framework_version" : ${content_meta_test_framework_version}, + "test.has_failed_all_retries" : "true", "test.is_new" : "true", "test.is_retry" : "true", "test.module" : "spock-junit-5", diff --git a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-failed-then-succeed/events.ftl b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-failed-then-succeed/events.ftl index a2d98f91db4..7a8a09d7455 100644 --- a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-failed-then-succeed/events.ftl +++ b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-failed-then-succeed/events.ftl @@ -54,7 +54,6 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "spock", "test.framework_version" : ${content_meta_test_framework_version}, - "test.is_new" : "true", "test.module" : "spock-junit-5", "test.name" : "test failed then succeed", "test.source.file" : "dummy_source_path", @@ -105,7 +104,6 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "spock", "test.framework_version" : ${content_meta_test_framework_version}, - "test.is_new" : "true", "test.is_retry" : "true", "test.module" : "spock-junit-5", "test.name" : "test failed then succeed", @@ -158,7 +156,6 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "spock", "test.framework_version" : ${content_meta_test_framework_version}, - "test.is_new" : "true", "test.is_retry" : "true", "test.module" : "spock-junit-5", "test.name" : "test failed then succeed", @@ -208,7 +205,6 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "spock", "test.framework_version" : ${content_meta_test_framework_version}, - "test.is_new" : "true", "test.is_retry" : "true", "test.module" : "spock-junit-5", "test.name" : "test failed then succeed", diff --git a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-failed/events.ftl b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-failed/events.ftl index 139ab206207..84ce122f100 100644 --- a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-failed/events.ftl +++ b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-failed/events.ftl @@ -150,4 +150,4 @@ }, "type" : "test_module_end", "version" : 1 -} ] +} ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-itr-not-skipping-parameterized-spec-setup/events.ftl b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-itr-not-skipping-parameterized-spec-setup/events.ftl index 73d5bfb1432..3cc08985e18 100644 --- a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-itr-not-skipping-parameterized-spec-setup/events.ftl +++ b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-itr-not-skipping-parameterized-spec-setup/events.ftl @@ -52,7 +52,6 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "spock", "test.framework_version" : ${content_meta_test_framework_version}, - "test.is_new" : "true", "test.module" : "spock-junit-5", "test.name" : "test add 1 and 2", "test.parameters" : "{\"metadata\":{\"test_name\":\"test add 1 and 2\"}}", @@ -104,7 +103,6 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "spock", "test.framework_version" : ${content_meta_test_framework_version}, - "test.is_new" : "true", "test.module" : "spock-junit-5", "test.name" : "test add 4 and 4", "test.parameters" : "{\"metadata\":{\"test_name\":\"test add 4 and 4\"}}", diff --git a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-itr-not-skipping-spec-setup/events.ftl b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-itr-not-skipping-spec-setup/events.ftl index a01c50a6431..85ae2fefc79 100644 --- a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-itr-not-skipping-spec-setup/events.ftl +++ b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-itr-not-skipping-spec-setup/events.ftl @@ -52,7 +52,6 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "spock", "test.framework_version" : ${content_meta_test_framework_version}, - "test.is_new" : "true", "test.module" : "spock-junit-5", "test.name" : "test another success", "test.source.file" : "dummy_source_path", @@ -101,7 +100,6 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "spock", "test.framework_version" : ${content_meta_test_framework_version}, - "test.is_new" : "true", "test.module" : "spock-junit-5", "test.name" : "test success", "test.skip_reason" : "Skipped by Datadog Intelligent Test Runner", diff --git a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-itr-skipping-parameterized/events.ftl b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-itr-skipping-parameterized/events.ftl index b4dedf00899..26294a20d35 100644 --- a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-itr-skipping-parameterized/events.ftl +++ b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-itr-skipping-parameterized/events.ftl @@ -52,7 +52,6 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "spock", "test.framework_version" : ${content_meta_test_framework_version}, - "test.is_new" : "true", "test.module" : "spock-junit-5", "test.name" : "test add 1 and 2", "test.parameters" : "{\"metadata\":{\"test_name\":\"test add 1 and 2\"}}", @@ -104,7 +103,6 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "spock", "test.framework_version" : ${content_meta_test_framework_version}, - "test.is_new" : "true", "test.module" : "spock-junit-5", "test.name" : "test add 4 and 4", "test.parameters" : "{\"metadata\":{\"test_name\":\"test add 4 and 4\"}}", diff --git a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-itr-skipping-spec-setup/events.ftl b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-itr-skipping-spec-setup/events.ftl index 96bd7fc2b5a..87d0bcc6414 100644 --- a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-itr-skipping-spec-setup/events.ftl +++ b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-itr-skipping-spec-setup/events.ftl @@ -53,7 +53,6 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "spock", "test.framework_version" : ${content_meta_test_framework_version}, - "test.is_new" : "true", "test.module" : "spock-junit-5", "test.name" : "test another success", "test.skip_reason" : "Skipped by Datadog Intelligent Test Runner", @@ -104,7 +103,6 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "spock", "test.framework_version" : ${content_meta_test_framework_version}, - "test.is_new" : "true", "test.module" : "spock-junit-5", "test.name" : "test success", "test.skip_reason" : "Skipped by Datadog Intelligent Test Runner", diff --git a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-itr-skipping/events.ftl b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-itr-skipping/events.ftl index 8ee06f5da45..97962a20be1 100644 --- a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-itr-skipping/events.ftl +++ b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-itr-skipping/events.ftl @@ -53,7 +53,6 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "spock", "test.framework_version" : ${content_meta_test_framework_version}, - "test.is_new" : "true", "test.module" : "spock-junit-5", "test.name" : "test success", "test.skip_reason" : "Skipped by Datadog Intelligent Test Runner", diff --git a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-itr-unskippable-suite/events.ftl b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-itr-unskippable-suite/events.ftl index 9c2a86b0f44..97d2fe32a77 100644 --- a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-itr-unskippable-suite/events.ftl +++ b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-itr-unskippable-suite/events.ftl @@ -52,7 +52,6 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "spock", "test.framework_version" : ${content_meta_test_framework_version}, - "test.is_new" : "true", "test.itr.forced_run" : "true", "test.itr.unskippable" : "true", "test.module" : "spock-junit-5", diff --git a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-itr-unskippable/events.ftl b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-itr-unskippable/events.ftl index c2aba94ac5d..ebfdb0327a2 100644 --- a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-itr-unskippable/events.ftl +++ b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-itr-unskippable/events.ftl @@ -52,7 +52,6 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "spock", "test.framework_version" : ${content_meta_test_framework_version}, - "test.is_new" : "true", "test.itr.forced_run" : "true", "test.itr.unskippable" : "true", "test.module" : "spock-junit-5", diff --git a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-parameterized-failed-then-succeed/events.ftl b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-parameterized-failed-then-succeed/events.ftl index 2918bcb57f2..f3e18f05367 100644 --- a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-parameterized-failed-then-succeed/events.ftl +++ b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-parameterized-failed-then-succeed/events.ftl @@ -54,7 +54,6 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "spock", "test.framework_version" : ${content_meta_test_framework_version}, - "test.is_new" : "true", "test.module" : "spock-junit-5", "test.name" : "test add 1 and 2", "test.parameters" : "{\"metadata\":{\"test_name\":\"test add 1 and 2\"}}", @@ -106,7 +105,6 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "spock", "test.framework_version" : ${content_meta_test_framework_version}, - "test.is_new" : "true", "test.is_retry" : "true", "test.module" : "spock-junit-5", "test.name" : "test add 1 and 2", @@ -157,7 +155,6 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "spock", "test.framework_version" : ${content_meta_test_framework_version}, - "test.is_new" : "true", "test.is_retry" : "true", "test.module" : "spock-junit-5", "test.name" : "test add 1 and 2", @@ -208,7 +205,6 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "spock", "test.framework_version" : ${content_meta_test_framework_version}, - "test.is_new" : "true", "test.module" : "spock-junit-5", "test.name" : "test add 4 and 4", "test.parameters" : "{\"metadata\":{\"test_name\":\"test add 4 and 4\"}}", @@ -306,4 +302,4 @@ }, "type" : "test_module_end", "version" : 1 -} ] +} ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed-atr/events.ftl b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed-atr/events.ftl index 5be15c250ad..057e0af9afd 100644 --- a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed-atr/events.ftl +++ b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed-atr/events.ftl @@ -54,7 +54,6 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "spock", "test.framework_version" : ${content_meta_test_framework_version}, - "test.is_new" : "true", "test.management.is_quarantined" : "true", "test.module" : "spock-junit-5", "test.name" : "test failed", @@ -106,7 +105,6 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "spock", "test.framework_version" : ${content_meta_test_framework_version}, - "test.is_new" : "true", "test.is_retry" : "true", "test.management.is_quarantined" : "true", "test.module" : "spock-junit-5", @@ -160,7 +158,6 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "spock", "test.framework_version" : ${content_meta_test_framework_version}, - "test.is_new" : "true", "test.is_retry" : "true", "test.management.is_quarantined" : "true", "test.module" : "spock-junit-5", @@ -214,7 +211,6 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "spock", "test.framework_version" : ${content_meta_test_framework_version}, - "test.is_new" : "true", "test.is_retry" : "true", "test.management.is_quarantined" : "true", "test.module" : "spock-junit-5", @@ -268,7 +264,7 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "spock", "test.framework_version" : ${content_meta_test_framework_version}, - "test.is_new" : "true", + "test.has_failed_all_retries" : "true", "test.is_retry" : "true", "test.management.is_quarantined" : "true", "test.module" : "spock-junit-5", diff --git a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed-efd/events.ftl b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed-efd/events.ftl index 32a57334d0c..30fb242b205 100644 --- a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed-efd/events.ftl +++ b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed-efd/events.ftl @@ -160,6 +160,7 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "spock", "test.framework_version" : ${content_meta_test_framework_version}, + "test.has_failed_all_retries" : "true", "test.is_new" : "true", "test.is_retry" : "true", "test.management.is_quarantined" : "true", diff --git a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed-known/coverages.ftl b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed-known/coverages.ftl new file mode 100644 index 00000000000..8878e547a79 --- /dev/null +++ b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed-known/coverages.ftl @@ -0,0 +1 @@ +[ ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed-known/events.ftl b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed-known/events.ftl new file mode 100644 index 00000000000..10784161694 --- /dev/null +++ b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed-known/events.ftl @@ -0,0 +1,156 @@ +[ { + "content" : { + "duration" : ${content_duration}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "library_version" : ${content_meta_library_version}, + "span.kind" : "test_suite_end", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "spock", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "spock-junit-5", + "test.source.file" : "dummy_source_path", + "test.status" : "fail", + "test.suite" : "org.example.TestFailedSpock", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count}, + "test.source.end" : 19, + "test.source.start" : 11 + }, + "name" : "junit.test_suite", + "resource" : "org.example.TestFailedSpock", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id} + }, + "type" : "test_suite_end", + "version" : 1 +}, { + "content" : { + "duration" : ${content_duration_2}, + "error" : 1, + "meta" : { + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack}, + "error.type" : "org.spockframework.runtime.SpockComparisonFailure", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "spock", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.management.is_quarantined" : "true", + "test.module" : "spock-junit-5", + "test.name" : "test failed", + "test.source.file" : "dummy_source_path", + "test.source.method" : "test failed()V", + "test.status" : "fail", + "test.suite" : "org.example.TestFailedSpock", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_2}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id}, + "test.source.end" : 18, + "test.source.start" : 12 + }, + "name" : "junit.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestFailedSpock.test failed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id}, + "start" : ${content_start_2}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_3}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_2}, + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test_session_end", + "test.command" : "spock-junit-5", + "test.early_flake.enabled" : "true", + "test.framework" : "spock", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.status" : "fail", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_3}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "junit.test_session", + "resource" : "spock-junit-5", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_3}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_session_end", + "version" : 1 +}, { + "content" : { + "duration" : ${content_duration_4}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_3}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "library_version" : ${content_meta_library_version}, + "span.kind" : "test_module_end", + "test.early_flake.enabled" : "true", + "test.framework" : "spock", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "spock-junit-5", + "test.status" : "fail", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_4} + }, + "name" : "junit.test_module", + "resource" : "spock-junit-5", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_4}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_module_end", + "version" : 1 +} ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed-parameterized/events.ftl b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed-parameterized/events.ftl index 1cc899baf00..d09ffd910aa 100644 --- a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed-parameterized/events.ftl +++ b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed-parameterized/events.ftl @@ -51,7 +51,6 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "spock", "test.framework_version" : ${content_meta_test_framework_version}, - "test.is_new" : "true", "test.module" : "spock-junit-5", "test.name" : "test add 1 and 2", "test.parameters" : "{\"metadata\":{\"test_name\":\"test add 1 and 2\"}}", @@ -103,7 +102,6 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "spock", "test.framework_version" : ${content_meta_test_framework_version}, - "test.is_new" : "true", "test.management.is_quarantined" : "true", "test.module" : "spock-junit-5", "test.name" : "test add 4 and 4", diff --git a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed/events.ftl b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed/events.ftl index f26cd14e8ed..cb3f8597871 100644 --- a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed/events.ftl +++ b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-quarantined-failed/events.ftl @@ -151,4 +151,4 @@ }, "type" : "test_module_end", "version" : 1 -} ] +} ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-retry-failed/events.ftl b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-retry-failed/events.ftl index 494677c86bb..6450f0ea8ae 100644 --- a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-retry-failed/events.ftl +++ b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-retry-failed/events.ftl @@ -54,7 +54,6 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "spock", "test.framework_version" : ${content_meta_test_framework_version}, - "test.is_new" : "true", "test.module" : "spock-junit-5", "test.name" : "test failed", "test.source.file" : "dummy_source_path", @@ -105,7 +104,6 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "spock", "test.framework_version" : ${content_meta_test_framework_version}, - "test.is_new" : "true", "test.is_retry" : "true", "test.module" : "spock-junit-5", "test.name" : "test failed", @@ -158,7 +156,6 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "spock", "test.framework_version" : ${content_meta_test_framework_version}, - "test.is_new" : "true", "test.is_retry" : "true", "test.module" : "spock-junit-5", "test.name" : "test failed", @@ -211,7 +208,6 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "spock", "test.framework_version" : ${content_meta_test_framework_version}, - "test.is_new" : "true", "test.is_retry" : "true", "test.module" : "spock-junit-5", "test.name" : "test failed", @@ -264,7 +260,7 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "spock", "test.framework_version" : ${content_meta_test_framework_version}, - "test.is_new" : "true", + "test.has_failed_all_retries" : "true", "test.is_retry" : "true", "test.module" : "spock-junit-5", "test.name" : "test failed", diff --git a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-retry-parameterized/events.ftl b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-retry-parameterized/events.ftl index 2a2eee0b268..2339e2ab3b4 100644 --- a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-retry-parameterized/events.ftl +++ b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-retry-parameterized/events.ftl @@ -51,7 +51,6 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "spock", "test.framework_version" : ${content_meta_test_framework_version}, - "test.is_new" : "true", "test.module" : "spock-junit-5", "test.name" : "test add 1 and 2", "test.parameters" : "{\"metadata\":{\"test_name\":\"test add 1 and 2\"}}", @@ -103,7 +102,6 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "spock", "test.framework_version" : ${content_meta_test_framework_version}, - "test.is_new" : "true", "test.module" : "spock-junit-5", "test.name" : "test add 4 and 4", "test.parameters" : "{\"metadata\":{\"test_name\":\"test add 4 and 4\"}}", @@ -155,7 +153,6 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "spock", "test.framework_version" : ${content_meta_test_framework_version}, - "test.is_new" : "true", "test.is_retry" : "true", "test.module" : "spock-junit-5", "test.name" : "test add 4 and 4", @@ -209,7 +206,6 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "spock", "test.framework_version" : ${content_meta_test_framework_version}, - "test.is_new" : "true", "test.is_retry" : "true", "test.module" : "spock-junit-5", "test.name" : "test add 4 and 4", @@ -263,7 +259,6 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "spock", "test.framework_version" : ${content_meta_test_framework_version}, - "test.is_new" : "true", "test.is_retry" : "true", "test.module" : "spock-junit-5", "test.name" : "test add 4 and 4", @@ -317,7 +312,7 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "spock", "test.framework_version" : ${content_meta_test_framework_version}, - "test.is_new" : "true", + "test.has_failed_all_retries" : "true", "test.is_retry" : "true", "test.module" : "spock-junit-5", "test.name" : "test add 4 and 4", diff --git a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-succeed-impacted/events.ftl b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-succeed-impacted/events.ftl index 547148c6398..f01c1e4810f 100644 --- a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-succeed-impacted/events.ftl +++ b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-succeed-impacted/events.ftl @@ -52,7 +52,6 @@ "test.framework" : "spock", "test.framework_version" : ${content_meta_test_framework_version}, "test.is_modified" : "true", - "test.is_new" : "true", "test.module" : "spock-junit-5", "test.name" : "test success", "test.source.file" : "dummy_source_path", diff --git a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-succeed-parameterized/events.ftl b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-succeed-parameterized/events.ftl index 9006f98e3c8..c7787bca513 100644 --- a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-succeed-parameterized/events.ftl +++ b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-succeed-parameterized/events.ftl @@ -51,7 +51,6 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "spock", "test.framework_version" : ${content_meta_test_framework_version}, - "test.is_new" : "true", "test.module" : "spock-junit-5", "test.name" : "test add 1 and 2", "test.parameters" : "{\"metadata\":{\"test_name\":\"test add 1 and 2\"}}", @@ -100,7 +99,6 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "spock", "test.framework_version" : ${content_meta_test_framework_version}, - "test.is_new" : "true", "test.module" : "spock-junit-5", "test.name" : "test add 4 and 4", "test.parameters" : "{\"metadata\":{\"test_name\":\"test add 4 and 4\"}}", diff --git a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-succeed/events.ftl b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-succeed/events.ftl index 61f59ffe49b..fc90e7755ee 100644 --- a/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-succeed/events.ftl +++ b/dd-java-agent/instrumentation/junit-5.3/spock-junit-5/src/test/resources/test-succeed/events.ftl @@ -51,7 +51,6 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "spock", "test.framework_version" : ${content_meta_test_framework_version}, - "test.is_new" : "true", "test.module" : "spock-junit-5", "test.name" : "test success", "test.source.file" : "dummy_source_path", diff --git a/dd-java-agent/instrumentation/junit-5.3/src/test/groovy/JUnit5Test.groovy b/dd-java-agent/instrumentation/junit-5.3/src/test/groovy/JUnit5Test.groovy index fd639b78c2a..49225c3547b 100644 --- a/dd-java-agent/instrumentation/junit-5.3/src/test/groovy/JUnit5Test.groovy +++ b/dd-java-agent/instrumentation/junit-5.3/src/test/groovy/JUnit5Test.groovy @@ -208,9 +208,9 @@ class JUnit5Test extends CiVisibilityInstrumentationTest { assertSpansData(testcaseName) where: - testcaseName | tests | quarantined | known - "test-quarantined-failed" | [TestFailed] | [new TestIdentifier("org.example.TestFailed", "test_failed", null)] | [new TestIdentifier("org.example.TestFailed", "test_failed", null)] - "test-quarantined-failed-efd" | [TestFailed] | [new TestIdentifier("org.example.TestFailed", "test_failed", null)] | [] + testcaseName | tests | quarantined | known + "test-quarantined-failed-known" | [TestFailed] | [new TestIdentifier("org.example.TestFailed", "test_failed", null)] | [new TestIdentifier("org.example.TestFailed", "test_failed", null)] + "test-quarantined-failed-efd" | [TestFailed] | [new TestIdentifier("org.example.TestFailed", "test_failed", null)] | [] } protected void runTests(List> tests, boolean expectSuccess = true) { diff --git a/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-efd-faulty-session-threshold/events.ftl b/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-efd-faulty-session-threshold/events.ftl index 4ff48b32614..f79c95d1faa 100644 --- a/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-efd-faulty-session-threshold/events.ftl +++ b/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-efd-faulty-session-threshold/events.ftl @@ -376,6 +376,7 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "junit5", "test.framework_version" : ${content_meta_test_framework_version}, + "test.has_failed_all_retries" : "true", "test.is_new" : "true", "test.is_retry" : "true", "test.module" : "junit-5.3", diff --git a/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed-atr/events.ftl b/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed-atr/events.ftl index eea0791d003..4283b62ced7 100644 --- a/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed-atr/events.ftl +++ b/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed-atr/events.ftl @@ -330,6 +330,7 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "junit5", "test.framework_version" : ${content_meta_test_framework_version}, + "test.has_failed_all_retries" : "true", "test.is_retry" : "true", "test.management.is_quarantined" : "true", "test.module" : "junit-5.3", diff --git a/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed-efd/events.ftl b/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed-efd/events.ftl index ae65671fb1b..ee69490a5cc 100644 --- a/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed-efd/events.ftl +++ b/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed-efd/events.ftl @@ -228,6 +228,7 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "junit5", "test.framework_version" : ${content_meta_test_framework_version}, + "test.has_failed_all_retries" : "true", "test.is_new" : "true", "test.is_retry" : "true", "test.management.is_quarantined" : "true", diff --git a/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed-known/coverages.ftl b/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed-known/coverages.ftl new file mode 100644 index 00000000000..8878e547a79 --- /dev/null +++ b/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed-known/coverages.ftl @@ -0,0 +1 @@ +[ ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed-known/events.ftl b/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed-known/events.ftl new file mode 100644 index 00000000000..0681acfab8d --- /dev/null +++ b/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed-known/events.ftl @@ -0,0 +1,156 @@ +[ { + "content" : { + "duration" : ${content_duration}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid}, + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test_session_end", + "test.command" : "junit-5.3", + "test.early_flake.enabled" : "true", + "test.framework" : "junit5", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.status" : "fail", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "junit.test_session", + "resource" : "junit-5.3", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_session_end", + "version" : 1 +}, { + "content" : { + "duration" : ${content_duration_2}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_2}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "library_version" : ${content_meta_library_version}, + "span.kind" : "test_module_end", + "test.early_flake.enabled" : "true", + "test.framework" : "junit5", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "junit-5.3", + "test.status" : "fail", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_2} + }, + "name" : "junit.test_module", + "resource" : "junit-5.3", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_2}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_module_end", + "version" : 1 +}, { + "content" : { + "duration" : ${content_duration_3}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_3}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "library_version" : ${content_meta_library_version}, + "span.kind" : "test_suite_end", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "junit5", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "junit-5.3", + "test.source.file" : "dummy_source_path", + "test.status" : "fail", + "test.suite" : "org.example.TestFailed", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_3}, + "test.source.end" : 19, + "test.source.start" : 11 + }, + "name" : "junit.test_suite", + "resource" : "org.example.TestFailed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_3}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id} + }, + "type" : "test_suite_end", + "version" : 1 +}, { + "content" : { + "duration" : ${content_duration_4}, + "error" : 1, + "meta" : { + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "junit", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack}, + "error.type" : "org.opentest4j.AssertionFailedError", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "junit5", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.management.is_quarantined" : "true", + "test.module" : "junit-5.3", + "test.name" : "test_failed", + "test.source.file" : "dummy_source_path", + "test.source.method" : "test_failed()V", + "test.status" : "fail", + "test.suite" : "org.example.TestFailed", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_4}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id}, + "test.source.end" : 18, + "test.source.start" : 12 + }, + "name" : "junit.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestFailed.test_failed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id}, + "start" : ${content_start_4}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id} + }, + "type" : "test", + "version" : 2 +} ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed/events.ftl b/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed/events.ftl index 382f11791e1..6ba32d8dccb 100644 --- a/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed/events.ftl +++ b/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-quarantined-failed/events.ftl @@ -151,4 +151,4 @@ }, "type" : "test", "version" : 2 -} ] +} ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-retry-factory/events.ftl b/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-retry-factory/events.ftl index 1163e899b00..37f65270bfb 100644 --- a/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-retry-factory/events.ftl +++ b/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-retry-factory/events.ftl @@ -373,6 +373,7 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "junit5", "test.framework_version" : ${content_meta_test_framework_version}, + "test.has_failed_all_retries" : "true", "test.is_retry" : "true", "test.module" : "junit-5.3", "test.name" : "test_factory", diff --git a/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-retry-failed/events.ftl b/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-retry-failed/events.ftl index b789fefc1bf..853997bd35d 100644 --- a/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-retry-failed/events.ftl +++ b/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-retry-failed/events.ftl @@ -326,6 +326,7 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "junit5", "test.framework_version" : ${content_meta_test_framework_version}, + "test.has_failed_all_retries" : "true", "test.is_retry" : "true", "test.module" : "junit-5.3", "test.name" : "test_failed", diff --git a/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-retry-parameterized/events.ftl b/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-retry-parameterized/events.ftl index 5aa58f2784b..8abc10811e6 100644 --- a/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-retry-parameterized/events.ftl +++ b/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-retry-parameterized/events.ftl @@ -330,6 +330,7 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "junit5", "test.framework_version" : ${content_meta_test_framework_version}, + "test.has_failed_all_retries" : "true", "test.is_retry" : "true", "test.module" : "junit-5.3", "test.name" : "test_failed_parameterized", @@ -593,6 +594,7 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "junit5", "test.framework_version" : ${content_meta_test_framework_version}, + "test.has_failed_all_retries" : "true", "test.is_retry" : "true", "test.module" : "junit-5.3", "test.name" : "test_failed_parameterized", diff --git a/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-retry-template/events.ftl b/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-retry-template/events.ftl index 6a1200c7863..8f0e91f9c67 100644 --- a/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-retry-template/events.ftl +++ b/dd-java-agent/instrumentation/junit-5.3/src/test/resources/test-retry-template/events.ftl @@ -330,6 +330,7 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "junit5", "test.framework_version" : ${content_meta_test_framework_version}, + "test.has_failed_all_retries" : "true", "test.is_retry" : "true", "test.module" : "junit-5.3", "test.name" : "test_template", diff --git a/dd-java-agent/instrumentation/karate/src/test/resources/test-retry-failed/events.ftl b/dd-java-agent/instrumentation/karate/src/test/resources/test-retry-failed/events.ftl index 121cd6320ea..302be4e62e9 100644 --- a/dd-java-agent/instrumentation/karate/src/test/resources/test-retry-failed/events.ftl +++ b/dd-java-agent/instrumentation/karate/src/test/resources/test-retry-failed/events.ftl @@ -424,6 +424,7 @@ "span.kind" : "test", "test.framework" : "karate", "test.framework_version" : ${content_meta_test_framework_version}, + "test.has_failed_all_retries" : "true", "test.is_retry" : "true", "test.module" : "karate", "test.name" : "second scenario", diff --git a/dd-java-agent/instrumentation/karate/src/test/resources/test-retry-parameterized/events.ftl b/dd-java-agent/instrumentation/karate/src/test/resources/test-retry-parameterized/events.ftl index c895f305e1b..496351474e7 100644 --- a/dd-java-agent/instrumentation/karate/src/test/resources/test-retry-parameterized/events.ftl +++ b/dd-java-agent/instrumentation/karate/src/test/resources/test-retry-parameterized/events.ftl @@ -674,6 +674,7 @@ "span.kind" : "test", "test.framework" : "karate", "test.framework_version" : ${content_meta_test_framework_version}, + "test.has_failed_all_retries" : "true", "test.is_retry" : "true", "test.module" : "karate", "test.name" : "first scenario as an outline", diff --git a/dd-java-agent/instrumentation/scalatest/src/main/java/datadog/trace/instrumentation/scalatest/DatadogReporter.java b/dd-java-agent/instrumentation/scalatest/src/main/java/datadog/trace/instrumentation/scalatest/DatadogReporter.java index e8cae890252..b6db8da856c 100644 --- a/dd-java-agent/instrumentation/scalatest/src/main/java/datadog/trace/instrumentation/scalatest/DatadogReporter.java +++ b/dd-java-agent/instrumentation/scalatest/src/main/java/datadog/trace/instrumentation/scalatest/DatadogReporter.java @@ -156,7 +156,7 @@ private static void onTestStart(TestStarting event) { categories, new TestSourceData(testClass, null, null), null, - context.popExecutionHistory(testIdentifier)); + context.getExecutionHistory(testIdentifier)); } private static void onTestSuccess(TestSucceeded event) { diff --git a/dd-java-agent/instrumentation/scalatest/src/test/groovy/ScalatestTest.groovy b/dd-java-agent/instrumentation/scalatest/src/test/groovy/ScalatestTest.groovy index 6128765da7a..35f68295a2b 100644 --- a/dd-java-agent/instrumentation/scalatest/src/test/groovy/ScalatestTest.groovy +++ b/dd-java-agent/instrumentation/scalatest/src/test/groovy/ScalatestTest.groovy @@ -144,9 +144,9 @@ class ScalatestTest extends CiVisibilityInstrumentationTest { assertSpansData(testcaseName) where: - testcaseName | tests | quarantined | known - "test-quarantined-failed" | [TestFailed] | [new TestIdentifier("org.example.TestFailed", "Example.add adds two numbers", null)] | [new TestIdentifier("org.example.TestFailed", "Example.add adds two numbers", null)] - "test-quarantined-failed-efd" | [TestFailed] | [new TestIdentifier("org.example.TestFailed", "Example.add adds two numbers", null)] | [] + testcaseName | tests | quarantined | known + "test-quarantined-failed-known" | [TestFailed] | [new TestIdentifier("org.example.TestFailed", "Example.add adds two numbers", null)] | [new TestIdentifier("org.example.TestFailed", "Example.add adds two numbers", null)] + "test-quarantined-failed-efd" | [TestFailed] | [new TestIdentifier("org.example.TestFailed", "Example.add adds two numbers", null)] | [] } @Override diff --git a/dd-java-agent/instrumentation/scalatest/src/test/resources/test-quarantined-failed-atr/events.ftl b/dd-java-agent/instrumentation/scalatest/src/test/resources/test-quarantined-failed-atr/events.ftl index c5c24f827ed..6349dc54035 100644 --- a/dd-java-agent/instrumentation/scalatest/src/test/resources/test-quarantined-failed-atr/events.ftl +++ b/dd-java-agent/instrumentation/scalatest/src/test/resources/test-quarantined-failed-atr/events.ftl @@ -252,6 +252,7 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "scalatest", "test.framework_version" : ${content_meta_test_framework_version}, + "test.has_failed_all_retries" : "true", "test.is_retry" : "true", "test.management.is_quarantined" : "true", "test.module" : "scalatest", diff --git a/dd-java-agent/instrumentation/scalatest/src/test/resources/test-quarantined-failed-efd/events.ftl b/dd-java-agent/instrumentation/scalatest/src/test/resources/test-quarantined-failed-efd/events.ftl index 397094efa5c..d41a5052157 100644 --- a/dd-java-agent/instrumentation/scalatest/src/test/resources/test-quarantined-failed-efd/events.ftl +++ b/dd-java-agent/instrumentation/scalatest/src/test/resources/test-quarantined-failed-efd/events.ftl @@ -154,6 +154,7 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "scalatest", "test.framework_version" : ${content_meta_test_framework_version}, + "test.has_failed_all_retries" : "true", "test.is_new" : "true", "test.is_retry" : "true", "test.management.is_quarantined" : "true", diff --git a/dd-java-agent/instrumentation/scalatest/src/test/resources/test-quarantined-failed-known/coverages.ftl b/dd-java-agent/instrumentation/scalatest/src/test/resources/test-quarantined-failed-known/coverages.ftl new file mode 100644 index 00000000000..8878e547a79 --- /dev/null +++ b/dd-java-agent/instrumentation/scalatest/src/test/resources/test-quarantined-failed-known/coverages.ftl @@ -0,0 +1 @@ +[ ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/scalatest/src/test/resources/test-quarantined-failed-known/events.ftl b/dd-java-agent/instrumentation/scalatest/src/test/resources/test-quarantined-failed-known/events.ftl new file mode 100644 index 00000000000..b58aa206350 --- /dev/null +++ b/dd-java-agent/instrumentation/scalatest/src/test/resources/test-quarantined-failed-known/events.ftl @@ -0,0 +1,153 @@ +[ { + "content" : { + "duration" : ${content_duration}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid}, + "component" : "scalatest", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "library_version" : ${content_meta_library_version}, + "span.kind" : "test_suite_end", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "scalatest", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "scalatest", + "test.source.file" : "dummy_source_path", + "test.status" : "fail", + "test.suite" : "org.example.TestFailed", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count}, + "test.source.end" : 19, + "test.source.start" : 11 + }, + "name" : "scalatest.test_suite", + "resource" : "org.example.TestFailed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id} + }, + "type" : "test_suite_end", + "version" : 1 +}, { + "content" : { + "duration" : ${content_duration_2}, + "error" : 1, + "meta" : { + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "scalatest", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack}, + "error.type" : "org.scalatest.exceptions.TestFailedException", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "scalatest", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.management.is_quarantined" : "true", + "test.module" : "scalatest", + "test.name" : "Example.add adds two numbers", + "test.source.file" : "dummy_source_path", + "test.status" : "fail", + "test.suite" : "org.example.TestFailed", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_2}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "scalatest.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestFailed.Example.add adds two numbers", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id}, + "start" : ${content_start_2}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_3}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_2}, + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "scalatest", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test_session_end", + "test.command" : "scalatest", + "test.early_flake.enabled" : "true", + "test.framework" : "scalatest", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.status" : "fail", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_3}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "scalatest.test_session", + "resource" : "scalatest", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_3}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_session_end", + "version" : 1 +}, { + "content" : { + "duration" : ${content_duration_4}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_3}, + "component" : "scalatest", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "library_version" : ${content_meta_library_version}, + "span.kind" : "test_module_end", + "test.early_flake.enabled" : "true", + "test.framework" : "scalatest", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "scalatest", + "test.status" : "fail", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_4} + }, + "name" : "scalatest.test_module", + "resource" : "scalatest", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_4}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_module_end", + "version" : 1 +} ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/scalatest/src/test/resources/test-quarantined-failed/events.ftl b/dd-java-agent/instrumentation/scalatest/src/test/resources/test-quarantined-failed/events.ftl index e1df07f0a58..14dd8e63817 100644 --- a/dd-java-agent/instrumentation/scalatest/src/test/resources/test-quarantined-failed/events.ftl +++ b/dd-java-agent/instrumentation/scalatest/src/test/resources/test-quarantined-failed/events.ftl @@ -148,4 +148,4 @@ }, "type" : "test_module_end", "version" : 1 -} ] +} ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/scalatest/src/test/resources/test-retry-failed/events.ftl b/dd-java-agent/instrumentation/scalatest/src/test/resources/test-retry-failed/events.ftl index d9499753bd7..e91b82add17 100644 --- a/dd-java-agent/instrumentation/scalatest/src/test/resources/test-retry-failed/events.ftl +++ b/dd-java-agent/instrumentation/scalatest/src/test/resources/test-retry-failed/events.ftl @@ -248,6 +248,7 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "scalatest", "test.framework_version" : ${content_meta_test_framework_version}, + "test.has_failed_all_retries" : "true", "test.is_retry" : "true", "test.module" : "scalatest", "test.name" : "Example.add adds two numbers", diff --git a/dd-java-agent/instrumentation/scalatest/src/test/resources/test-retry-parameterized/events.ftl b/dd-java-agent/instrumentation/scalatest/src/test/resources/test-retry-parameterized/events.ftl index 895acec8f46..b4b7632dac7 100644 --- a/dd-java-agent/instrumentation/scalatest/src/test/resources/test-retry-parameterized/events.ftl +++ b/dd-java-agent/instrumentation/scalatest/src/test/resources/test-retry-parameterized/events.ftl @@ -248,6 +248,7 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "scalatest", "test.framework_version" : ${content_meta_test_framework_version}, + "test.has_failed_all_retries" : "true", "test.is_retry" : "true", "test.module" : "scalatest", "test.name" : "addition should correctly add two numbers", diff --git a/dd-java-agent/instrumentation/testng/src/testFixtures/groovy/datadog/trace/instrumentation/testng/TestNGTest.groovy b/dd-java-agent/instrumentation/testng/src/testFixtures/groovy/datadog/trace/instrumentation/testng/TestNGTest.groovy index 7a4839736b8..29168c66838 100644 --- a/dd-java-agent/instrumentation/testng/src/testFixtures/groovy/datadog/trace/instrumentation/testng/TestNGTest.groovy +++ b/dd-java-agent/instrumentation/testng/src/testFixtures/groovy/datadog/trace/instrumentation/testng/TestNGTest.groovy @@ -204,9 +204,9 @@ abstract class TestNGTest extends CiVisibilityInstrumentationTest { assertSpansData(testcaseName) where: - testcaseName | tests | quarantined | known - "test-quarantined-failed-${version()}" | [TestFailed] | [new TestIdentifier("org.example.TestFailed", "test_failed", null)] | [new TestIdentifier("org.example.TestFailed", "test_failed", null)] - "test-quarantined-failed-efd" | [TestFailed] | [new TestIdentifier("org.example.TestFailed", "test_failed", null)] | [] + testcaseName | tests | quarantined | known + "test-quarantined-failed-known" | [TestFailed] | [new TestIdentifier("org.example.TestFailed", "test_failed", null)] | [new TestIdentifier("org.example.TestFailed", "test_failed", null)] + "test-quarantined-failed-efd" | [TestFailed] | [new TestIdentifier("org.example.TestFailed", "test_failed", null)] | [] } private static boolean isEFDSupported() { diff --git a/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-efd-faulty-session-threshold/events.ftl b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-efd-faulty-session-threshold/events.ftl index 110273ab9d5..146b1462b1d 100644 --- a/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-efd-faulty-session-threshold/events.ftl +++ b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-efd-faulty-session-threshold/events.ftl @@ -253,6 +253,7 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "testng", "test.framework_version" : ${content_meta_test_framework_version}, + "test.has_failed_all_retries" : "true", "test.is_new" : "true", "test.is_retry" : "true", "test.module" : "testng-7", diff --git a/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-7/events.ftl b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-7/events.ftl index e4095851791..65f4bf6b328 100644 --- a/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-7/events.ftl +++ b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-7/events.ftl @@ -151,4 +151,4 @@ }, "type" : "test_module_end", "version" : 1 -} ] +} ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-atr-7/events.ftl b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-atr-7/events.ftl index fa67c4a2fca..f1039d9b205 100644 --- a/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-atr-7/events.ftl +++ b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-atr-7/events.ftl @@ -211,6 +211,7 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "testng", "test.framework_version" : ${content_meta_test_framework_version}, + "test.has_failed_all_retries" : "true", "test.is_retry" : "true", "test.management.is_quarantined" : "true", "test.module" : "testng-7", diff --git a/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-efd/events.ftl b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-efd/events.ftl index 2c151bf7171..335d848e69b 100644 --- a/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-efd/events.ftl +++ b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-efd/events.ftl @@ -106,6 +106,7 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "testng", "test.framework_version" : ${content_meta_test_framework_version}, + "test.has_failed_all_retries" : "true", "test.is_new" : "true", "test.is_retry" : "true", "test.management.is_quarantined" : "true", diff --git a/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-known/coverages.ftl b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-known/coverages.ftl new file mode 100644 index 00000000000..8878e547a79 --- /dev/null +++ b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-known/coverages.ftl @@ -0,0 +1 @@ +[ ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-known/events.ftl b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-known/events.ftl new file mode 100644 index 00000000000..49a6099e0c5 --- /dev/null +++ b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-quarantined-failed-known/events.ftl @@ -0,0 +1,156 @@ +[ { + "content" : { + "duration" : ${content_duration}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid}, + "component" : "testng", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "library_version" : ${content_meta_library_version}, + "span.kind" : "test_suite_end", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "testng", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "testng-7", + "test.source.file" : "dummy_source_path", + "test.status" : "fail", + "test.suite" : "org.example.TestFailed", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count}, + "test.source.end" : 19, + "test.source.start" : 11 + }, + "name" : "testng.test_suite", + "resource" : "org.example.TestFailed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id} + }, + "type" : "test_suite_end", + "version" : 1 +}, { + "content" : { + "duration" : ${content_duration_2}, + "error" : 1, + "meta" : { + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "testng", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack}, + "error.type" : "java.lang.AssertionError", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "test.framework" : "testng", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.management.is_quarantined" : "true", + "test.module" : "testng-7", + "test.name" : "test_failed", + "test.source.file" : "dummy_source_path", + "test.source.method" : "test_failed()V", + "test.status" : "fail", + "test.suite" : "org.example.TestFailed", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_2}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id}, + "test.source.end" : 18, + "test.source.start" : 12 + }, + "name" : "testng.test", + "parent_id" : ${content_parent_id}, + "resource" : "org.example.TestFailed.test_failed", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "span_id" : ${content_span_id}, + "start" : ${content_start_2}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id}, + "test_suite_id" : ${content_test_suite_id}, + "trace_id" : ${content_trace_id} + }, + "type" : "test", + "version" : 2 +}, { + "content" : { + "duration" : ${content_duration_3}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_2}, + "_dd.profiling.ctx" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "component" : "testng", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "language" : "jvm", + "library_version" : ${content_meta_library_version}, + "runtime-id" : ${content_meta_runtime_id}, + "span.kind" : "test_session_end", + "test.command" : "testng-7", + "test.early_flake.enabled" : "true", + "test.framework" : "testng", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.status" : "fail", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_3}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "process_id" : ${content_metrics_process_id} + }, + "name" : "testng.test_session", + "resource" : "testng-7", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_3}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_session_end", + "version" : 1 +}, { + "content" : { + "duration" : ${content_duration_4}, + "error" : 0, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_3}, + "component" : "testng", + "dummy_ci_tag" : "dummy_ci_tag_value", + "env" : "none", + "library_version" : ${content_meta_library_version}, + "span.kind" : "test_module_end", + "test.early_flake.enabled" : "true", + "test.framework" : "testng", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.module" : "testng-7", + "test.status" : "fail", + "test.type" : "test", + "test_session.name" : "session-name" + }, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_4} + }, + "name" : "testng.test_module", + "resource" : "testng-7", + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "start" : ${content_start_4}, + "test_module_id" : ${content_test_module_id}, + "test_session_id" : ${content_test_session_id} + }, + "type" : "test_module_end", + "version" : 1 +} ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-retry-error/events.ftl b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-retry-error/events.ftl index 6790eee4224..c1902052675 100644 --- a/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-retry-error/events.ftl +++ b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-retry-error/events.ftl @@ -208,6 +208,7 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "testng", "test.framework_version" : ${content_meta_test_framework_version}, + "test.has_failed_all_retries" : "true", "test.is_retry" : "true", "test.module" : "testng-7", "test.name" : "test_error", diff --git a/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-retry-failed-7/events.ftl b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-retry-failed-7/events.ftl index 94397e26158..863605ca59d 100644 --- a/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-retry-failed-7/events.ftl +++ b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-retry-failed-7/events.ftl @@ -208,6 +208,7 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "testng", "test.framework_version" : ${content_meta_test_framework_version}, + "test.has_failed_all_retries" : "true", "test.is_retry" : "true", "test.module" : "testng-7", "test.name" : "test_failed", diff --git a/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-retry-parameterized/events.ftl b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-retry-parameterized/events.ftl index 7ef1dcdbf3f..377f0ea9afd 100644 --- a/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-retry-parameterized/events.ftl +++ b/dd-java-agent/instrumentation/testng/testng-7/src/test/resources/test-retry-parameterized/events.ftl @@ -255,6 +255,7 @@ "test.codeowners" : "[\"owner1\",\"owner2\"]", "test.framework" : "testng", "test.framework_version" : ${content_meta_test_framework_version}, + "test.has_failed_all_retries" : "true", "test.is_retry" : "true", "test.module" : "testng-7", "test.name" : "parameterized_test_succeed",