Manual updates
This commit is contained in:
@@ -14,10 +14,10 @@ import (
|
||||
|
||||
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.
|
||||
// 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()
|
||||
dsn := os.Getenv("NTFY_TEST_DATABASE_URL")
|
||||
if dsn == "" {
|
||||
@@ -48,12 +48,12 @@ func CreateTestSchema(t *testing.T) string {
|
||||
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.
|
||||
// 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()
|
||||
schemaDSN := CreateTestSchema(t)
|
||||
schemaDSN := CreateTestPostgresSchema(t)
|
||||
testDB, err := db.OpenPostgres(schemaDSN)
|
||||
require.Nil(t, err)
|
||||
t.Cleanup(func() {
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
)
|
||||
|
||||
func newTestPostgresStore(t *testing.T) message.Store {
|
||||
testDB := dbtest.CreateTestDB(t)
|
||||
testDB := dbtest.CreateTestPostgres(t)
|
||||
store, err := message.NewPostgresStore(testDB, 0, 0)
|
||||
require.Nil(t, err)
|
||||
return store
|
||||
|
||||
@@ -4128,7 +4128,7 @@ func forEachBackend(t *testing.T, f func(t *testing.T, databaseURL string)) {
|
||||
f(t, "")
|
||||
})
|
||||
t.Run("postgres", func(t *testing.T) {
|
||||
f(t, dbtest.CreateTestSchema(t))
|
||||
f(t, dbtest.CreateTestPostgresSchema(t))
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ func forEachBackend(t *testing.T, f func(t *testing.T, newStore newStoreFunc)) {
|
||||
})
|
||||
})
|
||||
t.Run("postgres", func(t *testing.T) {
|
||||
schemaDSN := dbtest.CreateTestSchema(t)
|
||||
schemaDSN := dbtest.CreateTestPostgresSchema(t)
|
||||
f(t, func() Store {
|
||||
pool, err := db.OpenPostgres(schemaDSN)
|
||||
require.Nil(t, err)
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
)
|
||||
|
||||
func newTestPostgresStore(t *testing.T) user.Store {
|
||||
testDB := dbtest.CreateTestDB(t)
|
||||
testDB := dbtest.CreateTestPostgres(t)
|
||||
store, err := user.NewPostgresStore(testDB)
|
||||
require.Nil(t, err)
|
||||
return store
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
)
|
||||
|
||||
func newTestPostgresStore(t *testing.T) webpush.Store {
|
||||
testDB := dbtest.CreateTestDB(t)
|
||||
testDB := dbtest.CreateTestPostgres(t)
|
||||
store, err := webpush.NewPostgresStore(testDB)
|
||||
require.Nil(t, err)
|
||||
return store
|
||||
|
||||
Reference in New Issue
Block a user