Skip to content

test: skip IPv6 tests when IPv6 is not available#4939

Merged
mcollina merged 1 commit intomainfrom
fix/ipv6-tests-skip
Apr 1, 2026
Merged

test: skip IPv6 tests when IPv6 is not available#4939
mcollina merged 1 commit intomainfrom
fix/ipv6-tests-skip

Conversation

@mcollina
Copy link
Copy Markdown
Member

@mcollina mcollina commented Mar 28, 2026

This PR adds a check for IPv6 availability before running IPv6-specific DNS tests. When IPv6 is not available for localhost (i.e., ::1 is not in /etc/hosts), the IPv6-specific tests are skipped.

Changes

  • Added hasIPv6LocalhostSync() function that synchronously checks /etc/hosts for ::1 entry
  • Added ipv6Available module-level constant that checks IPv6 at module load time
  • Added { skip: !ipv6Available } option to 3 IPv6-specific tests

Why

The tests were failing on machines without IPv6 localhost configuration because they tried to connect to localhost expecting IPv6 resolution, which wasn't available. This caused timeouts and test failures.

Testing

All 25 tests pass, with 3 IPv6 tests properly skipped when IPv6 is unavailable. The remaining 22 tests pass normally.

- Add hasIPv6LocalhostSync() to synchronously check /etc/hosts for ::1 entry
- Conditionally skip tests using { skip: !ipv6Available } option
- IPv6-specific tests: 'Should throw when on dual-stack disabled (6)',
  'Should automatically resolve IPs (dual stack disabled - 6)',
  'Should we handle TTL (6)'
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.94%. Comparing base (5145a7c) to head (69915cf).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4939   +/-   ##
=======================================
  Coverage   92.93%   92.94%           
=======================================
  Files         112      112           
  Lines       35709    35709           
=======================================
+ Hits        33187    33190    +3     
+ Misses       2522     2519    -3     

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mcollina mcollina merged commit 1da1c74 into main Apr 1, 2026
35 of 37 checks passed
@mcollina mcollina deleted the fix/ipv6-tests-skip branch April 1, 2026 09:27
@github-actions github-actions Bot mentioned this pull request Apr 1, 2026
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