From e5931554bf33dd0d3e088915f9c94456ba987569 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Tue, 24 Feb 2026 01:16:43 +0000 Subject: [PATCH] test: tighten slow test timeouts and cleanup --- src/agents/pi-embedded-runner.test.ts | 2 +- src/agents/sandbox-merge.test.ts | 8 ++++---- src/gateway/openai-http.test.ts | 3 ++- src/gateway/openresponses-http.test.ts | 2 +- src/gateway/server.agent.gateway-server-agent-b.test.ts | 2 +- src/gateway/server.cron.test.ts | 2 +- 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/agents/pi-embedded-runner.test.ts b/src/agents/pi-embedded-runner.test.ts index 342fff1c2a9..c0399d5dece 100644 --- a/src/agents/pi-embedded-runner.test.ts +++ b/src/agents/pi-embedded-runner.test.ts @@ -244,7 +244,7 @@ describe("runEmbeddedPiAgent", () => { it( "appends new user + assistant after existing transcript entries", - { timeout: 90_000 }, + { timeout: 20_000 }, async () => { const sessionFile = nextSessionFile(); const sessionKey = nextSessionKey(); diff --git a/src/agents/sandbox-merge.test.ts b/src/agents/sandbox-merge.test.ts index b35c3e7003f..77ad70b6209 100644 --- a/src/agents/sandbox-merge.test.ts +++ b/src/agents/sandbox-merge.test.ts @@ -15,14 +15,14 @@ describe("sandbox config merges", () => { } = await import("./sandbox.js")); }); - it("resolves sandbox scope deterministically", { timeout: 60_000 }, async () => { + it("resolves sandbox scope deterministically", () => { expect(resolveSandboxScope({})).toBe("agent"); expect(resolveSandboxScope({ perSession: true })).toBe("session"); expect(resolveSandboxScope({ perSession: false })).toBe("shared"); expect(resolveSandboxScope({ perSession: true, scope: "agent" })).toBe("agent"); }); - it("merges sandbox docker env and ulimits (agent wins)", async () => { + it("merges sandbox docker env and ulimits (agent wins)", () => { const resolved = resolveSandboxDockerConfig({ scope: "agent", globalDocker: { @@ -42,7 +42,7 @@ describe("sandbox config merges", () => { }); }); - it("resolves docker binds and shared-scope override behavior", async () => { + it("resolves docker binds and shared-scope override behavior", () => { for (const scenario of [ { name: "merges sandbox docker binds (global + agent combined)", @@ -105,7 +105,7 @@ describe("sandbox config merges", () => { } }); - it("applies per-agent browser and prune overrides (ignored under shared scope)", async () => { + it("applies per-agent browser and prune overrides (ignored under shared scope)", () => { const browser = resolveSandboxBrowserConfig({ scope: "agent", globalBrowser: { enabled: false, headless: false, enableNoVnc: true }, diff --git a/src/gateway/openai-http.test.ts b/src/gateway/openai-http.test.ts index e8571e88e90..5195af6fb56 100644 --- a/src/gateway/openai-http.test.ts +++ b/src/gateway/openai-http.test.ts @@ -69,6 +69,7 @@ async function expectChatCompletionsDisabled( messages: [{ role: "user", content: "hi" }], }); expect(res.status).toBe(404); + await res.text(); } finally { await server.close({ reason: "test done" }); } @@ -83,7 +84,7 @@ function parseSseDataLines(text: string): string[] { } describe("OpenAI-compatible HTTP API (e2e)", () => { - it("rejects when disabled (default + config)", { timeout: 120_000 }, async () => { + it("rejects when disabled (default + config)", { timeout: 15_000 }, async () => { await expectChatCompletionsDisabled(startServerWithDefaultConfig); await expectChatCompletionsDisabled((port) => startServer(port, { diff --git a/src/gateway/openresponses-http.test.ts b/src/gateway/openresponses-http.test.ts index ddab5abdb80..ba2af49e954 100644 --- a/src/gateway/openresponses-http.test.ts +++ b/src/gateway/openresponses-http.test.ts @@ -91,7 +91,7 @@ async function ensureResponseConsumed(res: Response) { } describe("OpenResponses HTTP API (e2e)", () => { - it("rejects when disabled (default + config)", { timeout: 30_000 }, async () => { + it("rejects when disabled (default + config)", { timeout: 15_000 }, async () => { const port = await getFreePort(); const server = await startServer(port); try { diff --git a/src/gateway/server.agent.gateway-server-agent-b.test.ts b/src/gateway/server.agent.gateway-server-agent-b.test.ts index bd4364aba75..dad0055ece1 100644 --- a/src/gateway/server.agent.gateway-server-agent-b.test.ts +++ b/src/gateway/server.agent.gateway-server-agent-b.test.ts @@ -338,7 +338,7 @@ describe("gateway server agent", () => { expect(second.payload).toEqual(firstFinal.payload); }); - test("agent dedupe survives reconnect", { timeout: 60_000 }, async () => { + test("agent dedupe survives reconnect", { timeout: 20_000 }, async () => { await withGatewayServer(async ({ port }) => { const dial = async () => { const ws = new WebSocket(`ws://127.0.0.1:${port}`); diff --git a/src/gateway/server.cron.test.ts b/src/gateway/server.cron.test.ts index 3e306e02bf3..959c8365228 100644 --- a/src/gateway/server.cron.test.ts +++ b/src/gateway/server.cron.test.ts @@ -118,7 +118,7 @@ describe("gateway server cron", () => { vi.useRealTimers(); }); - test("handles cron CRUD, normalization, and patch semantics", { timeout: 120_000 }, async () => { + test("handles cron CRUD, normalization, and patch semantics", { timeout: 20_000 }, async () => { const { prevSkipCron, dir } = await setupCronTestRun({ tempPrefix: "openclaw-gw-cron-", sessionConfig: { mainKey: "primary" },