test(gateway): cross-user-isolation cleanup honors dbAvailable (#1275)
ci/woodpecker/pr/ci Pipeline was successful
ci/woodpecker/pr/ci Pipeline was successful
The no-database skip path failed the file: createDb connects lazily, so on an unreachable database 'handle' is set while nothing was inserted; afterAll checked only 'handle' and its cleanup deletes threw ECONNREFUSED, failing the suite despite 28/28 tests being skipped. Caught live by the publish pipeline's verify gate (pipeline 2486, first gated publish after #1277): the gate's no-DATABASE_URL PGlite path runs 'pnpm test' without ci-postgres, cross-user-isolation hit its dead-cleanup path, verify correctly failed closed and blocked all publish steps (build/publish-npm/build-gateway skipped). Verified both paths: DATABASE_URL=dead-port -> 28 skipped, file PASSES (was the failure); live 5433 -> 28 passed. Sibling suites checked: connector-lease.postgres.integration skips at describe level (describe.skipIf) so its afterAll never runs unguarded.
This commit is contained in:
@@ -190,7 +190,13 @@ beforeEach((ctx) => {
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
if (!handle) return;
|
||||
// Cleanup only when the fixture actually installed rows. `handle` is set
|
||||
// before the first query (createDb connects lazily), so on an unreachable
|
||||
// database `handle` is truthy while nothing was inserted — cleanup must
|
||||
// honor `dbAvailable` or the skip path fails the file with ECONNREFUSED in
|
||||
// afterAll (caught live by the publish pipeline's no-DATABASE_URL verify
|
||||
// step, pipeline 2486).
|
||||
if (!handle || !dbAvailable) return;
|
||||
const db = handle.db;
|
||||
|
||||
// Delete in dependency order (FK constraints)
|
||||
|
||||
Reference in New Issue
Block a user