Skip to content

test: use shared IPv4 loopback host instead of localhost#5277

Closed
trivikr wants to merge 3 commits intonodejs:mainfrom
trivikr:test-localhost
Closed

test: use shared IPv4 loopback host instead of localhost#5277
trivikr wants to merge 3 commits intonodejs:mainfrom
trivikr:test-localhost

Conversation

@trivikr
Copy link
Copy Markdown
Member

@trivikr trivikr commented May 10, 2026

This relates to...

Relates to #5177

Rationale

Windows CI has intermittent failures around tests using localhost.

On Windows, localhost resolution can prefer IPv6 (::1) or otherwise depend on hosts/DNS behavior, while some tests bind/connect through IPv4 loopback. Using 127.0.0.1 removes name-resolution ambiguity and keeps the test server/client address family consistent.

Changes

Centralizes the test loopback host as LOOPBACK_HOST and updates first-party tests to use it instead of inline localhost/127.0.0.1 where appropriate.

Features

N/A

Bug Fixes

  • Reduce Windows-specific CI flakes caused by localhost resolution/address-family ambiguity.
  • Keep loopback test host selection consistent across first-party tests.

Breaking Changes and Deprecations

Status

Assisted-by: openai:gpt-5.5

@trivikr
Copy link
Copy Markdown
Member Author

trivikr commented May 10, 2026

Discarding as there are too many test failures

@trivikr trivikr closed this May 10, 2026
@trivikr
Copy link
Copy Markdown
Member Author

trivikr commented May 10, 2026

For future reference, this PR was attempted as gpt-5.5 gave the following reason

if the test does not specifically care about DNS or IPv6, bind and connect to the same explicit loopback address, usually 127.0.0.1. That removes OS DNS ordering and dual-stack behavior from the test.

If any other undici maintainer wants to take over (chrry-pick or post new PR altogether), I'll be happy to review if it can help reduce flaky test failures on Windows.

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.

1 participant