-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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: find IPv6 address from localhost names #7806
Conversation
Try all the possible hostnames listed in `common.localIPv6Hosts` to get an IPv6 address. If none of them give a valid address, skip the tests.
@bnoordhuis I found a way to fix that. Testing it in my local VMs. I'll update shortly. |
8abd66b
to
1dccdcd
Compare
The current version looks like a partial win. https://ci.nodejs.org/job/node-test-pull-request/3351/. Only two failures till now. |
d8a7243
to
1dccdcd
Compare
Okay. All green now (Except Fedora 24, which keeps building and testing again and again). https://ci.nodejs.org/job/node-test-pull-request/3352/ |
I have to say that the changes to test/common.js don't look very appealing but I'll defer to @nodejs/testing. |
@bnoordhuis Any suggestions to make it better? |
@bnoordhuis Will this be better? exports.getLocalIPv6Address = function getLocalIPv6Address(callback) {
if (exports.localIPv6Hosts.length === 0 || localhostIPv6 === undefined) {
localhostIPv6 = undefined;
return process.nextTick(
() => callback(new Error('Unable to determine IPv6 address'))
);
}
(function processNextHost(current) {
if (current < exports.localIPv6Hosts.length) {
const host = exports.localIPv6Hosts[current];
return dns.lookup(host, {family: 6}, (_, addr) => {
if (addr && typeof addr === 'string') {
localhostIPv6 = {hostname: host, address: addr};
return callback(null, localhostIPv6);
}
return processNextHost(current + 1);
});
}
localhostIPv6 = undefined;
callback(new Error('Unable to determine IPv6 address'));
})(0);
}; Edit: I probably can move the |
I feel the same, but would be curious how more people on @nodejs/testing felt. This function seems to be only needed in two tests so it's not clear to me that |
Checklist
make -j4 test
(UNIX), orvcbuild test nosign
(Windows) passesAffected core subsystem(s)
test
Description of change
Try all the possible hostnames listed in
common.localIPv6Hosts
to getan IPv6 address. If none of them give a valid address, skip the tests.
cc @nodejs/testing