From e0cf4c8aa39d0bc27d748717d1f9b0b6c3a09705 Mon Sep 17 00:00:00 2001 From: icarter09 Date: Fri, 11 Aug 2017 23:04:41 -0400 Subject: [PATCH] test: use reserved invalid hostname for tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/14781 Refs: https://tools.ietf.org/html/rfc2606#section-2 Reviewed-By: Rich Trott Reviewed-By: Gibson Fahnestock Reviewed-By: James M Snell Reviewed-By: Tobias Nießen --- .../test-net-better-error-messages-port-hostname.js | 4 ++-- test/parallel/test-net-connect-immediate-finish.js | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/test/parallel/test-net-better-error-messages-port-hostname.js b/test/parallel/test-net-better-error-messages-port-hostname.js index 04974908c91..dac17141677 100644 --- a/test/parallel/test-net-better-error-messages-port-hostname.js +++ b/test/parallel/test-net-better-error-messages-port-hostname.js @@ -4,12 +4,12 @@ const net = require('net'); const assert = require('assert'); // Using port 0 as hostname used is already invalid. -const c = net.createConnection(0, '***'); +const c = net.createConnection(0, 'this.hostname.is.invalid'); c.on('connect', common.mustNotCall()); c.on('error', common.mustCall(function(e) { assert.strictEqual(e.code, 'ENOTFOUND'); assert.strictEqual(e.port, 0); - assert.strictEqual(e.hostname, '***'); + assert.strictEqual(e.hostname, 'this.hostname.is.invalid'); })); diff --git a/test/parallel/test-net-connect-immediate-finish.js b/test/parallel/test-net-connect-immediate-finish.js index 1006a62d330..1b65ce15ab8 100644 --- a/test/parallel/test-net-connect-immediate-finish.js +++ b/test/parallel/test-net-connect-immediate-finish.js @@ -24,14 +24,17 @@ const common = require('../common'); const assert = require('assert'); const net = require('net'); -const client = net.connect({ host: '***', port: common.PORT }); +const client = net.connect({ + host: 'this.hostname.is.invalid', + port: common.PORT +}); client.once('error', common.mustCall((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.host, 'this.hostname.is.invalid'); assert.strictEqual(err.syscall, 'getaddrinfo'); }));