mirror of
https://github.com/nodejs/node.git
synced 2026-11-09 15:11:11 -05:00
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: https://github.com/nodejs/node/pull/5099 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Rod Vagg <rod@vagg.org>
This commit is contained in:
1 parent
f914f37742
commit
1a1ff77feb
2 files changed
+4
-4
No files matched your search
@@ -3,12 +3,12 @@ var common = require('../common');
|
||||
var net = require('net');
|
||||
var assert = require('assert');
|
||||
|
||||
var c = net.createConnection(common.PORT, '...');
|
||||
var c = net.createConnection(common.PORT, '***');
|
||||
|
||||
c.on('connect', common.fail);
|
||||
|
||||
c.on('error', common.mustCall(function(e) {
|
||||
assert.equal(e.code, 'ENOTFOUND');
|
||||
assert.equal(e.port, common.PORT);
|
||||
assert.equal(e.hostname, '...');
|
||||
assert.equal(e.hostname, '***');
|
||||
}));
|
||||
@@ -3,14 +3,14 @@ const common = require('../common');
|
||||
const assert = require('assert');
|
||||
const net = require('net');
|
||||
|
||||
const client = net.connect({host: '...', port: common.PORT});
|
||||
const client = net.connect({host: '***', port: common.PORT});
|
||||
|
||||
client.once('error', common.mustCall(function(err) {
|
||||
assert(err);
|
||||
assert.strictEqual(err.code, err.errno);
|
||||
assert.strictEqual(err.code, 'ENOTFOUND');
|
||||
assert.strictEqual(err.host, err.hostname);
|
||||
assert.strictEqual(err.host, '...');
|
||||
assert.strictEqual(err.host, '***');
|
||||
assert.strictEqual(err.syscall, 'getaddrinfo');
|
||||
}));
|
||||
|
||||
|
||||
Reference in new issue
Block a user