Skip to content

Commit 287bdab

Browse files
committed
test: make test-net-connect-options-ipv6.js better
Improve the robustness of test-net-connect-options-ipv6.js PPC Suse build team encountered intermittent failures related to dns. Improve test to make it more robust in the face of intermittent dns issues. PR-URL: #5791 Reviewed-By: James M Snell <[email protected]>
1 parent d3a7534 commit 287bdab

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

test/parallel/test-net-connect-options-ipv6.js

+15-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,21 @@ function tryConnect() {
4040
server.close();
4141
});
4242
}).on('error', function(err) {
43-
if (err.syscall === 'getaddrinfo' && err.code === 'ENOTFOUND') {
43+
// ENOTFOUND means we don't have the requested address. In this
44+
// case we try the next one in the list and if we run out of
45+
// candidates we assume IPv6 is not supported on the
46+
// machine and skip the test.
47+
// EAI_AGAIN means we tried to remotely resolve the address and
48+
// timed out or hit some intermittent connectivity issue with the
49+
// dns server. Although we are looking for local loopback addresses
50+
// we may go remote since the list we search includes addresses that
51+
// cover more than is available on any one distribution. The
52+
// net is that if we get an EAI_AGAIN we were looking for an
53+
// address which does not exist in this distribution so the error
54+
// is not significant and we should just move on and try the
55+
// next address in the list.
56+
if ((err.syscall === 'getaddrinfo') && ((err.code === 'ENOTFOUND') ||
57+
(err.code === 'EAI_AGAIN'))) {
4458
if (host !== 'localhost' || --localhostTries === 0)
4559
host = hosts[++hostIdx];
4660
if (host)

0 commit comments

Comments
 (0)