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:
@@ -11,6 +11,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"git.fabledsword.com/bvandeusen/minstrel/internal/db/dbq"
|
||||
"git.fabledsword.com/bvandeusen/minstrel/internal/dbtest"
|
||||
syncpkg "git.fabledsword.com/bvandeusen/minstrel/internal/sync"
|
||||
)
|
||||
|
||||
@@ -18,7 +19,7 @@ import (
|
||||
// stores for each kind of result, that a pass ends, and that the gauge counts
|
||||
// what the passes wrote.
|
||||
func TestLoudnessBackfill_Integration(t *testing.T) {
|
||||
pool := newPool(t)
|
||||
pool := dbtest.Pool(t)
|
||||
ctx := context.Background()
|
||||
q := dbq.New(pool)
|
||||
dir := t.TempDir()
|
||||
@@ -230,7 +231,7 @@ func TestLoudnessBackfill_Integration(t *testing.T) {
|
||||
// The Go defaults must match the migration's, or a database that cannot be
|
||||
// read would analyze differently from a fresh install.
|
||||
func TestLoudnessSettings_DefaultsMatchMigration(t *testing.T) {
|
||||
pool := newPool(t)
|
||||
pool := dbtest.Pool(t)
|
||||
s, err := NewLoudnessSettingsService(context.Background(), pool)
|
||||
if err != nil {
|
||||
t.Fatalf("load: %v", err)
|
||||
|
||||
Reference in New Issue
Block a user