open-telemetry / open-telemetry/opentelemetry-java-instrumentation
Migrate javaagent module unit tests to the unitTests suite
@trask is already working on this.
Since Sep 10, 2026.
- Dominant language
- Java
- Stars
- 2.6k
- Forks
- 1.2k
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 228
Description
Is your feature request related to a problem? Please describe.
Javaagent modules contain tests that exercise helper or instrumentation code without requiring the agent. These tests currently live in configurations that remove agent classes from the classpath, which can lead to workarounds such as reflection or bespoke test setup.
Describe the solution you'd like
After #20059 introduces the unitTests suite convention:
- Audit javaagent modules throughout the codebase and migrate eligible tests to that suite.
- Look for tests using reflection only to reach code that would be directly accessible from the new unit-test configuration, and remove that reflection where possible.
- Update the relevant repository guidance and
.github/agents/knowledgearticles to encode the new patterns, including when tests belong in theunitTestssuite and when direct access should be preferred over reflection.
Relevant examples and discussion:
- #19845: https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/19845#discussion_r3976412521
- #20011: https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/20011#discussion_r3979013437
- Convention introduced in #20059
Describe alternatives you've considered
Continue adding per-module test tasks or retain reflection-based workarounds. This would duplicate Gradle configuration and keep tests harder to read and maintain.
Additional context
The audit should distinguish true agent integration tests from ordinary unit tests so existing agent coverage remains intact. Any guidance updates should capture patterns discovered during the audit so future instrumentation and reviews apply them consistently.
Tip
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.