mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
test: use dynamic port in test-cluster-bind-twice
Remove common.PORT from test-cluster-bind-twice to eliminate possibility that a dynamic port used in another test will collide with common.PORT. PR-URL: https://github.com/nodejs/node/pull/12418 Ref: https://github.com/nodejs/node/issues/12376 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
415098f499
commit
30a045858a
@ -67,9 +67,8 @@ if (!id) {
|
||||
|
||||
|
||||
a.on('message', common.mustCall((m) => {
|
||||
if (typeof m === 'object') return;
|
||||
assert.strictEqual(m, 'READY');
|
||||
b.send('START');
|
||||
assert.strictEqual(m.msg, 'READY');
|
||||
b.send({msg: 'START', port: m.port});
|
||||
}));
|
||||
|
||||
b.on('message', common.mustCall((m) => {
|
||||
@ -81,10 +80,10 @@ if (!id) {
|
||||
} else if (id === 'one') {
|
||||
if (cluster.isMaster) return startWorker();
|
||||
|
||||
http.createServer(common.mustNotCall())
|
||||
.listen(common.PORT, common.mustCall(() => {
|
||||
process.send('READY');
|
||||
}));
|
||||
const server = http.createServer(common.mustNotCall());
|
||||
server.listen(0, common.mustCall(() => {
|
||||
process.send({msg: 'READY', port: server.address().port});
|
||||
}));
|
||||
|
||||
process.on('message', common.mustCall((m) => {
|
||||
if (m === 'QUIT') process.exit();
|
||||
@ -95,8 +94,8 @@ if (!id) {
|
||||
const server = http.createServer(common.mustNotCall());
|
||||
process.on('message', common.mustCall((m) => {
|
||||
if (m === 'QUIT') process.exit();
|
||||
assert.strictEqual(m, 'START');
|
||||
server.listen(common.PORT, common.mustNotCall());
|
||||
assert.strictEqual(m.msg, 'START');
|
||||
server.listen(m.port, common.mustNotCall());
|
||||
server.on('error', common.mustCall((e) => {
|
||||
assert.strictEqual(e.code, 'EADDRINUSE');
|
||||
process.send(e.code);
|
||||
|
Loading…
Reference in New Issue
Block a user