Skip to content

Migrate dd-trace-ot tests to JUnit 5#11483

Open
amarziali wants to merge 5 commits into
masterfrom
andrea.marziali/migrate-junit-ddtrace-ot
Open

Migrate dd-trace-ot tests to JUnit 5#11483
amarziali wants to merge 5 commits into
masterfrom
andrea.marziali/migrate-junit-ddtrace-ot

Conversation

@amarziali
Copy link
Copy Markdown
Contributor

What Does This Do

Migrates groovy tests in dd-trace-ot to Junit5

Motivation

Additional Notes

Contributor Checklist

  • Format the title according to the contribution guidelines
  • Assign the type: and (comp: or inst:) labels in addition to any other useful labels
  • Avoid using close, fix, or any linking keywords when referencing an issue
    Use solves instead, and assign the PR milestone to the issue
  • Update the CODEOWNERS file on source file addition, migration, or deletion
  • Update public documentation with any new configuration flags or behaviors
  • Add your completed PR to the merge queue by commenting /merge. You can also:
    • Customize the commit message associated with the merge with /merge --commit-message "..."
    • Remove your PR from the merge queue with /merge -c
    • Skip all merge queue checks with /merge -f --reason "reason"; please use this judiciously, as some checks do not run at the PR-level
    • Get more information in this doc

Jira ticket: [PROJ-IDENT]

@amarziali amarziali requested a review from a team as a code owner May 28, 2026 10:16
@amarziali amarziali added comp: testing Testing tag: no release notes Changes to exclude from release notes labels May 28, 2026
@amarziali amarziali requested review from mhlidd and removed request for a team May 28, 2026 10:16
@amarziali amarziali added type: refactoring tag: ai generated Largely based on code generated by an AI or LLM labels May 28, 2026
@dd-octo-sts
Copy link
Copy Markdown
Contributor

dd-octo-sts Bot commented May 28, 2026

🟢 Java Benchmark SLOs — All performance SLOs passed

Suite Status
Startup 🟢 pass

SLO thresholds are defined here based on automatically generated metrics. A warning is raised when results are within 5% of the threshold.

PR vs. master results
Scenario Candidate master Δ (95% CI of mean)
startup:insecure-bank:iast:Agent 14.01 s 13.89 s [-0.2%; +1.9%] (no difference)
startup:insecure-bank:tracing:Agent 12.87 s 13.01 s [-2.4%; +0.3%] (no difference)
startup:petclinic:appsec:Agent 16.70 s 16.54 s [-0.5%; +2.5%] (no difference)
startup:petclinic:iast:Agent 16.52 s 16.65 s [-2.2%; +0.7%] (no difference)
startup:petclinic:profiling:Agent 16.56 s 16.71 s [-2.4%; +0.6%] (no difference)
startup:petclinic:tracing:Agent 15.91 s 15.85 s [-1.1%; +1.9%] (no difference)

Commit: 46875cf5 · CI Pipeline · Benchmarking Platform UI


Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion.

@datadog-prod-us1-5

This comment has been minimized.

Copy link
Copy Markdown
Contributor

@bric3 bric3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a few conversion-fidelity notes. These are about preserving the old Spock assertions, not expanding the test scope.

Comment thread dd-trace-ot/src/test/java/datadog/opentracing/DDTracerTest.java Outdated
Copy link
Copy Markdown
Contributor

@AlexeyKuznetsov-DD AlexeyKuznetsov-DD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left minor nit comments

Comment thread dd-trace-ot/correlation-id-injection/src/test/java/CorrelationIdInjectorTest.java Outdated
Comment thread dd-trace-ot/correlation-id-injection/src/test/java/CorrelationIdInjectorTest.java Outdated
Comment thread dd-trace-ot/src/ot31CompatibilityTest/java/datadog/opentracing/OT31ApiTest.java Outdated
Comment thread dd-trace-ot/src/ot31CompatibilityTest/java/datadog/opentracing/OT31ApiTest.java Outdated
@amarziali amarziali force-pushed the andrea.marziali/migrate-junit-ddtrace-ot branch from fd00951 to 89d950f Compare May 29, 2026 12:29
@amarziali amarziali requested a review from a team as a code owner May 29, 2026 12:29
@gh-worker-ownership-write-b05516 gh-worker-ownership-write-b05516 Bot removed the request for review from a team May 29, 2026 13:32
Copy link
Copy Markdown
Contributor

@AlexeyKuznetsov-DD AlexeyKuznetsov-DD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
left minor comments


abstract class CorrelationIdInjectorTest extends DDJavaSpecification {

protected String logPattern =
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I think it is a const now?
if yes, it should be protected static final String LOG_PATTERN = ....

Comment on lines +33 to +35
List<String> events;
int read;
PatternLayoutEncoder encoder;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: should this be private final? (except int read).

Comment on lines +33 to +34
ListWriter writer = new ListWriter();
Tracer tracer = DDTracer.builder().writer(writer).build();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: private final?


class DDTracerResolverTest extends DDJavaSpecification {

DDTracerResolver resolver = new DDTracerResolver();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: private final

Comment on lines +47 to +60
@SuppressWarnings("unchecked")
private static <T> T getField(Object obj, String fieldName) throws Exception {
Class<?> cls = obj.getClass();
while (cls != null) {
try {
Field field = cls.getDeclaredField(fieldName);
field.setAccessible(true);
return (T) field.get(obj);
} catch (NoSuchFieldException ignored) {
cls = cls.getSuperclass();
}
}
throw new NoSuchFieldException("Field " + fieldName + " not found on " + obj.getClass());
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

optional: Probably looks like a good candidate to be in base class?

Comment on lines +21 to +22
ListWriter writer = new ListWriter();
CoreTracer tracer = CoreTracer.builder().writer(writer).build();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: private final

@amarziali amarziali enabled auto-merge May 29, 2026 14:19
@jpbempel
Copy link
Copy Markdown
Member

jpbempel commented May 29, 2026

@amarziali once all tests of the module are migrated you need to add the module to this file: https://github.com/DataDog/dd-trace-java/pull/10787/changes#diff-3bcd5c5c739a45cfe3a5281b82797f6b8e36073cab801c6609f6e8a6508b858f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: testing Testing tag: ai generated Largely based on code generated by an AI or LLM tag: no release notes Changes to exclude from release notes type: refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants