Skip to content

Commit 5ba307a

Browse files
committed
test: fix parallel/test-dgram-error-message-address
The test expects EADDRNOTAVAIL when trying to bind to address 111::1. Systems that have IPv6 disabled throw EAFNOSUPPORT instead, however. Update the test accordingly. PR-URL: #575 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Fedor Indutny <fedor@indutny.com>
1 parent f4c536b commit 5ba307a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

test/parallel/test-dgram-error-message-address.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@ var family_ipv6 = 'IPv6';
2424
socket_ipv6.on('listening', assert.fail);
2525

2626
socket_ipv6.on('error', common.mustCall(function(e) {
27-
assert.equal(e.message, 'bind EADDRNOTAVAIL 111::1:' + common.PORT);
27+
// EAFNOSUPPORT means IPv6 is disabled on this system.
28+
var code = (e.code === 'EADDRNOTAVAIL' ? e.code : 'EAFNOSUPPORT');
29+
assert.equal(e.message, 'bind ' + code + ' 111::1:' + common.PORT);
2830
assert.equal(e.address, '111::1');
2931
assert.equal(e.port, common.PORT);
30-
assert.equal(e.code, 'EADDRNOTAVAIL');
32+
assert.equal(e.code, code);
3133
socket_ipv6.close();
3234
}));
3335

0 commit comments

Comments
 (0)