diff options
author | Rich Trott <rtrott@gmail.com> | 2016-05-27 11:38:12 -0700 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2016-05-31 16:59:19 -0700 |
commit | 2f417c31930dbe5658a1c5d0356b9071bb5c5ad7 (patch) | |
tree | 2e803298e8e151920c48167b28ff775bd3655269 /test/parallel/test-https-strict.js | |
parent | 0d7f313325fd5c836874755c0d35c3455f9f401e (diff) | |
download | android-node-v8-2f417c31930dbe5658a1c5d0356b9071bb5c5ad7.tar.gz android-node-v8-2f417c31930dbe5658a1c5d0356b9071bb5c5ad7.tar.bz2 android-node-v8-2f417c31930dbe5658a1c5d0356b9071bb5c5ad7.zip |
test: fix spurious EADDRINUSE in test-https-strict
test-https-strict sometimes fails with EADDRINUSE in CI. Remove use of
common.PORT to make the test resistant from side effects from other
tests that may have not freed up the port.
PR-URL: https://github.com/nodejs/node/pull/7024
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'test/parallel/test-https-strict.js')
-rw-r--r-- | test/parallel/test-https-strict.js | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/test/parallel/test-https-strict.js b/test/parallel/test-https-strict.js index 9f845470b0..6744faacbc 100644 --- a/test/parallel/test-https-strict.js +++ b/test/parallel/test-https-strict.js @@ -65,13 +65,9 @@ var server3 = server(options3); var listenWait = 0; -var port = common.PORT; -var port1 = port++; -var port2 = port++; -var port3 = port++; -server1.listen(port1, listening()); -server2.listen(port2, listening()); -server3.listen(port3, listening()); +server1.listen(0, listening()); +server2.listen(0, listening()); +server3.listen(0, listening()); var responseErrors = {}; var expectResponseCount = 0; @@ -131,9 +127,9 @@ function makeReq(path, port, error, host, ca) { } var req = https.get(options); expectResponseCount++; - var server = port === port1 ? server1 - : port === port2 ? server2 - : port === port3 ? server3 + var server = port === server1.address().port ? server1 + : port === server2.address().port ? server2 + : port === server3.address().port ? server3 : null; if (!server) throw new Error('invalid port: ' + port); @@ -156,6 +152,10 @@ function makeReq(path, port, error, host, ca) { function allListening() { // ok, ready to start the tests! + const port1 = server1.address().port; + const port2 = server2.address().port; + const port3 = server3.address().port; + // server1: host 'agent1', signed by ca1 makeReq('/inv1', port1, 'UNABLE_TO_VERIFY_LEAF_SIGNATURE'); makeReq('/inv1-ca1', port1, |