test: tighten slow test timeouts and cleanup

This commit is contained in:
Peter Steinberger
2026-02-24 01:16:43 +00:00
parent 6c43d0a08e
commit e5931554bf
6 changed files with 10 additions and 9 deletions

View File

@@ -244,7 +244,7 @@ describe("runEmbeddedPiAgent", () => {
it( it(
"appends new user + assistant after existing transcript entries", "appends new user + assistant after existing transcript entries",
{ timeout: 90_000 }, { timeout: 20_000 },
async () => { async () => {
const sessionFile = nextSessionFile(); const sessionFile = nextSessionFile();
const sessionKey = nextSessionKey(); const sessionKey = nextSessionKey();

View File

@@ -15,14 +15,14 @@ describe("sandbox config merges", () => {
} = await import("./sandbox.js")); } = await import("./sandbox.js"));
}); });
it("resolves sandbox scope deterministically", { timeout: 60_000 }, async () => { it("resolves sandbox scope deterministically", () => {
expect(resolveSandboxScope({})).toBe("agent"); expect(resolveSandboxScope({})).toBe("agent");
expect(resolveSandboxScope({ perSession: true })).toBe("session"); expect(resolveSandboxScope({ perSession: true })).toBe("session");
expect(resolveSandboxScope({ perSession: false })).toBe("shared"); expect(resolveSandboxScope({ perSession: false })).toBe("shared");
expect(resolveSandboxScope({ perSession: true, scope: "agent" })).toBe("agent"); 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({ const resolved = resolveSandboxDockerConfig({
scope: "agent", scope: "agent",
globalDocker: { 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 [ for (const scenario of [
{ {
name: "merges sandbox docker binds (global + agent combined)", 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({ const browser = resolveSandboxBrowserConfig({
scope: "agent", scope: "agent",
globalBrowser: { enabled: false, headless: false, enableNoVnc: true }, globalBrowser: { enabled: false, headless: false, enableNoVnc: true },

View File

@@ -69,6 +69,7 @@ async function expectChatCompletionsDisabled(
messages: [{ role: "user", content: "hi" }], messages: [{ role: "user", content: "hi" }],
}); });
expect(res.status).toBe(404); expect(res.status).toBe(404);
await res.text();
} finally { } finally {
await server.close({ reason: "test done" }); await server.close({ reason: "test done" });
} }
@@ -83,7 +84,7 @@ function parseSseDataLines(text: string): string[] {
} }
describe("OpenAI-compatible HTTP API (e2e)", () => { 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(startServerWithDefaultConfig);
await expectChatCompletionsDisabled((port) => await expectChatCompletionsDisabled((port) =>
startServer(port, { startServer(port, {

View File

@@ -91,7 +91,7 @@ async function ensureResponseConsumed(res: Response) {
} }
describe("OpenResponses HTTP API (e2e)", () => { 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 port = await getFreePort();
const server = await startServer(port); const server = await startServer(port);
try { try {

View File

@@ -338,7 +338,7 @@ describe("gateway server agent", () => {
expect(second.payload).toEqual(firstFinal.payload); 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 }) => { await withGatewayServer(async ({ port }) => {
const dial = async () => { const dial = async () => {
const ws = new WebSocket(`ws://127.0.0.1:${port}`); const ws = new WebSocket(`ws://127.0.0.1:${port}`);

View File

@@ -118,7 +118,7 @@ describe("gateway server cron", () => {
vi.useRealTimers(); 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({ const { prevSkipCron, dir } = await setupCronTestRun({
tempPrefix: "openclaw-gw-cron-", tempPrefix: "openclaw-gw-cron-",
sessionConfig: { mainKey: "primary" }, sessionConfig: { mainKey: "primary" },