test: one test-database opener, dbtest.Pool, in place of 39 copies (#8002)
Every package carried its own testPool/newPool/newTestPool: skip under -short or without MINSTREL_TEST_DATABASE_URL, migrate, connect, register the close, and usually ResetDB. dbtest.Open does the first four (migrating once per test binary) and dbtest.Pool adds the reset. The per-package wrappers that did nothing else are gone; fixture helpers that seed rows keep their own signatures. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -62,7 +62,7 @@ func unreadNotices(t *testing.T, pool *pgxpool.Pool, user dbq.User) []notice {
|
||||
}
|
||||
|
||||
func TestNotifyScanFinished_FailuresCoalesceAndShutdownIsSilent(t *testing.T) {
|
||||
pool := newPool(t)
|
||||
pool := dbtest.Pool(t)
|
||||
admin := notifyingAdmin(t, pool)
|
||||
ctx := context.Background()
|
||||
|
||||
@@ -91,7 +91,7 @@ func TestNotifyScanFinished_FailuresCoalesceAndShutdownIsSilent(t *testing.T) {
|
||||
// it has adopted moves and folded replacements, so a file it marked and then
|
||||
// healed is never reported as lost.
|
||||
func TestReconcileMissing_RecordsTheMarksWithoutNotifying(t *testing.T) {
|
||||
pool := newPool(t)
|
||||
pool := dbtest.Pool(t)
|
||||
admin := notifyingAdmin(t, pool)
|
||||
s := testScanner(t, populatedRoot(t))
|
||||
|
||||
@@ -117,7 +117,7 @@ func TestReconcileMissing_RecordsTheMarksWithoutNotifying(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestNotifyStillMissing_NamesOnlyTheTracksStillGone(t *testing.T) {
|
||||
pool := newPool(t)
|
||||
pool := dbtest.Pool(t)
|
||||
admin := notifyingAdmin(t, pool)
|
||||
ctx := context.Background()
|
||||
q := dbq.New(pool)
|
||||
@@ -158,7 +158,7 @@ func TestNotifyStillMissing_NamesOnlyTheTracksStillGone(t *testing.T) {
|
||||
// it for them. A group the resolver settles or links is never news, and a
|
||||
// group already seen by an earlier pass is not news again.
|
||||
func TestResolveDuplicates_TellsAdminsOnlyOfNewGroupsLeftForThem(t *testing.T) {
|
||||
pool := newPool(t)
|
||||
pool := dbtest.Pool(t)
|
||||
admin := notifyingAdmin(t, pool)
|
||||
ctx := context.Background()
|
||||
q := dbq.New(pool)
|
||||
|
||||
Reference in New Issue
Block a user