From eb26c2b1c5191b7dc2a1a3b41072787e51a300ca Mon Sep 17 00:00:00 2001 From: Viktor Torstensson Date: Thu, 24 Jul 2025 01:47:28 +0200 Subject: [PATCH] mutli: rename `db.NewTestPostgresV2DB` function As the legacy `NewTestPostgresDB` function is no longer used and has been removed, it no longer makes sense to have a `V2` suffix on the `NewTestPostgresV2DB` function. This commit renames it to `NewTestPostgresDB`, to indicate that this function now replaces the legacy function. --- accounts/test_postgres.go | 4 ++-- db/postgres.go | 6 +++--- firewalldb/test_postgres.go | 4 ++-- session/test_postgres.go | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/accounts/test_postgres.go b/accounts/test_postgres.go index a88ed3a8..16665030 100644 --- a/accounts/test_postgres.go +++ b/accounts/test_postgres.go @@ -16,7 +16,7 @@ var ErrDBClosed = errors.New("database is closed") // NewTestDB is a helper function that creates an SQLStore database for testing. func NewTestDB(t *testing.T, clock clock.Clock) Store { - return createStore(t, db.NewTestPostgresV2DB(t).BaseDB, clock) + return createStore(t, db.NewTestPostgresDB(t).BaseDB, clock) } // NewTestDBFromPath is a helper function that creates a new SQLStore with a @@ -24,5 +24,5 @@ func NewTestDB(t *testing.T, clock clock.Clock) Store { func NewTestDBFromPath(t *testing.T, dbPath string, clock clock.Clock) Store { - return createStore(t, db.NewTestPostgresV2DB(t).BaseDB, clock) + return createStore(t, db.NewTestPostgresDB(t).BaseDB, clock) } diff --git a/db/postgres.go b/db/postgres.go index e9d28ca2..358efeb2 100644 --- a/db/postgres.go +++ b/db/postgres.go @@ -56,9 +56,9 @@ func (s *PostgresConfig) DSN(hidePassword bool) string { s.DBName, sslMode) } -// NewTestPostgresV2DB is a helper function that creates a Postgres database for -// testing, using the sqldb v2 package's definition of the PostgresStore. -func NewTestPostgresV2DB(t *testing.T) *sqldb.PostgresStore { +// NewTestPostgresDB is a helper function that creates a Postgres database for +// testing. +func NewTestPostgresDB(t *testing.T) *sqldb.PostgresStore { t.Helper() t.Logf("Creating new Postgres DB for testing") diff --git a/firewalldb/test_postgres.go b/firewalldb/test_postgres.go index 1f811dce..71bd5bb6 100644 --- a/firewalldb/test_postgres.go +++ b/firewalldb/test_postgres.go @@ -14,11 +14,11 @@ var isSqlite = false // NewTestDB is a helper function that creates an BBolt database for testing. func NewTestDB(t *testing.T, clock clock.Clock) FirewallDBs { - return createStore(t, db.NewTestPostgresV2DB(t).BaseDB, clock) + return createStore(t, db.NewTestPostgresDB(t).BaseDB, clock) } // NewTestDBFromPath is a helper function that creates a new BoltStore with a // connection to an existing BBolt database for testing. func NewTestDBFromPath(t *testing.T, _ string, clock clock.Clock) FirewallDBs { - return createStore(t, db.NewTestPostgresV2DB(t).BaseDB, clock) + return createStore(t, db.NewTestPostgresDB(t).BaseDB, clock) } diff --git a/session/test_postgres.go b/session/test_postgres.go index d8d5d211..cb5aa061 100644 --- a/session/test_postgres.go +++ b/session/test_postgres.go @@ -16,7 +16,7 @@ var ErrDBClosed = errors.New("database is closed") // NewTestDB is a helper function that creates an SQLStore database for testing. func NewTestDB(t *testing.T, clock clock.Clock) Store { - return createStore(t, db.NewTestPostgresV2DB(t).BaseDB, clock) + return createStore(t, db.NewTestPostgresDB(t).BaseDB, clock) } // NewTestDBFromPath is a helper function that creates a new SQLStore with a @@ -24,5 +24,5 @@ func NewTestDB(t *testing.T, clock clock.Clock) Store { func NewTestDBFromPath(t *testing.T, dbPath string, clock clock.Clock) Store { - return createStore(t, db.NewTestPostgresV2DB(t).BaseDB, clock) + return createStore(t, db.NewTestPostgresDB(t).BaseDB, clock) }