Fix LongExemplarAssert hasFilteredAttributesSatisfyingExactly to enforce exact attribute matching
Fixes #8517
Description
LongExemplarAssert.hasFilteredAttributesSatisfyingExactly(AttributeAssertion...)delegated tohasFilteredAttributesSatisfying(the non-exact helper), so it did not reject extra filtered attributes.- It now delegates to the exact
Iterableoverload (AssertUtil.assertAttributesExactly), matchingDoubleExemplarAssert.hasFilteredAttributesSatisfyingExactlyand the same-classIterableoverload. - Present since 1.21.0; existing
longGaugeFailurecases threw for other reasons and never exercised the exactness path.
Testing done
- Added a negative case to
MetricAssertionsTest.longGaugeFailureasserting a single filtered attribute on an exemplar that has nine; it must raiseAssertionError. Fails before the fix, passes after. ./gradlew :sdk:testing:check— passed (16 tests inMetricAssertionsTest).- No public API change: method signature is unchanged, so no
docs/apidiffsupdate. - Added a
## Unreleased#### Testingentry inCHANGELOG.md(assertion now stricter; previously lax tests may newly fail).
Codecov Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 91.61%. Comparing base (c5c9d87) to head (7bcf1d0).
:warning: Report is 3 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #8518 +/- ##
============================================
+ Coverage 91.60% 91.61% +0.01%
- Complexity 10312 10313 +1
============================================
Files 1013 1013
Lines 27274 27274
Branches 3202 3202
============================================
+ Hits 24983 24986 +3
+ Misses 1563 1561 -2
+ Partials 728 727 -1
:umbrella: View full report in Codecov by Harness.
: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.
This has been automatically marked as stale because it has been marked as needing author feedback and has not had any activity for 7 days. It will be closed if no further activity occurs within 7 days of this comment.
Thank you for your contribution @thswlsqls! 🎉 We would like to hear from you about your experience contributing to OpenTelemetry by taking a few minutes to fill out this survey.