Commit 79eec0b
committed
fix: prevent test DB leakage from TestShell_BeforeNode
NewApp().Before() unconditionally overwrites shell.Config with a fresh
config using the default pgx driver, even when tests pre-set a config
with the txdb driver for isolation. This causes BeforeNode to open real
database connections, leaking keystore entries (encrypted_key_rings) to
the shared test database. Concurrent tests like Test_CSAKeyStore_E2E
then find unexpected keys and fail.
Guard config creation in app.Before() with a nil check so pre-set test
configs are preserved. Migrate TestShell_BeforeNode and
TestShell_RunNode_WithBeforeNode to heavyweight.FullTestDBV2 for proper
DB isolation between subtests while preventing leakage to other tests.1 parent 2e5181a commit 79eec0b
2 files changed
Lines changed: 29 additions & 26 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | 83 | | |
89 | 84 | | |
90 | 85 | | |
91 | | - | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
92 | 97 | | |
93 | 98 | | |
94 | 99 | | |
| |||
122 | 127 | | |
123 | 128 | | |
124 | 129 | | |
125 | | - | |
| 130 | + | |
126 | 131 | | |
127 | 132 | | |
128 | 133 | | |
129 | | - | |
| 134 | + | |
130 | 135 | | |
131 | 136 | | |
132 | 137 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
507 | 507 | | |
508 | 508 | | |
509 | 509 | | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
510 | 519 | | |
511 | 520 | | |
512 | 521 | | |
| |||
519 | 528 | | |
520 | 529 | | |
521 | 530 | | |
522 | | - | |
523 | | - | |
524 | | - | |
525 | | - | |
526 | | - | |
527 | | - | |
528 | | - | |
529 | | - | |
530 | 531 | | |
531 | 532 | | |
532 | 533 | | |
| |||
577 | 578 | | |
578 | 579 | | |
579 | 580 | | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
580 | 588 | | |
581 | 589 | | |
582 | 590 | | |
| |||
588 | 596 | | |
589 | 597 | | |
590 | 598 | | |
591 | | - | |
592 | | - | |
593 | | - | |
594 | | - | |
595 | | - | |
596 | | - | |
597 | | - | |
598 | | - | |
599 | | - | |
600 | | - | |
601 | 599 | | |
602 | 600 | | |
603 | 601 | | |
| |||
0 commit comments