test: don't connect to :: (use localhost instead)
If a test does http.listen(0) or net.listen(0), http.listen(0).address().address returns '::'. Some machines will resolve this to localhost, but not all. Every machine should have localhost defined in /etc/hosts (or equivalent), so it should always resolve.
Fixes: https://github.com/nodejs/node/issues/7291
Fixed
-
test/parallel/test-http-status-reason-invalid-chars.js The code currently resolves to
::1
if the machine has IPv6, and to::
otherwise (so it fails on non-Linux IPv4 machines). -
test/gc/test-net-timeout.js This currently resolves to
::
everywhere. Removing that line makes it default to localhost.
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
commit message follows commit guidelines
Affected core subsystem(s)
test
cc/ @cjihrig in reply to https://github.com/nodejs/node/pull/9572#discussion_r87693222, you can't use server.address().address
.
cc/ @nodejs/testing