test(gateway): isolate reload handler plugin records

The reload handler no-op config test enables fake timers and drains all timers. In cross-file non-isolated runs, server-startup-post-attach closes the shared state DB first, so this test reopens it through the managed config reloader's default installed-plugin record read.

That DB open schedules SQLite WAL maintenance at src/infra/sqlite-wal.ts:345 while fake timers are active, and vi.runAllTimersAsync spins the interval until Vitest aborts after 10000 timers. Mock installed plugin record reads in this handler test so the test owns only the reload debounce timer it is trying to drain.
This commit is contained in:
Ayaan Zaidi
2026-07-07 03:44:57 +00:00
parent ad5b81e884
commit dc5d4138f9

View File

@@ -159,6 +159,11 @@ vi.mock("../agents/agent-bundle-mcp-tools.js", () => ({
disposeAllSessionMcpRuntimes: hoisted.disposeAllSessionMcpRuntimes,
}));
vi.mock("../plugins/installed-plugin-index-records.js", () => ({
loadInstalledPluginIndexInstallRecords: vi.fn(async () => ({})),
loadInstalledPluginIndexInstallRecordsSync: vi.fn(() => ({})),
}));
vi.mock("./server-cron.js", async () => {
const actual = await vi.importActual<typeof import("./server-cron.js")>("./server-cron.js");
return {