mirror of
https://github.com/nodejs/node.git
synced 2026-11-21 12:59:16 -05:00
test: use really invalid hostname
On my slow Ubuntu 14.04 machine, this fails to resolve the host name used (`no.way.you.will.resolve.this`) and it times out in local testing. This patch uses an invalid name (`...`) and does stricter validation of the error returned. PR-URL: https://github.com/nodejs/node/pull/3711 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
1 parent
2498e29344
commit
9cdceac782
1 file changed
+12
-16
@@ -1,21 +1,17 @@
|
||||
'use strict';
|
||||
var common = require('../common');
|
||||
var assert = require('assert');
|
||||
var net = require('net');
|
||||
const common = require('../common');
|
||||
const assert = require('assert');
|
||||
const net = require('net');
|
||||
|
||||
var gotError = false;
|
||||
const client = net.connect({host: '...', port: common.PORT});
|
||||
|
||||
var client = net.connect({
|
||||
host: 'no.way.you.will.resolve.this',
|
||||
port: common.PORT
|
||||
});
|
||||
|
||||
client.once('error', function(err) {
|
||||
gotError = true;
|
||||
});
|
||||
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.syscall, 'getaddrinfo');
|
||||
}));
|
||||
|
||||
client.end();
|
||||
|
||||
process.on('exit', function() {
|
||||
assert(gotError);
|
||||
});
|
||||
Reference in new issue
Block a user