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:
@@ -9,6 +9,7 @@ import (
|
||||
"github.com/jackc/pgx/v5/pgtype"
|
||||
|
||||
"git.fabledsword.com/bvandeusen/minstrel/internal/db/dbq"
|
||||
"git.fabledsword.com/bvandeusen/minstrel/internal/dbtest"
|
||||
)
|
||||
|
||||
func uuidN(n byte) pgtype.UUID {
|
||||
@@ -132,7 +133,7 @@ func almostEq(a, b float64) bool { return math.Abs(a-b) < 1e-9 }
|
||||
// TestLoadTasteProfile_RoundTrip seeds taste_profile rows and verifies the
|
||||
// reader hydrates them into a profile that scores a matching track positively.
|
||||
func TestLoadTasteProfile_RoundTrip(t *testing.T) {
|
||||
pool := newPool(t)
|
||||
pool := dbtest.Pool(t)
|
||||
ctx := context.Background()
|
||||
u := seedUser(t, pool, "taste-rt")
|
||||
art := seedArtist(t, pool, "Loved Artist", "")
|
||||
|
||||
Reference in New Issue
Block a user