perf: trim sandbox context tests

This commit is contained in:
Peter Steinberger
2026-04-24 08:56:28 +01:00
parent 40be5ad581
commit 028b6c9b13
2 changed files with 12 additions and 1 deletions

View File

@@ -19,6 +19,10 @@ vi.mock("./sandbox/prune.js", () => ({
maybePruneSandboxes: vi.fn(async () => undefined),
}));
vi.mock("./sandbox/registry.js", () => ({
updateRegistry: vi.fn(async () => undefined),
}));
describe("sandbox skill mirroring", () => {
let envSnapshot: ReturnType<typeof captureEnv>;
let tempRoot = "";

View File

@@ -1,8 +1,14 @@
import { describe, expect, it } from "vitest";
import { describe, expect, it, vi } from "vitest";
import type { OpenClawConfig } from "../config/config.js";
import { registerSandboxBackend } from "./sandbox/backend.js";
import { ensureSandboxWorkspaceForSession, resolveSandboxContext } from "./sandbox/context.js";
const updateRegistryMock = vi.hoisted(() => vi.fn());
vi.mock("./sandbox/registry.js", () => ({
updateRegistry: updateRegistryMock,
}));
describe("resolveSandboxContext", () => {
it("does not sandbox the agent main session in non-main mode", async () => {
const cfg: OpenClawConfig = {
@@ -111,6 +117,7 @@ describe("resolveSandboxContext", () => {
mode: "all",
backend: "test-backend",
scope: "session",
workspaceAccess: "rw",
prune: { idleHours: 0, maxAgeDays: 0 },
},
},