perf(test): bypass queue debounce in fast mode and tighten announce defaults
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { afterAll, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { SILENT_REPLY_TOKEN } from "../auto-reply/tokens.js";
|
||||
import {
|
||||
__testing as sessionBindingServiceTesting,
|
||||
@@ -61,7 +61,7 @@ let configOverride: ReturnType<(typeof import("../config/config.js"))["loadConfi
|
||||
};
|
||||
const defaultOutcomeAnnounce = {
|
||||
task: "do thing",
|
||||
timeoutMs: 1000,
|
||||
timeoutMs: 10,
|
||||
cleanup: "keep" as const,
|
||||
waitForCompletion: false,
|
||||
startedAt: 10,
|
||||
@@ -141,7 +141,22 @@ vi.mock("../config/config.js", async (importOriginal) => {
|
||||
});
|
||||
|
||||
describe("subagent announce formatting", () => {
|
||||
let previousFastTestEnv: string | undefined;
|
||||
|
||||
beforeAll(() => {
|
||||
previousFastTestEnv = process.env.OPENCLAW_TEST_FAST;
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
if (previousFastTestEnv === undefined) {
|
||||
delete process.env.OPENCLAW_TEST_FAST;
|
||||
return;
|
||||
}
|
||||
process.env.OPENCLAW_TEST_FAST = previousFastTestEnv;
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
vi.stubEnv("OPENCLAW_TEST_FAST", "1");
|
||||
agentSpy
|
||||
.mockClear()
|
||||
.mockImplementation(async (_req: AgentCallRequest) => ({ runId: "run-main", status: "ok" }));
|
||||
|
||||
@@ -112,6 +112,9 @@ export function waitForQueueDebounce(queue: {
|
||||
debounceMs: number;
|
||||
lastEnqueuedAt: number;
|
||||
}): Promise<void> {
|
||||
if (process.env.OPENCLAW_TEST_FAST === "1") {
|
||||
return Promise.resolve();
|
||||
}
|
||||
const debounceMs = Math.max(0, queue.debounceMs);
|
||||
if (debounceMs <= 0) {
|
||||
return Promise.resolve();
|
||||
|
||||
Reference in New Issue
Block a user