Skip to content

Commit 6545d1a

Browse files
Vita BatrlaMylesBorins
authored andcommitted
test: allow EAI_FAIL in test-net-dns-error.js
Test test-net-dns-error.js causes assertion failure on SunOS, test expects ENOTFOUND, but OS returns EAI_FAIL. Maximum length of a host name is 63 characters. Test test-net-dns-error.js makes a connection attempt to invalid host name (longer than maximum). Such connection attempt on SunOS returns permanent failure (EAI_FAIL) as invalid hostname won't be ever resolved. PR-URL: #31780 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent cc27846 commit 6545d1a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

‎test/parallel/test-net-dns-error.js‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,16 @@ const assert = require('assert');
2626
constnet=require('net');
2727

2828
consthost='*'.repeat(64);
29-
consterrCode=common.isOpenBSD ? 'EAI_FAIL' : 'ENOTFOUND';
29+
// Resolving hostname > 63 characters may return EAI_FAIL (permanent failure).
30+
consterrCodes=['ENOTFOUND','EAI_FAIL'];
3031

3132
constsocket=net.connect(42,host,common.mustNotCall());
3233
socket.on('error',common.mustCall(function(err){
33-
assert.strictEqual(err.code,errCode);
34+
assert(errCodes.includes(err.code),err);
3435
}));
3536
socket.on('lookup',common.mustCall(function(err,ip,type){
3637
assert(errinstanceofError);
37-
assert.strictEqual(err.code,errCode);
38+
assert(errCodes.includes(err.code),err);
3839
assert.strictEqual(ip,undefined);
3940
assert.strictEqual(type,undefined);
4041
}));

0 commit comments

Comments
(0)