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:
@@ -75,7 +75,7 @@ func newSongLinkFixture(t *testing.T, pool *pgxpool.Pool) songLinkFixture {
|
||||
// list shows the song once, a like or unlike on either copy reaches both, and
|
||||
// "not the same song" undoes the link.
|
||||
func TestCrossReleaseCopiesCountAsOneSong_Integration(t *testing.T) {
|
||||
pool := newPool(t)
|
||||
pool := dbtest.Pool(t)
|
||||
ctx := context.Background()
|
||||
q := dbq.New(pool)
|
||||
f := newSongLinkFixture(t, pool)
|
||||
@@ -153,7 +153,7 @@ func TestCrossReleaseCopiesCountAsOneSong_Integration(t *testing.T) {
|
||||
|
||||
// With auto-resolve off the resolver links nothing.
|
||||
func TestCrossReleaseLinkNeedsAutoResolve_Integration(t *testing.T) {
|
||||
pool := newPool(t)
|
||||
pool := dbtest.Pool(t)
|
||||
ctx := context.Background()
|
||||
q := dbq.New(pool)
|
||||
f := newSongLinkFixture(t, pool)
|
||||
@@ -172,7 +172,7 @@ func TestCrossReleaseLinkNeedsAutoResolve_Integration(t *testing.T) {
|
||||
// they make it the key.
|
||||
func TestMergeInheritsSongLink_Integration(t *testing.T) {
|
||||
for _, removeAlbumCut := range []bool{true, false} {
|
||||
pool := newPool(t)
|
||||
pool := dbtest.Pool(t)
|
||||
ctx := context.Background()
|
||||
q := dbq.New(pool)
|
||||
f := newSongLinkFixture(t, pool)
|
||||
@@ -226,7 +226,7 @@ func songKeys(t *testing.T, q *dbq.Queries, ids ...pgtype.UUID) []pgtype.UUID {
|
||||
// extra copy is merged into its FLAC, the single stays, and the two copies
|
||||
// left are linked as one song.
|
||||
func TestResolveDuplicates_FoldsAnAlbumsExtraCopyInACrossReleaseGroup_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