Repository navigation
Commit dba97ee
Matthew
fix(db): isolate usage metrics advisory-lock test on scratch DB (#3670)
## What Problem This Solves
`test_usage_metrics_lock_has_single_owner_and_releases_on_drop`
hardcodes the **production** advisory lock key (`0x4255_5A5A_4D45_5452`)
on the shared `TEST_DATABASE_URL`. Postgres advisory locks are
per-database, so any live `buzz-relay` pointed at the same DB holds that
key and the test fails (or races the relay tick). Diagnosis time was
burned during #3268 verification, including near-misses on live dev
relays. Fixes #3619.
## Why This Change Was Made
Preferred fix from the issue: run the test on a private scratch DB via
existing `create_scratch_db` / `drop_scratch_db` (same pattern as
replica-routing fixtures). Keep the production lock key so the test
still documents the real constant, without colliding with a running
relay.
## User Impact
- Local `cargo test -p buzz-db -- --ignored` no longer fails when a dev
relay is running against the shared test DB
- Safer: no temptation to `pg_terminate_backend` a live relay to "fix"
the test
## Evidence
- Code review of fixture isolation
- Pattern matches existing `create_scratch_db` usage in this file
- Test remains `#[ignore = "requires Postgres"]` (same as before)
## Related
- Issue: #3619
- None found among open PRs for this exact fix
Signed-off-by: NanoRisk6 <[email protected]>1 parent 1b3ff96 commit dba97ee
1 file changed
Lines changed: 19 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5780 | 5780 | | |
5781 | 5781 | | |
5782 | 5782 | | |
5783 | | - | |
5784 | | - | |
5785 | | - | |
5786 | | - | |
5787 | | - | |
5788 | | - | |
5789 | | - | |
| 5783 | + | |
| 5784 | + | |
| 5785 | + | |
| 5786 | + | |
| 5787 | + | |
| 5788 | + | |
| 5789 | + | |
| 5790 | + | |
| 5791 | + | |
| 5792 | + | |
| 5793 | + | |
5790 | 5794 | | |
5791 | | - | |
| 5795 | + | |
| 5796 | + | |
| 5797 | + | |
5792 | 5798 | | |
5793 | 5799 | | |
5794 | 5800 | | |
| |||
5815 | 5821 | | |
5816 | 5822 | | |
5817 | 5823 | | |
| 5824 | + | |
| 5825 | + | |
| 5826 | + | |
| 5827 | + | |
| 5828 | + | |
5818 | 5829 | | |
5819 | 5830 | | |
5820 | 5831 | | |
| |||
0 commit comments