Browse Source

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>
v4.x
Sakthipriyan Vairamani 9 years ago
committed by James M Snell
parent
commit
ed32b9afe2
  1. 28
      test/parallel/test-net-connect-immediate-finish.js

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

@ -1,21 +1,17 @@
'use strict'; 'use strict';
var common = require('../common'); const common = require('../common');
var assert = require('assert'); const assert = require('assert');
var net = require('net'); const net = require('net');
var gotError = false; const client = net.connect({host: '...', port: common.PORT});
var client = net.connect({ client.once('error', common.mustCall(function(err) {
host: 'no.way.you.will.resolve.this', assert(err);
port: common.PORT assert.strictEqual(err.code, err.errno);
}); assert.strictEqual(err.code, 'ENOTFOUND');
assert.strictEqual(err.host, err.hostname);
client.once('error', function(err) { assert.strictEqual(err.host, '...');
gotError = true; assert.strictEqual(err.syscall, 'getaddrinfo');
}); }));
client.end(); client.end();
process.on('exit', function() {
assert(gotError);
});

Loading…
Cancel
Save