Skip to content

Commit 0414d88

Browse files
ncopaMyles Borins
authored and
Myles Borins
committed
test: fix test-net-* error code check for getaddrinfo(3)
Replace '...' as invalid hostname with '***', which will give a more consisten error message on different systems. The hostname '...' returns EAI_AGAIN on musl libc and EAI_NONAME on most other systems. By changing the testcase we get same restult on all known platforms. PR-URL: #5099 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Rod Vagg <[email protected]>
1 parent a08a017 commit 0414d88

2 files changed

+4
-4
lines changed

test/parallel/test-net-better-error-messages-port-hostname.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ var common = require('../common');
33
var net = require('net');
44
var assert = require('assert');
55

6-
var c = net.createConnection(common.PORT, '...');
6+
var c = net.createConnection(common.PORT, '***');
77

88
c.on('connect', common.fail);
99

1010
c.on('error', common.mustCall(function(e) {
1111
assert.equal(e.code, 'ENOTFOUND');
1212
assert.equal(e.port, common.PORT);
13-
assert.equal(e.hostname, '...');
13+
assert.equal(e.hostname, '***');
1414
}));

test/parallel/test-net-connect-immediate-finish.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ const common = require('../common');
33
const assert = require('assert');
44
const net = require('net');
55

6-
const client = net.connect({host: '...', port: common.PORT});
6+
const client = net.connect({host: '***', port: common.PORT});
77

88
client.once('error', common.mustCall(function(err) {
99
assert(err);
1010
assert.strictEqual(err.code, err.errno);
1111
assert.strictEqual(err.code, 'ENOTFOUND');
1212
assert.strictEqual(err.host, err.hostname);
13-
assert.strictEqual(err.host, '...');
13+
assert.strictEqual(err.host, '***');
1414
assert.strictEqual(err.syscall, 'getaddrinfo');
1515
}));
1616

0 commit comments

Comments
 (0)