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 53d5aac

Browse filesBrowse files
Sebastian PlesciucMylesBorins
authored andcommitted
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: #12571 Ref: #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>
1 parent 00b6646 commit 53d5aac
Copy full SHA for 53d5aac

File tree

Expand file treeCollapse file tree

1 file changed

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

1 file changed

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

‎test/parallel/test-cluster-ipc-throw.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-cluster-ipc-throw.js
+8-5Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,23 @@
22
const common = require('../common');
33
const http = require('http');
44
const cluster = require('cluster');
5+
const assert = require('assert');
56

67
cluster.schedulingPolicy = cluster.SCHED_RR;
78

89
const server = http.createServer();
910

1011
if (cluster.isMaster) {
11-
server.listen(common.PORT);
12-
const worker = cluster.fork();
13-
worker.on('exit', common.mustCall(() => {
14-
server.close();
12+
server.listen({port: 0}, common.mustCall(() => {
13+
const worker = cluster.fork({PORT: server.address().port});
14+
worker.on('exit', common.mustCall(() => {
15+
server.close();
16+
}));
1517
}));
1618
} else {
19+
assert(process.env.PORT);
1720
process.on('uncaughtException', common.mustCall((e) => {}));
18-
server.listen(common.PORT);
21+
server.listen(process.env.PORT);
1922
server.on('error', common.mustCall((e) => {
2023
cluster.worker.disconnect();
2124
throw e;

0 commit comments

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