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 bb6d6a6

Browse filesBrowse files
santigimenoevanlucas
authored andcommitted
test: fix flaky test-child-process-pass-fd
Listen on random ports instead of using `common.PORT`. Fixes: #8209 PR-URL: #8212 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yorkie Liu <yorkiefixer@gmail.com>
1 parent e371545 commit bb6d6a6
Copy full SHA for bb6d6a6

File tree

Expand file treeCollapse file tree

1 file changed

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

1 file changed

+3
-3
lines changed
Open diff view settings
Collapse file

‎test/sequential/test-child-process-pass-fd.js‎

Copy file name to clipboardExpand all lines: test/sequential/test-child-process-pass-fd.js
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const N = 80;
1414

1515
if (process.argv[2] !== 'child') {
1616
for (let i = 0; i < N; ++i) {
17-
const worker = fork(__filename, ['child', common.PORT + i]);
17+
const worker = fork(__filename, ['child']);
1818
worker.once('message', common.mustCall((msg, handle) => {
1919
assert.strictEqual(msg, 'handle');
2020
assert.ok(handle);
@@ -33,7 +33,6 @@ if (process.argv[2] !== 'child') {
3333
}
3434
} else {
3535
let socket;
36-
const port = process.argv[3];
3736
let cbcalls = 0;
3837
function socketConnected() {
3938
if (++cbcalls === 2)
@@ -47,7 +46,8 @@ if (process.argv[2] !== 'child') {
4746
});
4847
socketConnected();
4948
});
50-
server.listen(port, common.localhostIPv4, () => {
49+
server.listen(0, common.localhostIPv4, () => {
50+
const port = server.address().port;
5151
socket = net.connect(port, common.localhostIPv4, socketConnected);
5252
});
5353
}

0 commit comments

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