refactor: parametrize tests
Fixes https://github.com/open-telemetry/opentelemetry-rust/issues/1552
Changes
- Parametrized a few tests
- Bumped the
rstestversion to no longer depend on async-std by default (See: https://github.com/la10736/rstest/pull/311); this issue only occurred in the context of
#[rstest]
#[tokio::test]
Merge requirement checklist
- [X] CONTRIBUTING guidelines followed
- [X] Unit tests added/updated (if applicable)
- [ ] Appropriate
CHANGELOG.mdfiles updated for non-trivial, user-facing changes - [X] Changes in public API reviewed (if applicable)
The committers listed above are authorized under a signed CLA.
- :white_check_mark: login: chickenbreeder / name: chickenbreeder (a1e2f3a369eed323e3e20692943c50430dcc61b6)
Codecov Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 80.7%. Comparing base (df412fe) to head (a1e2f3a).
Additional details and impacted files
@@ Coverage Diff @@
## main #3256 +/- ##
=======================================
- Coverage 80.8% 80.7% -0.1%
=======================================
Files 129 129
Lines 23203 23167 -36
=======================================
- Hits 18750 18714 -36
Misses 4453 4453
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
I asked Claude to see if there are many others here we could pick up. Not sure how useful this is, but it's probably worth trying to pick out other instances of this pattern we can clean up!
- opentelemetry-zipkin/src/propagator/mod.rs:464-683
- B3 propagator tests with extensive test data sets
- Multiple nested loops for single/multi-header formats
- Could consolidate 20+ test cases
- opentelemetry-sdk/src/metrics/internal/exponential_histogram.rs - Multiple locations (555-664, 914-1072, 1141-1229) - Complex test data structures for bucket calculations - 30+ test cases across different test functions
- opentelemetry-otlp/src/retry.rs:218-495 - 10+ similar async test functions for retry logic - Each tests different scenarios (success, failure, timeout, throttling) - Perfect candidate for #[rstest] with #[case] attributes
@chickenbreeder let me know when you are ready with this!
Hey @chickenbreeder , did you want to do more of these, or should we review it as it is?
Hey @scottgerring. Sorry, I did not get around to do any further work on this.