Manual updates

This commit is contained in:
binwiederhier
2026-02-21 10:36:09 -05:00
parent b82e1c3915
commit c76e39bb0e
6 changed files with 10 additions and 10 deletions

View File

@@ -14,10 +14,10 @@ import (
const testPoolMaxConns = "2" const testPoolMaxConns = "2"
// CreateTestSchema creates a temporary PostgreSQL schema and returns the DSN pointing to it. // CreateTestPostgresSchema creates a temporary PostgreSQL schema and returns the DSN pointing to it.
// It registers a cleanup function to drop the schema when the test finishes. // It registers a cleanup function to drop the schema when the test finishes.
// If NTFY_TEST_DATABASE_URL is not set, the test is skipped. // If NTFY_TEST_DATABASE_URL is not set, the test is skipped.
func CreateTestSchema(t *testing.T) string { func CreateTestPostgresSchema(t *testing.T) string {
t.Helper() t.Helper()
dsn := os.Getenv("NTFY_TEST_DATABASE_URL") dsn := os.Getenv("NTFY_TEST_DATABASE_URL")
if dsn == "" { if dsn == "" {
@@ -48,12 +48,12 @@ func CreateTestSchema(t *testing.T) string {
return schemaDSN return schemaDSN
} }
// CreateTestDB creates a temporary PostgreSQL schema and returns an open *sql.DB connection to it. // CreateTestPostgres creates a temporary PostgreSQL schema and returns an open *sql.DB connection to it.
// It registers cleanup functions to close the DB and drop the schema when the test finishes. // It registers cleanup functions to close the DB and drop the schema when the test finishes.
// If NTFY_TEST_DATABASE_URL is not set, the test is skipped. // If NTFY_TEST_DATABASE_URL is not set, the test is skipped.
func CreateTestDB(t *testing.T) *sql.DB { func CreateTestPostgres(t *testing.T) *sql.DB {
t.Helper() t.Helper()
schemaDSN := CreateTestSchema(t) schemaDSN := CreateTestPostgresSchema(t)
testDB, err := db.OpenPostgres(schemaDSN) testDB, err := db.OpenPostgres(schemaDSN)
require.Nil(t, err) require.Nil(t, err)
t.Cleanup(func() { t.Cleanup(func() {

View File

@@ -10,7 +10,7 @@ import (
) )
func newTestPostgresStore(t *testing.T) message.Store { func newTestPostgresStore(t *testing.T) message.Store {
testDB := dbtest.CreateTestDB(t) testDB := dbtest.CreateTestPostgres(t)
store, err := message.NewPostgresStore(testDB, 0, 0) store, err := message.NewPostgresStore(testDB, 0, 0)
require.Nil(t, err) require.Nil(t, err)
return store return store

View File

@@ -4128,7 +4128,7 @@ func forEachBackend(t *testing.T, f func(t *testing.T, databaseURL string)) {
f(t, "") f(t, "")
}) })
t.Run("postgres", func(t *testing.T) { t.Run("postgres", func(t *testing.T) {
f(t, dbtest.CreateTestSchema(t)) f(t, dbtest.CreateTestPostgresSchema(t))
}) })
} }

View File

@@ -33,7 +33,7 @@ func forEachBackend(t *testing.T, f func(t *testing.T, newStore newStoreFunc)) {
}) })
}) })
t.Run("postgres", func(t *testing.T) { t.Run("postgres", func(t *testing.T) {
schemaDSN := dbtest.CreateTestSchema(t) schemaDSN := dbtest.CreateTestPostgresSchema(t)
f(t, func() Store { f(t, func() Store {
pool, err := db.OpenPostgres(schemaDSN) pool, err := db.OpenPostgres(schemaDSN)
require.Nil(t, err) require.Nil(t, err)

View File

@@ -9,7 +9,7 @@ import (
) )
func newTestPostgresStore(t *testing.T) user.Store { func newTestPostgresStore(t *testing.T) user.Store {
testDB := dbtest.CreateTestDB(t) testDB := dbtest.CreateTestPostgres(t)
store, err := user.NewPostgresStore(testDB) store, err := user.NewPostgresStore(testDB)
require.Nil(t, err) require.Nil(t, err)
return store return store

View File

@@ -9,7 +9,7 @@ import (
) )
func newTestPostgresStore(t *testing.T) webpush.Store { func newTestPostgresStore(t *testing.T) webpush.Store {
testDB := dbtest.CreateTestDB(t) testDB := dbtest.CreateTestPostgres(t)
store, err := webpush.NewPostgresStore(testDB) store, err := webpush.NewPostgresStore(testDB)
require.Nil(t, err) require.Nil(t, err)
return store return store