Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 04ec97e

Browse filesBrowse files
TrottMylesBorins
authored andcommitted
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: #12418 Ref: #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>
1 parent 3244ae3 commit 04ec97e
Copy full SHA for 04ec97e

File tree

Expand file treeCollapse file tree

1 file changed

+8
-9
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+8
-9
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-cluster-bind-twice.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-cluster-bind-twice.js
+8-9Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,8 @@ if (!id) {
4646

4747

4848
a.on('message', common.mustCall((m) => {
49-
if (typeof m === 'object') return;
50-
assert.strictEqual(m, 'READY');
51-
b.send('START');
49+
assert.strictEqual(m.msg, 'READY');
50+
b.send({msg: 'START', port: m.port});
5251
}));
5352

5453
b.on('message', common.mustCall((m) => {
@@ -60,10 +59,10 @@ if (!id) {
6059
} else if (id === 'one') {
6160
if (cluster.isMaster) return startWorker();
6261

63-
http.createServer(common.mustNotCall())
64-
.listen(common.PORT, common.mustCall(() => {
65-
process.send('READY');
66-
}));
62+
const server = http.createServer(common.mustNotCall());
63+
server.listen(0, common.mustCall(() => {
64+
process.send({msg: 'READY', port: server.address().port});
65+
}));
6766

6867
process.on('message', common.mustCall((m) => {
6968
if (m === 'QUIT') process.exit();
@@ -74,8 +73,8 @@ if (!id) {
7473
const server = http.createServer(common.mustNotCall());
7574
process.on('message', common.mustCall((m) => {
7675
if (m === 'QUIT') process.exit();
77-
assert.strictEqual(m, 'START');
78-
server.listen(common.PORT, common.mustNotCall());
76+
assert.strictEqual(m.msg, 'START');
77+
server.listen(m.port, common.mustNotCall());
7978
server.on('error', common.mustCall((e) => {
8079
assert.strictEqual(e.code, 'EADDRINUSE');
8180
process.send(e.code);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.