Repository navigation
chore - make database e2e tests run in parallel and more stable - #43569
Conversation
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughSummary by CodeRabbit
WalkthroughThis pull request includes two changes: (1) adding a data-testid attribute to a Check icon in the SchemaGraph component's "Copy as SQL" button to identify the icon when content is copied, and (2) refactoring the database end-to-end tests from global setup/teardown to per-test resource management, introducing new helper utilities (createTable and withSetupCleanup), replacing arbitrary timeouts with explicit visibility and state checks, and converting test groupings from serial to non-serial execution with localized test data constants. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🎭 Playwright Test ResultsDetails
Flaky testsFeatures › realtime-inspector.spec.ts › Realtime Inspector › Broadcast Messages › broadcast modal validates JSON payload Skipped testsFeatures › sql-editor.spec.ts › SQL Editor › snippet favourite works as expected |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@e2e/studio/features/database.spec.ts`:
- Around line 18-27: The tests use fixed identifiers (e.g., databaseTableName,
databaseColumnName) and helper functions createTable()/dropTable() so parallel
workers collide; generate and append a unique SQL-safe suffix (e.g., short
random hex or worker id sanitized to [a-z0-9_]) per test/worker and use that
suffix when constructing every fixture name (tables, columns, roles, enums,
functions) so createTable(databaseTableName + suffix) and dropTable(...) refer
to the same unique name; ensure the suffix is produced once per test setup and
passed into all setup/cleanup calls and query builders in
e2e/studio/utils/db/queries.ts so creation and teardown operate on the same
unique identifier.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Central YAML (base), Repository UI (inherited), Organization UI (inherited)
Review profile: CHILL
Plan: Pro
Run ID: b6d29e94-04bf-459b-b8f6-103e625b8c01
📒 Files selected for processing (2)
apps/studio/components/interfaces/Database/Schemas/SchemaGraph.tsxe2e/studio/features/database.spec.ts
| const databaseTableName = 'pw_database_schema_table' | ||
| const databaseColumnName = 'pw_database_schema_column' | ||
| await using _ = await withSetupCleanup( | ||
| async () => { | ||
| await createTable(databaseTableName, databaseColumnName) | ||
| }, | ||
| async () => { | ||
| await dropTable(databaseTableName) | ||
| } | ||
| ) |
There was a problem hiding this comment.
Fixed fixture names still share database state under parallel runs.
These tests are no longer serialized, but the created objects still use global pw_database_* identifiers. In e2e/studio/utils/db/queries.ts, createTable() uses CREATE TABLE IF NOT EXISTS, so a second worker/project will silently reuse the first worker’s table instead of getting an isolated fixture. The same collision pattern repeats later in this file for the fixed role, enum, and function names, where setup/cleanup can delete another worker’s object. Please add a unique SQL-safe suffix per test/worker to every created identifier.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@e2e/studio/features/database.spec.ts` around lines 18 - 27, The tests use
fixed identifiers (e.g., databaseTableName, databaseColumnName) and helper
functions createTable()/dropTable() so parallel workers collide; generate and
append a unique SQL-safe suffix (e.g., short random hex or worker id sanitized
to [a-z0-9_]) per test/worker and use that suffix when constructing every
fixture name (tables, columns, roles, enums, functions) so
createTable(databaseTableName + suffix) and dropTable(...) refer to the same
unique name; ensure the suffix is produced once per test setup and passed into
all setup/cleanup calls and query builders in e2e/studio/utils/db/queries.ts so
creation and teardown operate on the same unique identifier.
Braintrust eval report
|
Problem
Solution