From 38098442ca1a5ffc2fab2d0053931f1e06454e42 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sat, 14 Feb 2026 01:26:05 +0000 Subject: [PATCH] perf(test): reduce setup churn in block streaming and docker tests --- src/auto-reply/reply.block-streaming.test.ts | 25 ++++++++++---------- src/docker-setup.test.ts | 13 +++------- 2 files changed, 16 insertions(+), 22 deletions(-) diff --git a/src/auto-reply/reply.block-streaming.test.ts b/src/auto-reply/reply.block-streaming.test.ts index a2fa0160f66..2dde400bc2f 100644 --- a/src/auto-reply/reply.block-streaming.test.ts +++ b/src/auto-reply/reply.block-streaming.test.ts @@ -2,7 +2,6 @@ import fs from "node:fs/promises"; import os from "node:os"; import path from "node:path"; import { afterAll, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; -import { withTempHome as withTempHomeBase } from "../../test/helpers/temp-home.js"; import { loadModelCatalog } from "../agents/model-catalog.js"; import { getReplyFromConfig } from "./reply.js"; @@ -95,7 +94,12 @@ describe("block streaming", () => { }); afterAll(async () => { - await fs.rm(fixtureRoot, { recursive: true, force: true }); + await fs.rm(fixtureRoot, { + recursive: true, + force: true, + maxRetries: 10, + retryDelay: 50, + }); }); beforeEach(() => { @@ -263,13 +267,9 @@ describe("block streaming", () => { expect(resStreamMode?.text).toBe("final"); expect(onBlockReplyStreamMode).not.toHaveBeenCalled(); - }); - }); - - it("queues followups for collect + summarize modes", async () => { - vi.useFakeTimers(); - await withTempHomeBase( - async (home) => { + vi.useFakeTimers(); + try { + piEmbeddedMock.runEmbeddedPiAgent.mockReset(); const prompts: string[] = []; piEmbeddedMock.runEmbeddedPiAgent.mockImplementation(async (params) => { prompts.push(params.prompt); @@ -357,8 +357,9 @@ describe("block streaming", () => { await vi.advanceTimersByTimeAsync(50); await Promise.resolve(); expect(prompts.some((p) => p.includes("[Queue overflow]"))).toBe(true); - }, - { prefix: "openclaw-queue-" }, - ); + } finally { + vi.useRealTimers(); + } + }); }); }); diff --git a/src/docker-setup.test.ts b/src/docker-setup.test.ts index 9060359e6c7..07b349c76d8 100644 --- a/src/docker-setup.test.ts +++ b/src/docker-setup.test.ts @@ -152,19 +152,12 @@ describe("docker-setup.sh", () => { return; } - const sandbox = await createDockerSetupSandbox(); - const env = createEnv(sandbox, { - OPENCLAW_EXTRA_MOUNTS: "", - OPENCLAW_HOME_VOLUME: "", - }); - const result = spawnSync(systemBash, [sandbox.scriptPath], { - cwd: sandbox.rootDir, - env, + const syntaxCheck = spawnSync(systemBash, ["-n", join(repoRoot, "docker-setup.sh")], { encoding: "utf8", }); - expect(result.status).toBe(0); - expect(result.stderr).not.toContain("declare: -A: invalid option"); + expect(syntaxCheck.status).toBe(0); + expect(syntaxCheck.stderr).not.toContain("declare: -A: invalid option"); }); it("keeps docker-compose gateway command in sync", async () => {