Skip to content

Commit

Permalink
test: use really invalid hostname
Browse files Browse the repository at this point in the history
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: #3711
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Evan Lucas <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
thefourtheye authored and jasnell committed Nov 9, 2015
1 parent 20285ad commit 5707258
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions test/parallel/test-net-connect-immediate-finish.js
Original file line number Diff line number Diff line change
@@ -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);
});

0 comments on commit 5707258

Please sign in to comment.