Skip to content

Convert remaining declarative config factory tests to parameterized test#8460

Merged
jack-berg merged 2 commits into
open-telemetry:mainfrom
jack-berg:declarative-config-parameterized-tests
Jun 10, 2026
Merged

Convert remaining declarative config factory tests to parameterized test#8460
jack-berg merged 2 commits into
open-telemetry:mainfrom
jack-berg:declarative-config-parameterized-tests

Conversation

@jack-berg

Copy link
Copy Markdown
Member

No description provided.

@jack-berg jack-berg requested a review from a team as a code owner June 5, 2026 18:52
@codecov

codecov Bot commented Jun 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.02%. Comparing base (53fc695) to head (95c98af).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #8460      +/-   ##
============================================
+ Coverage     91.00%   91.02%   +0.01%     
- Complexity     7817     7819       +2     
============================================
  Files           893      893              
  Lines         23721    23721              
  Branches       2364     2364              
============================================
+ Hits          21588    21592       +4     
+ Misses         1410     1408       -2     
+ Partials        723      721       -2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jkwatson jkwatson left a comment

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.

subtract 600 lines of code and not drop the test coverage? I approve.

@psx95 psx95 left a comment

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.

A small, optional suggestion.

cleanup.addCloseables(closeables);

assertThat(processor.toString()).isEqualTo(expectedProcessor.toString());
private static Stream<Arguments> createTestCases() {

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.

A small improvement that could be made to the parameterized tests is the use of named arguments.

They increase readability (especially when the test arguments are similar) by associating a string with the argument payload. This would help determine the initial purpose of the different test cases (especially when the arguments are complex objects) when re-visiting the tests later to add/edit test cases.

Arguments.of(
    Named.of(
        "SpanProcessorModel with OTLP",
        new SpanProcessorModel()
                .withBatch(
                    new BatchSpanProcessorModel()
                        .withExporter(
                            new SpanExporterModel().withOtlpHttp(new OtlpHttpExporterModel()))),
            BatchSpanProcessor.builder(
                    OtlpHttpSpanExporter.builder().setComponentLoader(context).build())
                .build()),
 ...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah! I should get in the habit of using named arguments more often. I always forget they're there.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Went with this new junit API, argumentSet, which doesn't require an another layer of wrapping. Will followup with guidance in https://github.com/open-telemetry/opentelemetry-java/blob/main/docs/knowledge/testing-patterns.md

Arguments.argumentSet(
            "otlp_grpc default",

@jack-berg jack-berg merged commit 27fa3a4 into open-telemetry:main Jun 10, 2026
28 checks passed
hilmarf pushed a commit to apeirora/opentelemetry-java that referenced this pull request Jun 10, 2026
…est (open-telemetry#8460)

Signed-off-by: Hilmar Falkenberg <hilmar.falkenberg@sap.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants