Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9cdceac

Browse filesBrowse files
thefourtheyeFishrock123
authored andcommitted
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: #3711 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 2498e29 commit 9cdceac
Copy full SHA for 9cdceac

File tree

Expand file treeCollapse file tree

1 file changed

+12
-16
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+12
-16
lines changed
Open diff view settings
Collapse file
+12-16Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,17 @@
11
'use strict';
2-
var common = require('../common');
3-
var assert = require('assert');
4-
var net = require('net');
2+
const common = require('../common');
3+
const assert = require('assert');
4+
const net = require('net');
55

6-
var gotError = false;
6+
const client = net.connect({host: '...', port: common.PORT});
77

8-
var client = net.connect({
9-
host: 'no.way.you.will.resolve.this',
10-
port: common.PORT
11-
});
12-
13-
client.once('error', function(err) {
14-
gotError = true;
15-
});
8+
client.once('error', common.mustCall(function(err) {
9+
assert(err);
10+
assert.strictEqual(err.code, err.errno);
11+
assert.strictEqual(err.code, 'ENOTFOUND');
12+
assert.strictEqual(err.host, err.hostname);
13+
assert.strictEqual(err.host, '...');
14+
assert.strictEqual(err.syscall, 'getaddrinfo');
15+
}));
1616

1717
client.end();
18-
19-
process.on('exit', function() {
20-
assert(gotError);
21-
});

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.