Skip to content

fix: keep integration-test fixtures out of the app database - #504

Merged
davidmckayv merged 1 commit into
mainfrom
fix/test-fixture-database-isolation
Sep 12, 2026
Merged

fix: keep integration-test fixtures out of the app database#504
davidmckayv merged 1 commit into
mainfrom
fix/test-fixture-database-isolation

Conversation

@davidmckayv

Copy link
Copy Markdown
Contributor

Integration tests could write fixtures into the application database: createDatabase removes DATABASE_URL to avoid a Bun Windows connection bug, and later test files then fell back to localhost/openbot. This left repeated “Raced” components and “removal target” plugins visible after reinstalling the app with its existing database.

Require an explicit, cached TEST_DATABASE_URL and refuse the default application database. All query-backed server tests and the CI test job use that address. Track every fixture in the component/plugin suites and remove it even when the operation under test fails. Most changed files only replace their database URL fallback with the shared helper; production database code is unchanged.

Validation:

  • 720 tests passed across all 47 affected test files on a separately created and migrated PostgreSQL database.
  • Real connections still reached the test database after createDatabase deleted DATABASE_URL.
  • Actual suite startup refused missing TEST_DATABASE_URL and an address naming the application database.
  • Three deliberately injected plugin-removal failures left zero plugin, credential, agent, or user fixtures; the normal focused run also left zero component fixtures.
  • Server typecheck/build, changed-file formatting/lint, actionlint, and diff checks passed.
  • Backed up and removed the exact legacy test records from the affected local install, then inspected both pages in the running Mac app and confirmed the app API remained clean after the test run.

@davidmckayv
davidmckayv marked this pull request as ready for review September 12, 2026 18:47
@davidmckayv
davidmckayv merged commit 4c0568a into main Sep 12, 2026
16 checks passed
@davidmckayv
davidmckayv deleted the fix/test-fixture-database-isolation branch September 12, 2026 18:47
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