Add database integration-test support #19

Closed
opened 2026-09-04 23:27:09 +02:00 by arne · 0 comments
Owner

Provide a reusable test helper for isolated, migrated SQLite databases so repository and service tests can exercise real database behavior cheaply.

Acceptance criteria:

  • Tests can request an isolated temporary SQLite database through a helper using testing.T.
  • The helper applies production-equivalent connection settings and all embedded migrations.
  • Cleanup is automatic via t.Cleanup, closes connections, and removes temporary state.
  • Parallel tests receive distinct databases and cannot leak data into one another.
  • Setup failures fail the calling test with useful context and helper frames are marked appropriately.
  • Example tests demonstrate schema availability, isolation, constraint enforcement, and safe parallel use.
  • The helper is test-only or otherwise cannot be imported accidentally by production startup code.
  • make check passes.

Dependencies:

Provide a reusable test helper for isolated, migrated SQLite databases so repository and service tests can exercise real database behavior cheaply. Acceptance criteria: - Tests can request an isolated temporary SQLite database through a helper using `testing.T`. - The helper applies production-equivalent connection settings and all embedded migrations. - Cleanup is automatic via `t.Cleanup`, closes connections, and removes temporary state. - Parallel tests receive distinct databases and cannot leak data into one another. - Setup failures fail the calling test with useful context and helper frames are marked appropriately. - Example tests demonstrate schema availability, isolation, constraint enforcement, and safe parallel use. - The helper is test-only or otherwise cannot be imported accidentally by production startup code. - `make check` passes. Dependencies: - Depends on #17 and #18.
arne closed this issue 2026-09-05 08:40:08 +02:00
Sign in to join this conversation.
No labels
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
arne/fjomp#19
No description provided.