diff options
author | Sebastian Plesciuc <sebastian.plesciuc@sendgrid.com> | 2017-04-21 18:05:28 +0300 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2017-04-24 13:33:18 -0700 |
commit | ee8183ed85e487ea75d5a5dcc26d866afa90113f (patch) | |
tree | 5051d0e70a2caf9f25aa0239df00104aa22e2ffd /test | |
parent | c005ebb0ce3888c7fc6d088fab75561c29c2a31c (diff) | |
download | android-node-v8-ee8183ed85e487ea75d5a5dcc26d866afa90113f.tar.gz android-node-v8-ee8183ed85e487ea75d5a5dcc26d866afa90113f.tar.bz2 android-node-v8-ee8183ed85e487ea75d5a5dcc26d866afa90113f.zip |
test: dynamic port in cluster ipc throw
Removed common.PORT from test-cluster-ipc-throw to eliminate the
possibility that a dynamic port used in another test will collide
with common.PORT.
PR-URL: https://github.com/nodejs/node/pull/12571
Ref: https://github.com/nodejs/node/issues/12376
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/parallel/test-cluster-ipc-throw.js | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/test/parallel/test-cluster-ipc-throw.js b/test/parallel/test-cluster-ipc-throw.js index f2e7f2822c..95c5d84ea6 100644 --- a/test/parallel/test-cluster-ipc-throw.js +++ b/test/parallel/test-cluster-ipc-throw.js @@ -2,20 +2,23 @@ const common = require('../common'); const http = require('http'); const cluster = require('cluster'); +const assert = require('assert'); cluster.schedulingPolicy = cluster.SCHED_RR; const server = http.createServer(); if (cluster.isMaster) { - server.listen(common.PORT); - const worker = cluster.fork(); - worker.on('exit', common.mustCall(() => { - server.close(); + server.listen({port: 0}, common.mustCall(() => { + const worker = cluster.fork({PORT: server.address().port}); + worker.on('exit', common.mustCall(() => { + server.close(); + })); })); } else { + assert(process.env.PORT); process.on('uncaughtException', common.mustCall((e) => {})); - server.listen(common.PORT); + server.listen(process.env.PORT); server.on('error', common.mustCall((e) => { cluster.worker.disconnect(); throw e; |