diff options
author | Santiago Gimeno <santiago.gimeno@gmail.com> | 2016-08-21 21:04:23 +0200 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2016-08-22 15:21:28 -0700 |
commit | 64cbe7aa9e5613d1e98fa101034b2a087e8a8398 (patch) | |
tree | 48ee2be5ed66db5cb1176fbf713444c3ee970182 /test/sequential/test-child-process-pass-fd.js | |
parent | 3242b27b54177fee8e7cc341a2911afa3ae50ed6 (diff) | |
download | node-new-64cbe7aa9e5613d1e98fa101034b2a087e8a8398.tar.gz |
test: fix flaky `test-child-process-pass-fd`
Listen on random ports instead of using `common.PORT`.
Fixes: https://github.com/nodejs/node/issues/8209
PR-URL: https://github.com/nodejs/node/pull/8212
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yorkie Liu <yorkiefixer@gmail.com>
Diffstat (limited to 'test/sequential/test-child-process-pass-fd.js')
-rw-r--r-- | test/sequential/test-child-process-pass-fd.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/test/sequential/test-child-process-pass-fd.js b/test/sequential/test-child-process-pass-fd.js index a49baa31a9..c1d115f9a9 100644 --- a/test/sequential/test-child-process-pass-fd.js +++ b/test/sequential/test-child-process-pass-fd.js @@ -14,7 +14,7 @@ const N = 80; if (process.argv[2] !== 'child') { for (let i = 0; i < N; ++i) { - const worker = fork(__filename, ['child', common.PORT + i]); + const worker = fork(__filename, ['child']); worker.once('message', common.mustCall((msg, handle) => { assert.strictEqual(msg, 'handle'); assert.ok(handle); @@ -33,7 +33,6 @@ if (process.argv[2] !== 'child') { } } else { let socket; - const port = process.argv[3]; let cbcalls = 0; function socketConnected() { if (++cbcalls === 2) @@ -47,7 +46,8 @@ if (process.argv[2] !== 'child') { }); socketConnected(); }); - server.listen(port, common.localhostIPv4, () => { + server.listen(0, common.localhostIPv4, () => { + const port = server.address().port; socket = net.connect(port, common.localhostIPv4, socketConnected); }); } |