fix(integration-test): ensure integration tests are runned on a separate DB to avoid polution

This commit is contained in:
Edouard Vanbelle
2026-05-31 23:15:40 +02:00
parent 274cf9da11
commit d2dedcbb00
7 changed files with 143 additions and 34 deletions
+13 -2
View File
@@ -25,10 +25,21 @@ test-mocks:
# DB-dependent integration tests gated on `--cfg integration_tests`.
# Spins up the test postgres on port 5433 first. Requires one row in
# auth.users (start the server against the test DB once to seed).
# auth.users on the test DB (start the server against it once to seed).
#
# IMPORTANT: DATABASE_URL is pinned to the test container on port 5433
# so a stray DATABASE_URL in `.env` (which `set dotenv-load` at the top
# of this file would otherwise leak in) cannot point the tests at the
# real dev DB. The test pool helpers also refuse non-`oxicloud_test`
# URLs as defence in depth.
test-integration:
bash tests/common/spawn-db.sh
RUSTFLAGS='--cfg integration_tests' cargo test --workspace --tests
PGHOST=localhost PGPORT=5433 PGUSER=oxicloud_test PGPASSWORD=oxicloud_test \
PGDATABASE=oxicloud_test \
bash tests/common/init-test-schema.sh
DATABASE_URL='postgres://oxicloud_test:oxicloud_test@localhost:5433/oxicloud_test' \
RUSTFLAGS='--cfg integration_tests' \
cargo test --workspace --tests
test-one name:
cargo test {{name}}