Skip to content

test: avoid connecting to :: in test-net-timeout

Checklist
  • make -j4 test (UNIX), or vcbuild test nosign (Windows) passes
  • commit message follows commit guidelines
Affected core subsystem(s)

test

Description of change

Fixes #7291 (closed)

This test tries to connect to :: or 0.0.0.0, which resolves to localhost on some platforms but not others. Change to specify localhost.

@quaidn I basically did what you suggested in https://github.com/nodejs/node/issues/7291#issuecomment-227985372, but used common.hasIPv6 instead.

@cjihrig I don't think this will make a difference to the changes you made to gc/test-net-timeout.js a few days ago, but I'd appreciate a check.

cc @trott

EDIT: I would have replaced server.address().address with 'localhost', but until #7288 (closed) is resolved that can cause problems on some machines.

EDIT 2: Actually you can use localhost, as if you don't specify IPv4 or IPv6 localhost should resolve to 127.0.0.1 if ::1 isn't defined.

Merge request reports

Loading