Commit 36baa59
committed
fix(mssql): make _sqlx_test_databases creation race-safe
The `#[sqlx::test]` harness created the shared `_sqlx_test_databases` tracking
table with `IF NOT EXISTS ... CREATE TABLE`, which is not atomic across
connections. Under parallel test execution (CI default; masked locally by
--test-threads=1) two tests could both pass the check and one then failed with
error 2714 ("There is already an object named '_sqlx_test_databases'"). Guard
the CREATE with TRY/CATCH that rethrows everything except 2714, so the losing
side of the race proceeds.
Author: Pablo Carrera <pabloce@poscye.com>1 parent 4de1273 commit 36baa59
1 file changed
Lines changed: 15 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
134 | | - | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
135 | 138 | | |
136 | 139 | | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
143 | 151 | | |
144 | 152 | | |
145 | 153 | | |
| |||
0 commit comments