Postgres CI testing — rewrite test fixtures, add Woodpecker service container #16
Labels
No labels
domain:backend
domain:devops
domain:frontend
status:approved
status:in-progress
status:needs-fix
status:qa
type:bug
type:devops
type:feature
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
forgejo_admin/basketball-api#16
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Lineage
plan-2026-03-08-tryout-prep→ Phase 1bRepo
forgejo_admin/basketball-apiUser Story
As a developer
I want CI to run tests against real Postgres instead of SQLite
So that tests catch real bugs and the pipeline passes, unblocking deployment
Context
Tests currently use SQLite via module-level engine/session overrides.
test_register.pyandtest_coach.pyboth overrideget_dbat different scopes and stomp each other — 6 tests fail. SQLite also hides real bugs (e.g. date_of_birth type mismatch). The registration form and coach onboarding are merged but nothing deploys until CI passes.Ruff formatting is already fixed (PR #15). This issue is only about Postgres CI testing.
Note: Woodpecker CI logs are currently broken platform-wide (upstream bug). You won't see logs in the UI. To verify locally, run
pytestagainst a real Postgres instance.File Targets
Files the agent should modify:
.woodpecker.yaml— add Postgres service container, set DATABASE_URL env var in test steptests/conftest.py— shared Postgres test fixtures (engine, session, TestClient)tests/test_register.py— remove module-level SQLite setup, use conftest fixturestests/test_coach.py— remove module-level SQLite setup, use conftest fixturestests/test_models.py— use conftest fixtures if applicableFiles the agent should NOT touch:
src/application code — no app changes, test infrastructure onlyAcceptance Criteria
.woodpecker.yamlhas a Postgres service container (e.g.postgres:16-alpine)DATABASE_URLenv var set in test step pointing to Woodpecker Postgres servicetests/conftest.pyprovides shared fixtures: engine, session, TestClient with DB overrideget_dboverrides in individual test filesruff format --check .still passesruff check .still passesTest Expectations
test_register.pypass against Postgrestest_coach.pypass against Postgres (mocked Stripe)test_models.pypassDATABASE_URL=postgresql://test:test@localhost:5432/test pytest tests/ -vConstraints
services:block for Postgres sidecar — see Woodpecker docs for K8s backend service syntaxpostgres:16-alpineimage for consistency with CNPG productionChecklist
Related
plan-2026-03-08-tryout-prep— tryout prep plan