mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-07 16:41:23 +00:00
test: shorten process timeout waits in exec and supervisor suites
This commit is contained in:
@@ -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,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|||||||
Reference in New Issue
Block a user