From dc5d4138f9ae18f65c1cbe01acc8b671e6e17ce2 Mon Sep 17 00:00:00 2001 From: Ayaan Zaidi Date: Tue, 7 Jul 2026 03:44:57 +0000 Subject: [PATCH] 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. --- src/gateway/server-reload-handlers.test.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/gateway/server-reload-handlers.test.ts b/src/gateway/server-reload-handlers.test.ts index a28a377a9ef8..4ca81900ca8b 100644 --- a/src/gateway/server-reload-handlers.test.ts +++ b/src/gateway/server-reload-handlers.test.ts @@ -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("./server-cron.js"); return {