test: shorten process timeout waits in exec and supervisor suites

This commit is contained in:
Peter Steinberger
2026-02-16 04:45:44 +00:00
parent 17d8e2a1c8
commit 795874711b
2 changed files with 5 additions and 5 deletions

View File

@@ -41,7 +41,7 @@ describe("runCommandWithTimeout", () => {
[process.execPath, "-e", "setTimeout(() => {}, 10_000)"], [process.execPath, "-e", "setTimeout(() => {}, 10_000)"],
{ {
timeoutMs: 5_000, timeoutMs: 5_000,
noOutputTimeoutMs: 80, noOutputTimeoutMs: 70,
}, },
); );
@@ -55,7 +55,7 @@ describe("runCommandWithTimeout", () => {
[ [
process.execPath, process.execPath,
"-e", "-e",
'let i=0; const t=setInterval(() => { process.stdout.write("."); i += 1; if (i >= 3) { clearInterval(t); process.exit(0); } }, 15);', 'let i=0; const t=setInterval(() => { process.stdout.write("."); i += 1; if (i >= 2) { clearInterval(t); process.exit(0); } }, 10);',
], ],
{ {
timeoutMs: 5_000, timeoutMs: 5_000,
@@ -66,14 +66,14 @@ describe("runCommandWithTimeout", () => {
expect(result.code).toBe(0); expect(result.code).toBe(0);
expect(result.termination).toBe("exit"); expect(result.termination).toBe("exit");
expect(result.noOutputTimedOut).toBe(false); expect(result.noOutputTimedOut).toBe(false);
expect(result.stdout.length).toBeGreaterThanOrEqual(3); expect(result.stdout.length).toBeGreaterThanOrEqual(2);
}); });
it("reports global timeout termination when overall timeout elapses", async () => { it("reports global timeout termination when overall timeout elapses", async () => {
const result = await runCommandWithTimeout( const result = await runCommandWithTimeout(
[process.execPath, "-e", "setTimeout(() => {}, 10_000)"], [process.execPath, "-e", "setTimeout(() => {}, 10_000)"],
{ {
timeoutMs: 40, timeoutMs: 30,
}, },
); );

View File

@@ -26,7 +26,7 @@ describe("process supervisor", () => {
mode: "child", mode: "child",
argv: [process.execPath, "-e", "setTimeout(() => {}, 10_000)"], argv: [process.execPath, "-e", "setTimeout(() => {}, 10_000)"],
timeoutMs: 5_000, timeoutMs: 5_000,
noOutputTimeoutMs: 55, noOutputTimeoutMs: 45,
stdinMode: "pipe-closed", stdinMode: "pipe-closed",
}); });
const exit = await run.wait(); const exit = await run.wait();