test: handle IPv6 localhost issues within tests · nodejs/node@814b8c3

3 files changed

lines changed

Original file line numberDiff line numberDiff line change

@@ -12,13 +12,6 @@ test-tick-processor : PASS,FLAKY

1212

[$system==linux]

1313

test-tick-processor : PASS,FLAKY

1414
15-

# Flaky until https://github.com/nodejs/build/issues/415 is resolved.

16-

# On some of the buildbots, AAAA queries for localhost don't resolve

17-

# to an address and neither do any of the alternatives from the

18-

# localIPv6Hosts list from test/common.js.

19-

test-https-connect-address-family : PASS,FLAKY

20-

test-tls-connect-address-family : PASS,FLAKY

21-
2215

[$system==macos]

2316
2417

[$system==solaris] # Also applies to SmartOS

Original file line numberDiff line numberDiff line change

@@ -36,8 +36,13 @@ function runTest() {

3636

}

3737
3838

dns.lookup('localhost', {family: 6, all: true}, (err, addresses) => {

39-

if (err)

39+

if (err) {

40+

if (err.code === 'ENOTFOUND') {

41+

common.skip('localhost does not resolve to ::1');

42+

return;

43+

}

4044

throw err;

45+

}

4146
4247

if (addresses.some((val) => val.address === '::1'))

4348

runTest();

Original file line numberDiff line numberDiff line change

@@ -35,8 +35,13 @@ function runTest() {

3535

}

3636
3737

dns.lookup('localhost', {family: 6, all: true}, (err, addresses) => {

38-

if (err)

38+

if (err) {

39+

if (err.code === 'ENOTFOUND') {

40+

common.skip('localhost does not resolve to ::1');

41+

return;

42+

}

3943

throw err;

44+

}

4045
4146

if (addresses.some((val) => val.address === '::1'))

4247

runTest();