Skip to content

Commit cfdd29e

Browse files
icarter09MylesBorins
authored andcommitted
test: use reserved invalid hostname for tests
PR-URL: #14781 Refs: https://tools.ietf.org/html/rfc2606#section-2 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
1 parent 860be62 commit cfdd29e

2 files changed

+7
-4
lines changed

test/parallel/test-net-better-error-messages-port-hostname.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ const net = require('net');
44
const assert = require('assert');
55

66
// Using port 0 as hostname used is already invalid.
7-
const c = net.createConnection(0, '***');
7+
const c = net.createConnection(0, 'this.hostname.is.invalid');
88

99
c.on('connect', common.mustNotCall());
1010

1111
c.on('error', common.mustCall(function(e) {
1212
assert.strictEqual(e.code, 'ENOTFOUND');
1313
assert.strictEqual(e.port, 0);
14-
assert.strictEqual(e.hostname, '***');
14+
assert.strictEqual(e.hostname, 'this.hostname.is.invalid');
1515
}));

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

+5-2
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,17 @@ const common = require('../common');
33
const assert = require('assert');
44
const net = require('net');
55

6-
const client = net.connect({host: '***', port: common.PORT});
6+
const client = net.connect({
7+
host: 'this.hostname.is.invalid',
8+
port: common.PORT
9+
});
710

811
client.once('error', common.mustCall((err) => {
912
assert(err);
1013
assert.strictEqual(err.code, err.errno);
1114
assert.strictEqual(err.code, 'ENOTFOUND');
1215
assert.strictEqual(err.host, err.hostname);
13-
assert.strictEqual(err.host, '***');
16+
assert.strictEqual(err.host, 'this.hostname.is.invalid');
1417
assert.strictEqual(err.syscall, 'getaddrinfo');
1518
}));
1619

0 commit comments

Comments
 (0)