Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test, win: fix IPv6 detection on Windows #14865

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/async-hooks/test-graph.tcp.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const server = net

server.listen(common.PORT);

net.connect({ port: server.address().port, host: server.address().address },
net.connect({ port: server.address().port, host: '::1' },
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm +1 on this and +1 on fixing adress().adress, but this PR is about fixing common.hasIPv6. I would like to make just the test suit pass, and leave such improvements for other PRs.

Copy link
Member

Choose a reason for hiding this comment

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

Does localhost work? If so can we use that (see references in #14900 (comment)).

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think localhost will work because of #6307

Copy link
Member

Choose a reason for hiding this comment

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

Does that apply? Doesn't windows have an equivalent of /etc/hosts that it just looks up to find the address? I'm sure we're using localhost in a bunch of other tests.

Copy link
Contributor

@refack refack Aug 17, 2017

Choose a reason for hiding this comment

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

But it will resolve to 127.0.0.1.
I'm trying to figure out if :: was just used for convenience, or if IPv6 has any significance.
I'm trying to figure out why this test has
https://github.com/nodejs/node/blob/73894dad9d74671377c79dc7542b41813237c3cc/test/async-hooks/test-graph.tcp.js#L4-L5

common.mustCall(onconnected));

function onlistening() {}
Expand Down
2 changes: 1 addition & 1 deletion test/async-hooks/test-tcpwrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const server = net
// Calling net.connect creates another TCPWRAP synchronously
{
net.connect(
{ port: server.address().port, host: server.address().address },
{ port: server.address().port, host: '::1' },
common.mustCall(onconnected));
const tcps = hooks.activitiesOfTypes('TCPWRAP');
assert.strictEqual(tcps.length, 2);
Expand Down
2 changes: 1 addition & 1 deletion test/common/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ Object.defineProperty(exports, 'hasFipsCrypto', {

{
const iFaces = os.networkInterfaces();
const re = /lo/;
const re = exports.isWindows ? /Loopback Pseudo-Interface/ : /lo/;
exports.hasIPv6 = Object.keys(iFaces).some(function(name) {
return re.test(name) && iFaces[name].some(function(info) {
return info.family === 'IPv6';
Expand Down