test: tighten process timeout fixtures

This commit is contained in:
Peter Steinberger
2026-02-22 16:30:52 +00:00
parent b1a97e77ca
commit d01cc69ef0
2 changed files with 15 additions and 15 deletions

View File

@@ -34,10 +34,10 @@ describe("runCommandWithTimeout", () => {
it("kills command when no output timeout elapses", async () => { it("kills command when no output timeout elapses", async () => {
const result = await runCommandWithTimeout( const result = await runCommandWithTimeout(
[process.execPath, "-e", "setTimeout(() => {}, 60)"], [process.execPath, "-e", "setTimeout(() => {}, 40)"],
{ {
timeoutMs: 1_000, timeoutMs: 500,
noOutputTimeoutMs: 35, noOutputTimeoutMs: 20,
}, },
); );
@@ -51,11 +51,11 @@ describe("runCommandWithTimeout", () => {
[ [
process.execPath, process.execPath,
"-e", "-e",
'process.stdout.write("."); setTimeout(() => process.stdout.write("."), 30); setTimeout(() => process.exit(0), 60);', 'process.stdout.write("."); setTimeout(() => process.stdout.write("."), 20); setTimeout(() => process.exit(0), 40);',
], ],
{ {
timeoutMs: 1_000, timeoutMs: 500,
noOutputTimeoutMs: 500, noOutputTimeoutMs: 250,
}, },
); );
@@ -68,7 +68,7 @@ describe("runCommandWithTimeout", () => {
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(() => {}, 60)"], [process.execPath, "-e", "setTimeout(() => {}, 40)"],
{ {
timeoutMs: 15, timeoutMs: 15,
}, },

View File

@@ -19,7 +19,7 @@ describe("process supervisor", () => {
const run = await spawnChild(supervisor, { const run = await spawnChild(supervisor, {
sessionId: "s1", sessionId: "s1",
argv: [process.execPath, "-e", 'process.stdout.write("ok")'], argv: [process.execPath, "-e", 'process.stdout.write("ok")'],
timeoutMs: 2_500, timeoutMs: 1_000,
stdinMode: "pipe-closed", stdinMode: "pipe-closed",
}); });
const exit = await run.wait(); const exit = await run.wait();
@@ -32,8 +32,8 @@ describe("process supervisor", () => {
const supervisor = createProcessSupervisor(); const supervisor = createProcessSupervisor();
const run = await spawnChild(supervisor, { const run = await spawnChild(supervisor, {
sessionId: "s1", sessionId: "s1",
argv: [process.execPath, "-e", "setTimeout(() => {}, 60)"], argv: [process.execPath, "-e", "setTimeout(() => {}, 40)"],
timeoutMs: 1_000, timeoutMs: 500,
noOutputTimeoutMs: 20, noOutputTimeoutMs: 20,
stdinMode: "pipe-closed", stdinMode: "pipe-closed",
}); });
@@ -48,8 +48,8 @@ describe("process supervisor", () => {
const first = await spawnChild(supervisor, { const first = await spawnChild(supervisor, {
sessionId: "s1", sessionId: "s1",
scopeKey: "scope:a", scopeKey: "scope:a",
argv: [process.execPath, "-e", "setTimeout(() => {}, 60)"], argv: [process.execPath, "-e", "setTimeout(() => {}, 40)"],
timeoutMs: 1_000, timeoutMs: 500,
stdinMode: "pipe-open", stdinMode: "pipe-open",
}); });
@@ -58,7 +58,7 @@ describe("process supervisor", () => {
scopeKey: "scope:a", scopeKey: "scope:a",
replaceExistingScope: true, replaceExistingScope: true,
argv: [process.execPath, "-e", 'process.stdout.write("new")'], argv: [process.execPath, "-e", 'process.stdout.write("new")'],
timeoutMs: 2_500, timeoutMs: 1_000,
stdinMode: "pipe-closed", stdinMode: "pipe-closed",
}); });
@@ -73,7 +73,7 @@ describe("process supervisor", () => {
const supervisor = createProcessSupervisor(); const supervisor = createProcessSupervisor();
const run = await spawnChild(supervisor, { const run = await spawnChild(supervisor, {
sessionId: "s-timeout", sessionId: "s-timeout",
argv: [process.execPath, "-e", "setTimeout(() => {}, 60)"], argv: [process.execPath, "-e", "setTimeout(() => {}, 40)"],
timeoutMs: 1, timeoutMs: 1,
stdinMode: "pipe-closed", stdinMode: "pipe-closed",
}); });
@@ -88,7 +88,7 @@ describe("process supervisor", () => {
const run = await spawnChild(supervisor, { const run = await spawnChild(supervisor, {
sessionId: "s-capture", sessionId: "s-capture",
argv: [process.execPath, "-e", 'process.stdout.write("streamed")'], argv: [process.execPath, "-e", 'process.stdout.write("streamed")'],
timeoutMs: 2_500, timeoutMs: 1_000,
stdinMode: "pipe-closed", stdinMode: "pipe-closed",
captureOutput: false, captureOutput: false,
onStdout: (chunk) => { onStdout: (chunk) => {