From 519793df151984449db56edf6ec8f18ac8ed117b Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Fri, 5 Feb 2016 11:46:47 +0100 Subject: [PATCH] test: fix test-net-* error code check for getaddrinfo(3) Replace '...' as invalid hostname with '***', which will give a more consisten error message on different systems. The hostname '...' returns EAI_AGAIN on musl libc and EAI_NONAME on most other systems. By changing the testcase we get same restult on all known platforms. --- test/parallel/test-net-better-error-messages-port-hostname.js | 4 ++-- test/parallel/test-net-connect-immediate-finish.js | 4 ++-- 2 files changed, 4 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 9db6fb26f57285..23089baf448a39 100644 --- a/test/parallel/test-net-better-error-messages-port-hostname.js +++ b/test/parallel/test-net-better-error-messages-port-hostname.js @@ -3,12 +3,12 @@ var common = require('../common'); var net = require('net'); var assert = require('assert'); -var c = net.createConnection(common.PORT, '...'); +var c = net.createConnection(common.PORT, '***'); c.on('connect', common.fail); c.on('error', common.mustCall(function(e) { assert.equal(e.code, 'ENOTFOUND'); assert.equal(e.port, common.PORT); - assert.equal(e.hostname, '...'); + assert.equal(e.hostname, '***'); })); diff --git a/test/parallel/test-net-connect-immediate-finish.js b/test/parallel/test-net-connect-immediate-finish.js index a5403732ec1d0d..6114233677f5cb 100644 --- a/test/parallel/test-net-connect-immediate-finish.js +++ b/test/parallel/test-net-connect-immediate-finish.js @@ -3,14 +3,14 @@ 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: '***', port: common.PORT}); 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.host, '***'); assert.strictEqual(err.syscall, 'getaddrinfo'); }));