mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 10:20:42 +00:00
test: trim slow CI hotspot coverage
This commit is contained in:
@@ -28,6 +28,14 @@ vi.mock("@larksuiteoapi/node-sdk", () => ({
|
||||
),
|
||||
}));
|
||||
|
||||
vi.mock("./monitor.state.js", async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import("./monitor.state.js")>();
|
||||
return {
|
||||
...actual,
|
||||
FEISHU_WEBHOOK_BODY_TIMEOUT_MS: 50,
|
||||
};
|
||||
});
|
||||
|
||||
import type { RuntimeEnv } from "../runtime-api.js";
|
||||
import {
|
||||
clearFeishuWebhookRateLimitStateForTest,
|
||||
@@ -197,10 +205,10 @@ describe("Feishu webhook security hardening", () => {
|
||||
},
|
||||
monitorFeishuProvider,
|
||||
async (url) => {
|
||||
const result = await waitForSlowBodyTimeoutResponse(url, 15_000);
|
||||
const result = await waitForSlowBodyTimeoutResponse(url, 1_000);
|
||||
expect(result.body).toContain("408 Request Timeout");
|
||||
expect(result.body).toContain("Request body timeout");
|
||||
expect(result.elapsedMs).toBeLessThan(12_000);
|
||||
expect(result.elapsedMs).toBeLessThan(500);
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { splitSdkTools } from "./pi-embedded-runner.js";
|
||||
import {
|
||||
collectRegisteredToolNames,
|
||||
toSessionToolAllowlist,
|
||||
} from "./pi-embedded-runner/tool-name-allowlist.js";
|
||||
import { createStubTool } from "./test-helpers/pi-tool-stubs.js";
|
||||
|
||||
describe("splitSdkTools", () => {
|
||||
@@ -38,4 +42,15 @@ describe("splitSdkTools", () => {
|
||||
"browser",
|
||||
]);
|
||||
});
|
||||
|
||||
it("keeps OpenClaw-managed custom tools in Pi's session allowlist", () => {
|
||||
const { customTools } = splitSdkTools({
|
||||
tools: [createStubTool("read"), createStubTool("sessions_spawn")],
|
||||
sandboxEnabled: true,
|
||||
});
|
||||
const allowlist = toSessionToolAllowlist(collectRegisteredToolNames(customTools));
|
||||
|
||||
expect(customTools.map((tool) => tool.name)).toContain("sessions_spawn");
|
||||
expect(allowlist).toContain("sessions_spawn");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
||||
import {
|
||||
cleanupTempPaths,
|
||||
createContextEngineAttemptRunner,
|
||||
createContextEngineBootstrapAndAssemble,
|
||||
getHoisted,
|
||||
resetEmbeddedAttemptHarness,
|
||||
} from "./attempt.spawn-workspace.test-support.js";
|
||||
|
||||
const hoisted = getHoisted();
|
||||
|
||||
describe("runEmbeddedAttempt tool allowlist", () => {
|
||||
const tempPaths: string[] = [];
|
||||
|
||||
beforeEach(() => {
|
||||
resetEmbeddedAttemptHarness();
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
await cleanupTempPaths(tempPaths);
|
||||
});
|
||||
|
||||
it("passes OpenClaw-managed custom tool names to Pi's session allowlist", async () => {
|
||||
await createContextEngineAttemptRunner({
|
||||
sessionKey: "agent:qa:repo-contract",
|
||||
tempPaths,
|
||||
contextEngine: createContextEngineBootstrapAndAssemble(),
|
||||
});
|
||||
|
||||
const options = hoisted.createAgentSessionMock.mock.calls.at(-1)?.[0] as
|
||||
| {
|
||||
customTools?: Array<{ name?: string }>;
|
||||
tools?: string[];
|
||||
}
|
||||
| undefined;
|
||||
expect(options?.customTools?.map((tool) => tool.name)).toContain("sessions_spawn");
|
||||
expect(options?.tools).toContain("sessions_spawn");
|
||||
});
|
||||
});
|
||||
@@ -67,20 +67,4 @@ describe("resolveFollowupDeliveryPayloads", () => {
|
||||
}),
|
||||
).toEqual([]);
|
||||
});
|
||||
|
||||
it("does not suppress replies when account differs", () => {
|
||||
expect(
|
||||
resolveFollowupDeliveryPayloads({
|
||||
cfg: baseConfig,
|
||||
payloads: [{ text: "hello world!" }],
|
||||
messageProvider: "heartbeat",
|
||||
originatingChannel: "telegram",
|
||||
originatingTo: "268300329",
|
||||
originatingAccountId: "personal",
|
||||
sentTargets: [
|
||||
{ tool: "telegram", provider: "telegram", to: "268300329", accountId: "work" },
|
||||
],
|
||||
}),
|
||||
).toEqual([{ text: "hello world!" }]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user