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 <info@bnoordhuis.nl>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
thefourtheye authored and rvagg committed Dec 4, 2015
1 parent 3e3c639 commit 365760e
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 365760e

Please sign in to comment.