test(sandbox): use focused modules in lightweight suites
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { buildSandboxCreateArgs, type SandboxDockerConfig } from "./sandbox.js";
|
||||
import { buildSandboxCreateArgs } from "./sandbox/docker.js";
|
||||
import type { SandboxDockerConfig } from "./sandbox/types.js";
|
||||
|
||||
describe("buildSandboxCreateArgs", () => {
|
||||
function createSandboxConfig(
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
import {
|
||||
formatSandboxToolPolicyBlockedMessage,
|
||||
resolveSandboxConfigForAgent,
|
||||
resolveSandboxToolPolicyForAgent,
|
||||
} from "./sandbox.js";
|
||||
import { resolveSandboxConfigForAgent } from "./sandbox/config.js";
|
||||
import { formatSandboxToolPolicyBlockedMessage } from "./sandbox/runtime-status.js";
|
||||
import { resolveSandboxToolPolicyForAgent } from "./sandbox/tool-policy.js";
|
||||
|
||||
describe("sandbox explain helpers", () => {
|
||||
it("prefers agent overrides > global > defaults (sandbox tool policy)", () => {
|
||||
|
||||
@@ -1,20 +1,12 @@
|
||||
import { beforeAll, describe, expect, it } from "vitest";
|
||||
|
||||
let resolveSandboxScope: typeof import("./sandbox.js").resolveSandboxScope;
|
||||
let resolveSandboxDockerConfig: typeof import("./sandbox.js").resolveSandboxDockerConfig;
|
||||
let resolveSandboxBrowserConfig: typeof import("./sandbox.js").resolveSandboxBrowserConfig;
|
||||
let resolveSandboxPruneConfig: typeof import("./sandbox.js").resolveSandboxPruneConfig;
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
resolveSandboxBrowserConfig,
|
||||
resolveSandboxDockerConfig,
|
||||
resolveSandboxPruneConfig,
|
||||
resolveSandboxScope,
|
||||
} from "./sandbox/config.js";
|
||||
|
||||
describe("sandbox config merges", () => {
|
||||
beforeAll(async () => {
|
||||
({
|
||||
resolveSandboxScope,
|
||||
resolveSandboxDockerConfig,
|
||||
resolveSandboxBrowserConfig,
|
||||
resolveSandboxPruneConfig,
|
||||
} = await import("./sandbox.js"));
|
||||
});
|
||||
|
||||
it("resolves sandbox scope deterministically", () => {
|
||||
expect(resolveSandboxScope({})).toBe("agent");
|
||||
expect(resolveSandboxScope({ perSession: true })).toBe("session");
|
||||
|
||||
@@ -4,7 +4,7 @@ import path from "node:path";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
import { captureFullEnv } from "../test-utils/env.js";
|
||||
import { resolveSandboxContext } from "./sandbox.js";
|
||||
import { resolveSandboxContext } from "./sandbox/context.js";
|
||||
import { writeSkill } from "./skills.e2e-test-helpers.js";
|
||||
|
||||
vi.mock("./sandbox/docker.js", () => ({
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
import { ensureSandboxWorkspaceForSession, resolveSandboxContext } from "./sandbox.js";
|
||||
import { ensureSandboxWorkspaceForSession, resolveSandboxContext } from "./sandbox/context.js";
|
||||
|
||||
describe("resolveSandboxContext", () => {
|
||||
it("does not sandbox the agent main session in non-main mode", async () => {
|
||||
|
||||
Reference in New Issue
Block a user