Skip to content

test: find IPv6 address from localhost names - #7806

Closed
thefourtheye wants to merge 2 commits into
nodejs:masterfrom
thefourtheye:fix-ipv6-tests
Closed

test: find IPv6 address from localhost names#7806
thefourtheye wants to merge 2 commits into
nodejs:masterfrom
thefourtheye:fix-ipv6-tests

Conversation

@thefourtheye

@thefourtheyethefourtheye commented Jul 20, 2016

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

test

Description of change

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.

cc @nodejs/testing

@thefourtheyethefourtheye added the test Issues and PRs related to the tests. label Jul 20, 2016
@thefourtheye

thefourtheye commented Jul 20, 2016

Copy link
Copy Markdown
ContributorAuthor

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

Copy link
Copy Markdown
Member

@thefourtheye

thefourtheye commented Jul 20, 2016

Copy link
Copy Markdown
ContributorAuthor

@bnoordhuis I found a way to fix that. Testing it in my local VMs. I'll update shortly.

@thefourtheye

thefourtheye commented Jul 20, 2016

Copy link
Copy Markdown
ContributorAuthor

@thefourtheye

Copy link
Copy Markdown
ContributorAuthor

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/

@bnoordhuis

Copy link
Copy Markdown
Member

I have to say that the changes to test/common.js don't look very appealing but I'll defer to @nodejs/testing.

@thefourtheye

Copy link
Copy Markdown
ContributorAuthor

@bnoordhuis Any suggestions to make it better?

@thefourtheye

thefourtheye commented Jul 20, 2016

Copy link
Copy Markdown
ContributorAuthor

@bnoordhuis Will this be better?

exports.getLocalIPv6Address=functiongetLocalIPv6Address(callback){if(exports.localIPv6Hosts.length===0||localhostIPv6===undefined){localhostIPv6=undefined;returnprocess.nextTick(()=>callback(newError('Unable to determine IPv6 address')));}(functionprocessNextHost(current){if(current<exports.localIPv6Hosts.length){consthost=exports.localIPv6Hosts[current];returndns.lookup(host,{family: 6},(_,addr)=>{if(addr&&typeofaddr==='string'){localhostIPv6={hostname: host,address: addr};returncallback(null,localhostIPv6);}returnprocessNextHost(current+1);});}localhostIPv6=undefined;callback(newError('Unable to determine IPv6 address'));})(0);};

Edit: I probably can move the Error creation the recursive function and nextTick, so that the stacktrace will be better.

@Trott

Copy link
Copy Markdown
Member

I have to say that the changes to test/common.js don't look very appealing but I'll defer to @nodejs/testing.

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 common.js is the place for it.

@thefourtheye
thefourtheye deleted the fix-ipv6-tests branch July 20, 2016 17:42
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

testIssues and PRs related to the tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@thefourtheye@bnoordhuis@Trott