test: stabilize sandbox/doctor tests
This commit is contained in:
@@ -52,7 +52,10 @@ describe("Agent-specific sandbox config", () => {
|
|||||||
spawnCalls.length = 0;
|
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 { resolveSandboxContext } = await import("./sandbox.js");
|
||||||
|
|
||||||
const cfg: ClawdbotConfig = {
|
const cfg: ClawdbotConfig = {
|
||||||
@@ -80,7 +83,8 @@ describe("Agent-specific sandbox config", () => {
|
|||||||
|
|
||||||
expect(context).toBeDefined();
|
expect(context).toBeDefined();
|
||||||
expect(context?.enabled).toBe(true);
|
expect(context?.enabled).toBe(true);
|
||||||
});
|
},
|
||||||
|
);
|
||||||
|
|
||||||
it("should allow agent-specific docker setupCommand overrides", async () => {
|
it("should allow agent-specific docker setupCommand overrides", async () => {
|
||||||
const { resolveSandboxContext } = await import("./sandbox.js");
|
const { resolveSandboxContext } = await import("./sandbox.js");
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
import { describe, expect, it } from "vitest";
|
import { describe, expect, it } from "vitest";
|
||||||
|
|
||||||
describe("sandbox config merges", () => {
|
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");
|
const { resolveSandboxScope } = await import("./sandbox.js");
|
||||||
|
|
||||||
expect(resolveSandboxScope({})).toBe("agent");
|
expect(resolveSandboxScope({})).toBe("agent");
|
||||||
@@ -10,7 +13,8 @@ describe("sandbox config merges", () => {
|
|||||||
expect(resolveSandboxScope({ perSession: true, scope: "agent" })).toBe(
|
expect(resolveSandboxScope({ perSession: true, scope: "agent" })).toBe(
|
||||||
"agent",
|
"agent",
|
||||||
);
|
);
|
||||||
});
|
},
|
||||||
|
);
|
||||||
|
|
||||||
it("merges sandbox docker env and ulimits (agent wins)", async () => {
|
it("merges sandbox docker env and ulimits (agent wins)", async () => {
|
||||||
const { resolveSandboxDockerConfig } = await import("./sandbox.js");
|
const { resolveSandboxDockerConfig } = await import("./sandbox.js");
|
||||||
|
|||||||
@@ -244,7 +244,10 @@ vi.mock("./doctor-state-migrations.js", () => ({
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
describe("doctor", () => {
|
describe("doctor", () => {
|
||||||
it("migrates routing.allowFrom to whatsapp.allowFrom", async () => {
|
it(
|
||||||
|
"migrates routing.allowFrom to whatsapp.allowFrom",
|
||||||
|
{ timeout: 15_000 },
|
||||||
|
async () => {
|
||||||
readConfigFileSnapshot.mockResolvedValue({
|
readConfigFileSnapshot.mockResolvedValue({
|
||||||
path: "/tmp/clawdbot.json",
|
path: "/tmp/clawdbot.json",
|
||||||
exists: true,
|
exists: true,
|
||||||
@@ -289,7 +292,8 @@ describe("doctor", () => {
|
|||||||
"+15555550123",
|
"+15555550123",
|
||||||
]);
|
]);
|
||||||
expect(written.routing).toBeUndefined();
|
expect(written.routing).toBeUndefined();
|
||||||
});
|
},
|
||||||
|
);
|
||||||
|
|
||||||
it("migrates legacy Clawdis services", async () => {
|
it("migrates legacy Clawdis services", async () => {
|
||||||
readConfigFileSnapshot.mockResolvedValue({
|
readConfigFileSnapshot.mockResolvedValue({
|
||||||
|
|||||||
Reference in New Issue
Block a user