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:
@@ -158,7 +158,7 @@ func addTrack(t *testing.T, q *dbq.Queries, album dbq.Album, artist dbq.Artist,
|
||||
// restoring `mbid = EXCLUDED.mbid` in UpsertTrack: the first re-read below
|
||||
// then erases the looked-up id.
|
||||
func TestUpsertTrack_KeepsALookedUpMbidUntilATagCarriesOne_Integration(t *testing.T) {
|
||||
pool := newPool(t)
|
||||
pool := dbtest.Pool(t)
|
||||
ctx := context.Background()
|
||||
q := dbq.New(pool)
|
||||
dir := t.TempDir()
|
||||
@@ -198,7 +198,7 @@ func TestUpsertTrack_KeepsALookedUpMbidUntilATagCarriesOne_Integration(t *testin
|
||||
}
|
||||
|
||||
func TestAcoustIDLookup_FillsOnlyWhatItCanSettle_Integration(t *testing.T) {
|
||||
pool := newPool(t)
|
||||
pool := dbtest.Pool(t)
|
||||
ctx := context.Background()
|
||||
q := dbq.New(pool)
|
||||
dir := t.TempDir()
|
||||
@@ -269,7 +269,7 @@ func TestAcoustIDLookup_FillsOnlyWhatItCanSettle_Integration(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAcoustIDLookup_StopsWhenTheServiceCannotAnswer_Integration(t *testing.T) {
|
||||
pool := newPool(t)
|
||||
pool := dbtest.Pool(t)
|
||||
ctx := context.Background()
|
||||
q := dbq.New(pool)
|
||||
dir := t.TempDir()
|
||||
@@ -306,7 +306,7 @@ func TestAcoustIDLookup_StopsWhenTheServiceCannotAnswer_Integration(t *testing.T
|
||||
// similarity worker picks the track as a seed and can map ListenBrainz's
|
||||
// answers back to it.
|
||||
func TestAcoustIDLookup_FilledTrackReachesSimilarity_Integration(t *testing.T) {
|
||||
pool := newPool(t)
|
||||
pool := dbtest.Pool(t)
|
||||
ctx := context.Background()
|
||||
q := dbq.New(pool)
|
||||
dir := t.TempDir()
|
||||
|
||||
Reference in New Issue
Block a user