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:
@@ -14,6 +14,7 @@ import (
|
||||
"github.com/jackc/pgx/v5/pgxpool"
|
||||
|
||||
"git.fabledsword.com/bvandeusen/minstrel/internal/db/dbq"
|
||||
"git.fabledsword.com/bvandeusen/minstrel/internal/dbtest"
|
||||
)
|
||||
|
||||
func mkdir(t *testing.T, parts ...string) string {
|
||||
@@ -84,7 +85,7 @@ func clearSavedRoots(t *testing.T, pool *pgxpool.Pool) {
|
||||
}
|
||||
|
||||
func TestSetRoots_TracksMoveWithTheirFolder_Integration(t *testing.T) {
|
||||
pool := newPool(t)
|
||||
pool := dbtest.Pool(t)
|
||||
clearSavedRoots(t, pool)
|
||||
ctx := context.Background()
|
||||
base := t.TempDir()
|
||||
@@ -126,7 +127,7 @@ func TestSetRoots_TracksMoveWithTheirFolder_Integration(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSetRoots_RefusesAMoveToAFolderWithoutTheFiles_Integration(t *testing.T) {
|
||||
pool := newPool(t)
|
||||
pool := dbtest.Pool(t)
|
||||
clearSavedRoots(t, pool)
|
||||
ctx := context.Background()
|
||||
base := t.TempDir()
|
||||
|
||||
Reference in New Issue
Block a user