fix(ci): cap integration-test parallelism to dodge sqlx-test pool timeout #115
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/check-pg-pool-saturation"
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?
Summary
Two consecutive
check.ymlruns flaked withfailed to connect test pool: PoolTimedOutontests/auth.rs. Same two tests both times:forgot_password_with_tenant_hint_targets_correct_userlist_users_requires_admin12 of 14 tests in the binary pass; the failures are at sqlx-test's per-test-database creation step, not the test logic itself.
Root cause
tests/auth.rshas 14#[sqlx::test]functions. cargo defaults to per-cpu in-flight (16+ on the runner). Each test creates a per-test database AND borrows from sqlx-test's maintenance pool that creates/drops those databases. At default parallelism the maintenance pool was timing out under contention.Fix
Cap concurrency with
cargo test ... -- --test-threads=4. Four in-flight is well within postgres's defaultmax_connections=100and leaves headroom for adding modules. Trade-off: small wall-clock cost, full reliability.Alternative considered: bump postgres
max_connectionsto 300. Rejected because Forgejo Actions service blocks don't expose acommandfield to pass-c max_connections=...to the postgres image, and going viaPOSTGRES_INITDB_ARGSonly affects initdb-time settings, not runtime config.Test plan