mirror of
https://github.com/lightninglabs/lightning-terminal.git
synced 2026-08-13 12:33:36 +02:00
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.
28 lines
834 B
Go
28 lines
834 B
Go
//go:build test_db_postgres && !test_db_sqlite
|
|
|
|
package session
|
|
|
|
import (
|
|
"errors"
|
|
"testing"
|
|
|
|
"github.com/lightninglabs/lightning-terminal/db"
|
|
"github.com/lightningnetwork/lnd/clock"
|
|
)
|
|
|
|
// ErrDBClosed is an error that is returned when a database operation is
|
|
// performed on a closed database.
|
|
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.NewTestPostgresDB(t).BaseDB, clock)
|
|
}
|
|
|
|
// NewTestDBFromPath is a helper function that creates a new SQLStore with a
|
|
// connection to an existing postgres database for testing.
|
|
func NewTestDBFromPath(t *testing.T, dbPath string,
|
|
clock clock.Clock) Store {
|
|
|
|
return createStore(t, db.NewTestPostgresDB(t).BaseDB, clock)
|
|
}
|