From ffa25aa9a39167c6238c20683ec1af69d44f28dc Mon Sep 17 00:00:00 2001 From: Dotta Date: Fri, 9 Oct 2026 02:46:28 -0500 Subject: [PATCH] test: separate cold route setup and bound backup integration cases --- packages/db/src/backup-lib.test.ts | 4 +++- .../agent-adapter-validation-routes.test.ts | 13 +++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/packages/db/src/backup-lib.test.ts b/packages/db/src/backup-lib.test.ts index b685153499..8cdf526d7b 100644 --- a/packages/db/src/backup-lib.test.ts +++ b/packages/db/src/backup-lib.test.ts @@ -74,7 +74,9 @@ describe("createBufferedTextFileWriter", () => { }); }); -describeEmbeddedPostgres("runDatabaseBackup", () => { +// Each case starts a real PostgreSQL instance. Use the same bounded deadline +// as the existing backup integration cases, including newly added cases. +describeEmbeddedPostgres("runDatabaseBackup", { timeout: 30_000 }, () => { it("preserves identity generation, sequence options and progress in JavaScript backups", async () => { const source = await createTempDatabase(); const target = await createSiblingDatabase(source, "identity_restore_target"); diff --git a/server/src/__tests__/agent-adapter-validation-routes.test.ts b/server/src/__tests__/agent-adapter-validation-routes.test.ts index 1aa1217977..1282867e55 100644 --- a/server/src/__tests__/agent-adapter-validation-routes.test.ts +++ b/server/src/__tests__/agent-adapter-validation-routes.test.ts @@ -173,11 +173,10 @@ const externalAdapter: ServerAdapterModule = { const missingAdapterType = "missing_adapter_validation_test"; +let agentRoutes: typeof import("../routes/agents.js").agentRoutes; +let errorHandler: typeof import("../middleware/index.js").errorHandler; + async function createApp(actorOverride: Record = {}) { - const [{ agentRoutes }, { errorHandler }] = await Promise.all([ - vi.importActual("../routes/agents.js"), - vi.importActual("../middleware/index.js"), - ]); const app = express(); app.use(express.json()); app.use((req, _res, next) => { @@ -332,6 +331,12 @@ describe("agent routes adapter validation", () => { })); await unregisterTestAdapter("external_test"); await unregisterTestAdapter(missingAdapterType); + // These imports follow resetModules and the per-test mocks. Keep their cold + // setup cost in the existing 30-second hook, outside the request deadline. + [{ agentRoutes }, { errorHandler }] = await Promise.all([ + vi.importActual("../routes/agents.js"), + vi.importActual("../middleware/index.js"), + ]); }); afterEach(async () => {