Skip to content

Commit

Permalink
test: fix parallel/test-dgram-error-message-address
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-By: Fedor Indutny <[email protected]>
  • Loading branch information
bnoordhuis committed Jan 23, 2015
1 parent f4c536b commit 5ba307a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test/parallel/test-dgram-error-message-address.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ var family_ipv6 = 'IPv6';
socket_ipv6.on('listening', assert.fail);

socket_ipv6.on('error', common.mustCall(function(e) {
assert.equal(e.message, 'bind EADDRNOTAVAIL 111::1:' + common.PORT);
// EAFNOSUPPORT means IPv6 is disabled on this system.
var code = (e.code === 'EADDRNOTAVAIL' ? e.code : 'EAFNOSUPPORT');
assert.equal(e.message, 'bind ' + code + ' 111::1:' + common.PORT);
assert.equal(e.address, '111::1');
assert.equal(e.port, common.PORT);
assert.equal(e.code, 'EADDRNOTAVAIL');
assert.equal(e.code, code);
socket_ipv6.close();
}));

Expand Down

0 comments on commit 5ba307a

Please sign in to comment.