⏲️ test: Give ServerConfigsDB Mongo Hooks a 60s Timeout Budget (#14831)

`beforeAll` boots a real mongod via MongoMemoryServer, resets the module
registry and re-imports data-schemas, ServerConfigsDB and the MCP OAuth handler
before a single test runs. That exceeds the 15s global `testTimeout` once the
runner is busy: the suite finishes in ~4.5s on its own but has been observed at
16.8s under a loaded `@librechat/api` shard, failing every test in the file with
"Exceeded timeout of 15000 ms for a hook".

Give both mongo hooks an explicit 60s budget, matching
`checkpointer.integration.spec.ts`, the other MongoMemoryServer suite that
already opts out of the global default. `afterAll` gets the same treatment since
`mongoServer.stop()` is subject to the same contention.

No behaviour change — the timeout only bounds setup, and the suite still
completes well inside it.
This commit is contained in:
Danny Avila 2026-08-14 09:55:42 -04:00 committed by GitHub
parent eaef87fa26
commit 0ce4c3374b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -77,12 +77,15 @@ beforeAll(async () => {
await dbMethods.seedDefaultRoles();
serverConfigsDB = new ServerConfigsDB(mongoose);
});
/** Booting a real mongod, resetting the module registry and re-importing
* data-schemas costs more than the 15s global `testTimeout`, once the runner
* is busy enough. Matches `checkpointer.integration.spec.ts`. */
}, 60000);
afterAll(async () => {
await mongoose.disconnect();
await mongoServer.stop();
});
}, 60000);
beforeEach(async () => {
// Clear collections except AccessRole