test: stop suites dropping fixture tables they share - #171
Merged
Merged
Conversation
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>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
3 tasks done
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
security-audit-events.test.tsfails intermittently in CI withrelation "api_keys" does not exist, in its API-key tests and inafterAll. It has happened on consecutive runs of unrelated PRs.Cause
api_keysandsso_configurationsare 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.
api_keyssecurity-audit-events,aws-connection-api-key-authorizationsso_configurationssecurity-audit-events,saml-sso-authorizationChange
backend/src/routes/__tests__/shared-fixture-tables.ts: one definition of each table, created withCREATE TABLE IF NOT EXISTSunder an advisory lock so concurrent suites take turns.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:tsc --noEmit: clean.Not included
aws_accountsandaws_connect_sessionsfollow the same create-if-missing, drop-on-exit pattern in other suites and are left as they are here.🤖 Generated with Claude Code