-
Notifications
You must be signed in to change notification settings - Fork 292
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix tracing JUnit5 tests in Maven projects with multiple forks (#8089)
- Loading branch information
1 parent
4573a38
commit 13a9a2d
Showing
9 changed files
with
659 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
136 changes: 136 additions & 0 deletions
136
...-ci-visibility/src/main/java/datadog/trace/civisibility/events/NoOpTestEventsHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
package datadog.trace.civisibility.events; | ||
|
||
import datadog.trace.api.civisibility.DDTest; | ||
import datadog.trace.api.civisibility.DDTestSuite; | ||
import datadog.trace.api.civisibility.config.TestIdentifier; | ||
import datadog.trace.api.civisibility.events.TestEventsHandler; | ||
import datadog.trace.api.civisibility.retry.TestRetryPolicy; | ||
import datadog.trace.api.civisibility.telemetry.tag.TestFrameworkInstrumentation; | ||
import datadog.trace.bootstrap.ContextStore; | ||
import datadog.trace.civisibility.retry.NeverRetry; | ||
import java.lang.reflect.Method; | ||
import java.util.Collection; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
public class NoOpTestEventsHandler<SuiteKey, TestKey> | ||
implements TestEventsHandler<SuiteKey, TestKey> { | ||
|
||
@Override | ||
public void onTestSuiteStart( | ||
SuiteKey descriptor, | ||
String testSuiteName, | ||
@Nullable String testFramework, | ||
@Nullable String testFrameworkVersion, | ||
@Nullable Class<?> testClass, | ||
@Nullable Collection<String> categories, | ||
boolean parallelized, | ||
TestFrameworkInstrumentation instrumentation) { | ||
// do nothing | ||
} | ||
|
||
@Override | ||
public void onTestSuiteSkip(SuiteKey descriptor, @Nullable String reason) { | ||
// do nothing | ||
} | ||
|
||
@Override | ||
public void onTestSuiteFailure(SuiteKey descriptor, @Nullable Throwable throwable) { | ||
// do nothing | ||
} | ||
|
||
@Override | ||
public void onTestSuiteFinish(SuiteKey descriptor) { | ||
// do nothing | ||
} | ||
|
||
@Override | ||
public void onTestStart( | ||
SuiteKey suiteDescriptor, | ||
TestKey descriptor, | ||
String testSuiteName, | ||
String testName, | ||
@Nullable String testFramework, | ||
@Nullable String testFrameworkVersion, | ||
@Nullable String testParameters, | ||
@Nullable Collection<String> categories, | ||
@Nullable Class<?> testClass, | ||
@Nullable String testMethodName, | ||
@Nullable Method testMethod, | ||
boolean isRetry) { | ||
// do nothing | ||
} | ||
|
||
@Override | ||
public void onTestSkip(TestKey descriptor, @Nullable String reason) { | ||
// do nothing | ||
} | ||
|
||
@Override | ||
public void onTestFailure(TestKey descriptor, @Nullable Throwable throwable) { | ||
// do nothing | ||
} | ||
|
||
@Override | ||
public void onTestFinish(TestKey descriptor) { | ||
// do nothing | ||
} | ||
|
||
@Override | ||
public void onTestIgnore( | ||
SuiteKey suiteDescriptor, | ||
TestKey testDescriptor, | ||
String testSuiteName, | ||
String testName, | ||
@Nullable String testFramework, | ||
@Nullable String testFrameworkVersion, | ||
@Nullable String testParameters, | ||
@Nullable Collection<String> categories, | ||
@Nullable Class<?> testClass, | ||
@Nullable String testMethodName, | ||
@Nullable Method testMethod, | ||
@Nullable String reason) { | ||
// do nothing | ||
} | ||
|
||
@Override | ||
public boolean skip(TestIdentifier test) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean shouldBeSkipped(TestIdentifier test) { | ||
return false; | ||
} | ||
|
||
@NotNull | ||
@Override | ||
public TestRetryPolicy retryPolicy(TestIdentifier test) { | ||
return NeverRetry.INSTANCE; | ||
} | ||
|
||
@Override | ||
public boolean isNew(TestIdentifier test) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean isFlaky(TestIdentifier test) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public void close() { | ||
// do nothing | ||
} | ||
|
||
public static final class Factory implements TestEventsHandler.Factory { | ||
@Override | ||
public <SuiteKey, TestKey> TestEventsHandler<SuiteKey, TestKey> create( | ||
String component, | ||
@Nullable ContextStore<SuiteKey, DDTestSuite> suiteStore, | ||
@Nullable ContextStore<TestKey, DDTest> testStore) { | ||
return new NoOpTestEventsHandler<>(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
...oke-tests/maven/src/test/resources/test_successful_maven_run_multiple_forks/coverages.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[ { | ||
"test_session_id" : ${content_test_session_id}, | ||
"test_suite_id" : ${content_test_suite_id}, | ||
"span_id" : ${content_span_id_6}, | ||
"files" : [ { | ||
"filename" : "src/test/java/datadog/smoke/TestSucceed.java", | ||
"bitmap" : "ABg=" | ||
}, { | ||
"filename" : "src/main/java/datadog/smoke/Calculator.java", | ||
"bitmap" : "IA==" | ||
} ] | ||
} ] |
Oops, something went wrong.