Files
Jyotisha/frontend/tests/postgres-fixture-contract.test.ts
T
Jesse_Chen 37e62094d7
Independent Staging Quality Gate / validate (push) Successful in 10m28s
Independent Staging Quality Gate / publish (push) Successful in 9m59s
fix(ci): cap postgres fixtures and reclaim leftover compose networks
xiaoxin's 20-core npm test opened one Docker network per database file and exhausted default address pools. Limit concurrent fixtures and remove unused jyotisha-postgres networks before the gate.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-18 19:30:13 +08:00

36 lines
1.2 KiB
TypeScript

import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import test from "node:test";
import { fileURLToPath } from "node:url";
const fixtureSource = readFileSync(
fileURLToPath(new URL("./helpers/postgres-fixture.ts", import.meta.url)),
"utf8",
);
test("postgres fixtures cap concurrent compose networks so Docker address pools cannot be exhausted", () => {
assert.match(fixtureSource, /JYOTISHA_POSTGRES_MAX_FIXTURES/);
assert.match(fixtureSource, /DEFAULT_MAX_CONCURRENT_POSTGRES_FIXTURES = 2/);
assert.match(fixtureSource, /function acquireFixtureSlot\(/);
assert.match(fixtureSource, /process\.kill\(\s*pid,\s*0\s*\)/);
assert.match(
fixtureSource,
/export function startPostgresFixture\(\)[\s\S]*acquireFixtureSlot\(\)/,
);
assert.match(
fixtureSource,
/timed out waiting for a PostgreSQL fixture slot/,
);
});
test("postgres fixture start failure and stop both release the compose-network slot", () => {
assert.match(
fixtureSource,
/catch \(error\) \{[\s\S]*releasePort\(portReservation\)[\s\S]*slot\.release\(\)/,
);
assert.match(
fixtureSource,
/stop\(\) \{[\s\S]*releasePort\(portReservation\)[\s\S]*slot\.release\(\)/,
);
});