From 9ea65bf2b9771503635198e68464e6c39120026a Mon Sep 17 00:00:00 2001 From: Ahmed Taj elsir Date: Mon, 17 Apr 2017 14:23:21 +0300 Subject: [PATCH] test: remove uses of common.PORT in test-tls-client tests Change common.PORT to '0' to avoid the possibility of getting EADDRINUSE error if another test in 'parallel' uses port '0' at the same time. PR-URL: https://github.com/nodejs/node/pull/12461 Ref: https://github.com/nodejs/node/issues/12376 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Rich Trott Reviewed-By: Santiago Gimeno --- test/parallel/test-tls-client-abort.js | 4 +--- test/parallel/test-tls-client-abort2.js | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/test/parallel/test-tls-client-abort.js b/test/parallel/test-tls-client-abort.js index 21ee41e927873b..bd5db779785de1 100644 --- a/test/parallel/test-tls-client-abort.js +++ b/test/parallel/test-tls-client-abort.js @@ -14,9 +14,7 @@ const path = require('path'); const cert = fs.readFileSync(path.join(common.fixturesDir, 'test_cert.pem')); const key = fs.readFileSync(path.join(common.fixturesDir, 'test_key.pem')); -const conn = tls.connect({cert: cert, key: key, port: common.PORT}, function() { - assert.ok(false); // callback should never be executed -}); +const conn = tls.connect({cert, key, port: 0}, common.mustNotCall()); conn.on('error', function() { }); assert.doesNotThrow(function() { diff --git a/test/parallel/test-tls-client-abort2.js b/test/parallel/test-tls-client-abort2.js index 3698db7a3cf6d0..521ef6bee782e5 100644 --- a/test/parallel/test-tls-client-abort2.js +++ b/test/parallel/test-tls-client-abort2.js @@ -8,7 +8,7 @@ if (!common.hasCrypto) { } const tls = require('tls'); -const conn = tls.connect(common.PORT, common.mustNotCall()); +const conn = tls.connect(0, common.mustNotCall()); conn.on('error', common.mustCall(function() { assert.doesNotThrow(function() { conn.destroy();