summaryrefslogtreecommitdiff
path: root/test/parallel/test-stream-base-no-abort.js
diff options
context:
space:
mode:
authorBrian White <mscdex@mscdex.net>2016-05-29 03:06:56 -0400
committerEvan Lucas <evanlucas@me.com>2016-06-15 18:12:31 -0500
commiteded11705b30b8e07df3f17af2661ebf0fc8ec6b (patch)
treef435a43645c4095a92add479a6b31e7621836e26 /test/parallel/test-stream-base-no-abort.js
parent27ed7fc56c24cac8bc2622a39e8902a888d984e5 (diff)
downloadnode-new-eded11705b30b8e07df3f17af2661ebf0fc8ec6b.tar.gz
test: use random ports where possible
This helps to prevent issues where a failed test can keep a bound socket open long enough to cause other tests to fail with EADDRINUSE because the same port number is used. PR-URL: https://github.com/nodejs/node/pull/7045 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Rod Vagg <rod@vagg.org>
Diffstat (limited to 'test/parallel/test-stream-base-no-abort.js')
-rw-r--r--test/parallel/test-stream-base-no-abort.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/test/parallel/test-stream-base-no-abort.js b/test/parallel/test-stream-base-no-abort.js
index d2d8702676..85840c4c1c 100644
--- a/test/parallel/test-stream-base-no-abort.js
+++ b/test/parallel/test-stream-base-no-abort.js
@@ -41,8 +41,9 @@ const checkTLS = common.mustCall(function checkTLS() {
cert: fs.readFileSync(common.fixturesDir + '/keys/ec-cert.pem')
};
const server = tls.createServer(options, () => {})
- .listen(common.PORT, function() {
- tls.connect(common.PORT, { rejectUnauthorized: false }, function() {
+ .listen(0, function() {
+ const connectOpts = { rejectUnauthorized: false };
+ tls.connect(this.address().port, connectOpts, function() {
this.destroy();
server.close();
});
@@ -50,7 +51,7 @@ const checkTLS = common.mustCall(function checkTLS() {
});
const checkTCP = common.mustCall(function checkTCP() {
- net.createServer(() => {}).listen(common.PORT, function() {
+ net.createServer(() => {}).listen(0, function() {
this.close(checkTLS);
});
});