generated from coulomb/repo-seed
test: add provider postgres conformance
This commit is contained in:
@@ -262,3 +262,8 @@ Postgres implementation. It accepts a provider-owned DB-API or psycopg-like
|
||||
connection, applies the bootstrap SQL in `migrate`, and persists generic
|
||||
records, audit records, and pending outbox events without depending on a
|
||||
specific driver package.
|
||||
|
||||
`user_engine.testing.postgres_provider` provides env-gated live conformance
|
||||
helpers for provider repositories. They require a dedicated test DSN plus
|
||||
`USER_ENGINE_POSTGRES_TEST_RESET=1` before deleting rows from bootstrap-owned
|
||||
tables.
|
||||
|
||||
@@ -37,6 +37,19 @@ The command runs:
|
||||
PYTHONPATH=src python3 -m unittest discover -s tests -p 'test_*.py'
|
||||
```
|
||||
|
||||
Live Postgres conformance tests are skipped by default. To run them against a
|
||||
dedicated disposable database, install `psycopg` or `psycopg2` in the active
|
||||
environment and set:
|
||||
|
||||
```bash
|
||||
USER_ENGINE_POSTGRES_TEST_DSN='postgresql://...' \
|
||||
USER_ENGINE_POSTGRES_TEST_RESET=1 \
|
||||
make test
|
||||
```
|
||||
|
||||
The reset flag is required because those tests delete rows from the
|
||||
bootstrap-owned `user_engine_*` tables.
|
||||
|
||||
## Implementation Rule
|
||||
|
||||
Add new behavior in this order:
|
||||
|
||||
@@ -308,10 +308,15 @@ dedicated bootstrap tables, applies the bootstrap SQL through `migrate`, and
|
||||
uses the shared conformance harness with a fake Postgres connection for local
|
||||
unit coverage.
|
||||
|
||||
USER-WP-0019 adds optional provider-backed conformance tests. They are skipped
|
||||
by default and run only when a dedicated test database is supplied through
|
||||
`USER_ENGINE_POSTGRES_TEST_DSN` and destructive cleanup is acknowledged with
|
||||
`USER_ENGINE_POSTGRES_TEST_RESET=1`. The helper supports either `psycopg` or
|
||||
`psycopg2` when a provider repository installs one of them. Cleanup touches
|
||||
only the bootstrap-owned `user_engine_*` tables.
|
||||
|
||||
Likely future follow-up work should be:
|
||||
|
||||
- Add provider-backed conformance tests for locking, uniqueness races,
|
||||
migration readiness, outbox claiming, redacted diagnostics, and restore
|
||||
validation.
|
||||
- Add conformance tests that run against both in-memory and Postgres stores.
|
||||
- Add provider-backed conformance tests for locking, uniqueness races, outbox
|
||||
claiming, redacted diagnostics, and restore validation.
|
||||
- Integrate the adapter with the future NetKingdom Postgres provider repo.
|
||||
|
||||
Reference in New Issue
Block a user