Fix prometheus test ipv4#8223
Merged
jack-berg merged 3 commits intoopen-telemetry:mainfrom Mar 30, 2026
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8223 +/- ##
============================================
- Coverage 90.31% 90.31% -0.01%
+ Complexity 7653 7652 -1
============================================
Files 843 843
Lines 23066 23071 +5
Branches 2310 2311 +1
============================================
+ Hits 20832 20836 +4
Misses 1516 1516
- Partials 718 719 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Updates the Prometheus exporter default-server test to be resilient across environments that bind the HTTP server to either IPv4 or IPv6 wildcard addresses.
Changes:
- Relaxes the
createMetricReader_Defaultassertion to accept multiple wildcard address string forms (IPv4 + IPv6). - Keeps the existing port assertion to ensure the default endpoint remains unchanged.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...t/java/io/opentelemetry/exporter/prometheus/internal/PrometheusMetricReaderProviderTest.java
Outdated
Show resolved
Hide resolved
Contributor
|
Thank you for your contribution @Tusharika725! 🎉 We would like to hear from you about your experience contributing to OpenTelemetry by taking a few minutes to fill out this survey. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #8148
Updates the createMetricReader_Default test in PrometheusMetricReaderProviderTest to correctly handle both IPv4 and IPv6 wildcard addresses.
What happened?
Previously, the test strictly asserted that the local server bound to the IPv6 wildcard address (
0:0:0:0:0:0:0:0). On certain environments (like Red Hat Enterprise Linux) where IPv6 is disabled or deprioritized, the JVM falls back to the IPv4 wildcard (0.0.0.0). This caused the test to fail despite the underlying web server functioning perfectly.The Fix
Updated the AssertJ assertion to use .isIn() to accept any valid wildcard address (0:0:0:0:0:0:0:0, 0.0.0.0, or ::), ensuring the test passes consistently across different OS network configurations.
All local tests and spotlessCheck formatting are passing.