mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 16:48:26 +00:00
test: make exec timeout coverage deterministic
This commit is contained in:
@@ -164,27 +164,17 @@ describe("exec tool backgrounding", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("uses default timeout when timeout is omitted", async () => {
|
it("uses default timeout when timeout is omitted", async () => {
|
||||||
const customBash = createTestExecTool({ timeoutSec: 0.05, backgroundMs: 10 });
|
const customBash = createTestExecTool({
|
||||||
const customProcess = createProcessTool();
|
timeoutSec: 0.05,
|
||||||
|
backgroundMs: 10,
|
||||||
const result = await customBash.execute("call1", {
|
allowBackground: false,
|
||||||
command: longDelayCmd,
|
|
||||||
background: true,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const sessionId = (result.details as { sessionId: string }).sessionId;
|
await expect(
|
||||||
await expect
|
customBash.execute("call1", {
|
||||||
.poll(
|
command: longDelayCmd,
|
||||||
async () => {
|
}),
|
||||||
const poll = await customProcess.execute("call2", {
|
).rejects.toThrow(/timed out/i);
|
||||||
action: "poll",
|
|
||||||
sessionId,
|
|
||||||
});
|
|
||||||
return (poll.details as { status: string }).status;
|
|
||||||
},
|
|
||||||
{ timeout: 1000, interval: POLL_INTERVAL_MS },
|
|
||||||
)
|
|
||||||
.toBe("failed");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("rejects elevated requests when not allowed", async () => {
|
it("rejects elevated requests when not allowed", async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user