open-telemetry / open-telemetry/opentelemetry-java-instrumentation

Migrate javaagent module unit tests to the unitTests suite

Open
#20,095 0 comments 0 reactions 1 assignee View on GitHub

@trask is already working on this.

Since Sep 10, 2026.

enhancement needs triage
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/knowledge articles to encode the new patterns, including when tests belong in the unitTests suite and when direct access should be preferred over reflection.

Relevant examples and discussion:

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.