test: stabilize sandbox/doctor tests

This commit is contained in:
Peter Steinberger
2026-01-09 15:17:10 +01:00
parent fc7580ab5e
commit 2c5ec94843
3 changed files with 87 additions and 75 deletions

View File

@@ -52,7 +52,10 @@ describe("Agent-specific sandbox config", () => {
spawnCalls.length = 0;
});
it("should use global sandbox config when no agent-specific config exists", async () => {
it(
"should use global sandbox config when no agent-specific config exists",
{ timeout: 15_000 },
async () => {
const { resolveSandboxContext } = await import("./sandbox.js");
const cfg: ClawdbotConfig = {
@@ -80,7 +83,8 @@ describe("Agent-specific sandbox config", () => {
expect(context).toBeDefined();
expect(context?.enabled).toBe(true);
});
},
);
it("should allow agent-specific docker setupCommand overrides", async () => {
const { resolveSandboxContext } = await import("./sandbox.js");

View File

@@ -1,7 +1,10 @@
import { describe, expect, it } from "vitest";
describe("sandbox config merges", () => {
it("resolves sandbox scope deterministically", async () => {
it(
"resolves sandbox scope deterministically",
{ timeout: 15_000 },
async () => {
const { resolveSandboxScope } = await import("./sandbox.js");
expect(resolveSandboxScope({})).toBe("agent");
@@ -10,7 +13,8 @@ describe("sandbox config merges", () => {
expect(resolveSandboxScope({ perSession: true, scope: "agent" })).toBe(
"agent",
);
});
},
);
it("merges sandbox docker env and ulimits (agent wins)", async () => {
const { resolveSandboxDockerConfig } = await import("./sandbox.js");

View File

@@ -244,7 +244,10 @@ vi.mock("./doctor-state-migrations.js", () => ({
}));
describe("doctor", () => {
it("migrates routing.allowFrom to whatsapp.allowFrom", async () => {
it(
"migrates routing.allowFrom to whatsapp.allowFrom",
{ timeout: 15_000 },
async () => {
readConfigFileSnapshot.mockResolvedValue({
path: "/tmp/clawdbot.json",
exists: true,
@@ -289,7 +292,8 @@ describe("doctor", () => {
"+15555550123",
]);
expect(written.routing).toBeUndefined();
});
},
);
it("migrates legacy Clawdis services", async () => {
readConfigFileSnapshot.mockResolvedValue({