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:
2026-11-26 12:49:02 -05:00
co-authored by Claude Opus 5.5
parent 47e749225e
commit 39fa740bff
69 changed files with 329 additions and 975 deletions
+4 -3
View File
@@ -12,6 +12,7 @@ import (
"github.com/jackc/pgx/v5/pgxpool"
"git.fabledsword.com/bvandeusen/minstrel/internal/db/dbq"
"git.fabledsword.com/bvandeusen/minstrel/internal/dbtest"
syncpkg "git.fabledsword.com/bvandeusen/minstrel/internal/sync"
)
@@ -26,7 +27,7 @@ type resolveFixture struct {
func newResolveFixture(t *testing.T) resolveFixture {
t.Helper()
pool := newPool(t)
pool := dbtest.Pool(t)
ctx := context.Background()
q := dbq.New(pool)
dir := filepath.Join(t.TempDir(), "Plastic Apes", "Mammalz (2017)")
@@ -145,7 +146,7 @@ type crossReleaseRipFixture struct {
func newCrossReleaseRipFixture(t *testing.T) crossReleaseRipFixture {
t.Helper()
pool := newPool(t)
pool := dbtest.Pool(t)
ctx := context.Background()
q := dbq.New(pool)
root := t.TempDir()
@@ -279,7 +280,7 @@ type oneAlbumFixture struct {
func newOneAlbumFixture(t *testing.T, tier, titleA, titleB string) oneAlbumFixture {
t.Helper()
pool := newPool(t)
pool := dbtest.Pool(t)
ctx := context.Background()
q := dbq.New(pool)
dir := filepath.Join(t.TempDir(), "Savanta", "Void")