Skip to content

Fix prometheus test ipv4#8223

Merged
jack-berg merged 3 commits intoopen-telemetry:mainfrom
Tusharika725:fix-prometheus-test-ipv4
Mar 30, 2026
Merged

Fix prometheus test ipv4#8223
jack-berg merged 3 commits intoopen-telemetry:mainfrom
Tusharika725:fix-prometheus-test-ipv4

Conversation

@Tusharika725
Copy link
Copy Markdown
Contributor

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.

@Tusharika725 Tusharika725 requested a review from a team as a code owner March 30, 2026 13:40
Copilot AI review requested due to automatic review settings March 30, 2026 13:40
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 30, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.31%. Comparing base (a88681a) to head (dcd3eb8).
⚠️ Report is 10 commits behind head on main.

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.
📢 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.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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_Default assertion 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.

Copy link
Copy Markdown
Member

@jack-berg jack-berg left a comment

Choose a reason for hiding this comment

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

Nice

@jack-berg jack-berg merged commit 34c5b1f into open-telemetry:main Mar 30, 2026
27 checks passed
@otelbot
Copy link
Copy Markdown
Contributor

otelbot bot commented Mar 30, 2026

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.

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.

PrometheusMetricReaderProviderTest createMetricReader_Default failing on RHEL 9.4

3 participants