perf(test): shorten process timeout fixtures

This commit is contained in:
Peter Steinberger
2026-02-18 04:27:01 +00:00
parent 46278e22cf
commit 308e09c876
2 changed files with 16 additions and 16 deletions

View File

@@ -38,10 +38,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(() => {}, 10_000)"], [process.execPath, "-e", "setTimeout(() => {}, 1_000)"],
{ {
timeoutMs: 5_000, timeoutMs: 1_000,
noOutputTimeoutMs: 50, noOutputTimeoutMs: 35,
}, },
); );
@@ -55,11 +55,11 @@ describe("runCommandWithTimeout", () => {
[ [
process.execPath, process.execPath,
"-e", "-e",
'let i=0; const t=setInterval(() => { process.stdout.write("."); i += 1; if (i >= 2) { clearInterval(t); process.exit(0); } }, 10);', 'let i=0; const t=setInterval(() => { process.stdout.write("."); i += 1; if (i >= 2) { clearInterval(t); process.exit(0); } }, 5);',
], ],
{ {
timeoutMs: 5_000, timeoutMs: 1_000,
noOutputTimeoutMs: 160, noOutputTimeoutMs: 120,
}, },
); );
@@ -72,7 +72,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(() => {}, 10_000)"], [process.execPath, "-e", "setTimeout(() => {}, 1_000)"],
{ {
timeoutMs: 15, timeoutMs: 15,
}, },

View File

@@ -9,7 +9,7 @@ describe("process supervisor", () => {
backendId: "test", backendId: "test",
mode: "child", mode: "child",
argv: [process.execPath, "-e", 'process.stdout.write("ok")'], argv: [process.execPath, "-e", 'process.stdout.write("ok")'],
timeoutMs: 2_000, timeoutMs: 800,
stdinMode: "pipe-closed", stdinMode: "pipe-closed",
}); });
const exit = await run.wait(); const exit = await run.wait();
@@ -24,9 +24,9 @@ describe("process supervisor", () => {
sessionId: "s1", sessionId: "s1",
backendId: "test", backendId: "test",
mode: "child", mode: "child",
argv: [process.execPath, "-e", "setTimeout(() => {}, 10_000)"], argv: [process.execPath, "-e", "setTimeout(() => {}, 1_000)"],
timeoutMs: 5_000, timeoutMs: 1_000,
noOutputTimeoutMs: 30, noOutputTimeoutMs: 20,
stdinMode: "pipe-closed", stdinMode: "pipe-closed",
}); });
const exit = await run.wait(); const exit = await run.wait();
@@ -42,8 +42,8 @@ describe("process supervisor", () => {
backendId: "test", backendId: "test",
scopeKey: "scope:a", scopeKey: "scope:a",
mode: "child", mode: "child",
argv: [process.execPath, "-e", "setTimeout(() => {}, 10_000)"], argv: [process.execPath, "-e", "setTimeout(() => {}, 1_000)"],
timeoutMs: 10_000, timeoutMs: 1_000,
stdinMode: "pipe-open", stdinMode: "pipe-open",
}); });
@@ -54,7 +54,7 @@ describe("process supervisor", () => {
replaceExistingScope: true, replaceExistingScope: true,
mode: "child", mode: "child",
argv: [process.execPath, "-e", 'process.stdout.write("new")'], argv: [process.execPath, "-e", 'process.stdout.write("new")'],
timeoutMs: 2_000, timeoutMs: 800,
stdinMode: "pipe-closed", stdinMode: "pipe-closed",
}); });
@@ -71,7 +71,7 @@ describe("process supervisor", () => {
sessionId: "s-timeout", sessionId: "s-timeout",
backendId: "test", backendId: "test",
mode: "child", mode: "child",
argv: [process.execPath, "-e", "setTimeout(() => {}, 10_000)"], argv: [process.execPath, "-e", "setTimeout(() => {}, 1_000)"],
timeoutMs: 1, timeoutMs: 1,
stdinMode: "pipe-closed", stdinMode: "pipe-closed",
}); });
@@ -88,7 +88,7 @@ describe("process supervisor", () => {
backendId: "test", backendId: "test",
mode: "child", mode: "child",
argv: [process.execPath, "-e", 'process.stdout.write("streamed")'], argv: [process.execPath, "-e", 'process.stdout.write("streamed")'],
timeoutMs: 2_000, timeoutMs: 800,
stdinMode: "pipe-closed", stdinMode: "pipe-closed",
captureOutput: false, captureOutput: false,
onStdout: (chunk) => { onStdout: (chunk) => {