Skip to content

test: stop suites dropping fixture tables they share - #171

Merged
GoddeyUwamari merged 1 commit into
mainfrom
fix/test-shared-fixture-tables
Oct 5, 2026
Merged

GoddeyUwamari merged 1 commit into
mainfrom
fix/test-shared-fixture-tables

Conversation

@GoddeyUwamari

Copy link
Copy Markdown
Owner

Summary

security-audit-events.test.ts fails intermittently in CI with relation "api_keys" does not exist, in its API-key tests and in afterAll. It has happened on consecutive runs of unrelated PRs.

Cause

api_keys and sso_configurations are not created by the migrations CI bootstraps. The suites that need them each created the table only if it was missing, and dropped it at the end only if they had created it.

Suites run in parallel workers against one database. Whichever suite started first created the table; the other found it and used it. When the first suite finished, it dropped the table while the other was still running.

Table Suites
api_keys security-audit-events, aws-connection-api-key-authorization
sso_configurations security-audit-events, saml-sso-authorization

Change

  • New backend/src/routes/__tests__/shared-fixture-tables.ts: one definition of each table, created with CREATE TABLE IF NOT EXISTS under an advisory lock so concurrent suites take turns.
  • The three suites call it for the tables they need and no longer drop them. They still delete their own rows.

Test-only. No product code, migration, or workflow change.

The two tables now remain in the test database after a run.

Verification

On a database built with .github/scripts/ci-bootstrap-schema.js:

  • Each of the three suites alone, with both tables absent beforehand: pass.
  • All three in parallel, six rounds, tables dropped before each round: 111/111 each round.
  • 24 concurrent calls to the helper from 12 pools: none rejected.
  • Backend tsc --noEmit: clean.

Not included

aws_accounts and aws_connect_sessions follow the same create-if-missing, drop-on-exit pattern in other suites and are left as they are here.

🤖 Generated with Claude Code

api_keys and sso_configurations are not created by the migrations CI
bootstraps, so the suites that need them created them when missing and
dropped them afterwards. Suites run in parallel against one database, so
a suite that found the table already there was using another suite's
copy, and lost it when that suite finished first:

  relation "api_keys" does not exist

Each suite now ensures the tables it needs through one shared helper,
which creates them under an advisory lock, and no suite drops them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
devcontrol Ready Ready Preview Oct 5, 2026 7:30am UTC

@GoddeyUwamari
GoddeyUwamari merged commit 532875c into main Oct 5, 2026
6 checks passed

This branch was successfully deployed

1 active deployment
Preview — aecd4b46 Deployed Oct 5, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant