mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-09-13 18:32:12 +03:00
test(models): de-flake the #12058 canonical-catalog regression
The unit suite base-red on release/v3.8.51 was this file, failing on a different test each run with "500 !== 200" out of getRows(). The 500 is catalog_build_timeout. Every getRows() call resets the builder, so each one is a cold full-catalog build, and that path is bounded by CATALOG_BUILD_TIMEOUT_MS (8s by default). Measured on an idle box: the cold build alone costs ~7.3s with the network stubbed out, and ~9.6s once the fire-and-forget upstream usage refreshes (api.anthropic.com, cloudcode-pa.googleapis.com, aihorde.net) land on top. The margin against the 8s bound is what decides the run, which is why the failing test moved around between runs. That budget is not the subject of this regression - canonical-mode row shaping is - so the bound is pinned out of the way, exactly as tests/unit/12627-catalog-inflight-timeout.test.ts already does for the opposite direction. No assertion is changed, removed or relaxed. Refs #12732
This commit is contained in:
@@ -0,0 +1 @@
|
||||
- **test(models):** Pin `CATALOG_BUILD_TIMEOUT_MS` in the #12058 canonical-catalog regression so a cold catalog build racing the 8s default bound no longer flakes the suite with a 500 ([#12732](https://github.com/diegosouzapw/OmniRoute/issues/12732))
|
||||
@@ -24,6 +24,15 @@ import path from "node:path";
|
||||
|
||||
const TEST_DATA_DIR = fs.mkdtempSync(path.join(os.tmpdir(), "omniroute-12058-"));
|
||||
process.env.DATA_DIR = TEST_DATA_DIR;
|
||||
// Every `getRows()` call resets the builder, so each one is a *cold* catalog
|
||||
// build. That path is bounded by `CATALOG_BUILD_TIMEOUT_MS` (8s by default),
|
||||
// and a cold build of the full catalog already costs ~7s on an idle box before
|
||||
// the fire-and-forget upstream usage refreshes land — so on a loaded CI runner
|
||||
// the bound trips and `getRows()` sees a 500 instead of the rows under test.
|
||||
// That budget is not what this regression covers (row shaping in canonical
|
||||
// mode is), so pin it out of the way exactly like #12627 does. Every
|
||||
// assertion below is unchanged.
|
||||
process.env.CATALOG_BUILD_TIMEOUT_MS = "120000";
|
||||
|
||||
const core = await import("../../src/lib/db/core.ts");
|
||||
const providersDb = await import("../../src/lib/db/providers.ts");
|
||||
|
||||
Reference in New Issue
Block a user