Repository navigation
Commit 1caaf18
committed
test(migrations): make the 000096 idempotency subtest actually re-run the migration
The "backfill is idempotent" subtest called migrations.RunMigrations a
second time expecting it to re-exercise the DO block's guards. It does
not: m.Up() returns migrate.ErrNoChange once the database is already at
the latest version, so the migration body never runs again and the
subtest passed regardless of whether the guards worked. Proved by mutation:
stripping both idempotency devices from the up migration (the WHERE NOT
guard and the DISTINCT dedup on the backfill UPDATE) still left the old
test green.
Rewrites the subtest to read 000096_seed_ri_exchanger_group.up.sql and
execute its SQL directly a second time, the same pattern
000095_purchase_history_account_id_width_test.go already uses for its
re-run assertion. Re-verified by the same mutation: with the fix, stripping
the guards now fails the subtest (duplicate group_ids entry), and restoring
them passes it again.
The migration itself was already correctly idempotent; only the test
coverage was empty.1 parent b85f7a2 commit 1caaf18
1 file changed
Lines changed: 13 additions & 2 deletions
Lines changed: 13 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
8 | 10 | | |
9 | 11 | | |
10 | 12 | | |
| |||
116 | 118 | | |
117 | 119 | | |
118 | 120 | | |
119 | | - | |
120 | | - | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
121 | 132 | | |
122 | 133 | | |
123 | 134 | | |
| |||
0 commit comments