test: make exec timeout coverage deterministic

This commit is contained in:
Peter Steinberger
2026-02-22 22:13:56 +00:00
parent 13db0b88f5
commit 84303f6a78

View File

@@ -164,27 +164,17 @@ describe("exec tool backgrounding", () => {
});
it("uses default timeout when timeout is omitted", async () => {
const customBash = createTestExecTool({ timeoutSec: 0.05, backgroundMs: 10 });
const customProcess = createProcessTool();
const result = await customBash.execute("call1", {
command: longDelayCmd,
background: true,
const customBash = createTestExecTool({
timeoutSec: 0.05,
backgroundMs: 10,
allowBackground: false,
});
const sessionId = (result.details as { sessionId: string }).sessionId;
await expect
.poll(
async () => {
const poll = await customProcess.execute("call2", {
action: "poll",
sessionId,
});
return (poll.details as { status: string }).status;
},
{ timeout: 1000, interval: POLL_INTERVAL_MS },
)
.toBe("failed");
await expect(
customBash.execute("call1", {
command: longDelayCmd,
}),
).rejects.toThrow(/timed out/i);
});
it("rejects elevated requests when not allowed", async () => {