Skip to content

Commit 6ee0974

Browse files
committed
test: shorten process-group timeout proof
1 parent e09aba1 commit 6ee0974

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

‎test/scripts/prepare-extension-package-boundary-artifacts.test.ts‎

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -360,24 +360,23 @@ describe("prepare-extension-package-boundary-artifacts", () => {
360360
const descendantPidPath = path.join(rootDir, "descendant.pid");
361361
let descendantPid = 0;
362362
const descendantScript = [
363-
"const fs = require('node:fs');",
364-
`fs.writeFileSync(${JSON.stringify(descendantPidPath)}, String(process.pid));`,
365363
"process.on('SIGTERM', () => {});",
366364
"setInterval(() => {}, 1000);",
367365
].join("\n");
368366
const parentScript = [
369367
"const { spawn } = require('node:child_process');",
370-
`spawn(process.execPath, ["--eval", ${JSON.stringify(descendantScript)}], { stdio: "ignore" });`,
368+
"const fs = require('node:fs');",
369+
`const descendant = spawn(process.execPath, ["--eval", ${JSON.stringify(descendantScript)}], { stdio: "ignore" });`,
370+
`fs.writeFileSync(${JSON.stringify(descendantPidPath)}, String(descendant.pid));`,
371371
"setInterval(() => {}, 1000);",
372372
].join("\n");
373373

374374
try {
375-
// The timeout clock starts at spawn, so it must leave room for two Node
376-
// boots (parent + descendant) under parallel-suite load; otherwise the
377-
// group is killed before the descendant ever writes its pid.
378-
const command = runNodeStep("hung-group-prep", ["--eval", parentScript], 5_000);
375+
// The parent records the descendant pid immediately after spawn, so this
376+
// needs headroom for only one Node boot under parallel-suite load.
377+
const command = runNodeStep("hung-group-prep", ["--eval", parentScript], 2_000);
379378
const expectedFailure = expect(command).rejects.toThrow(
380-
"hung-group-prep timed out after 5000ms",
379+
"hung-group-prep timed out after 2000ms",
381380
);
382381
descendantPid = Number.parseInt(await waitForFile(descendantPidPath, 4_000), 10);
383382

0 commit comments

Comments
 (0)