mirror of
https://github.com/lightninglabs/lightning-terminal.git
synced 2026-08-13 12:33:36 +02:00
accounts: update NewTestDB func to return Store
In preparation for upcoming migration tests from a kvdb to an SQL store, this commit updates the NewTestDB function to return the Store interface rather than a concrete store implementation. This change ensures that migration tests can call NewTestDB under any build tag while receiving a consistent return type.
This commit is contained in:
parent
f664d752ed
commit
92689c546c
3 changed files with 6 additions and 6 deletions
|
|
@ -15,14 +15,14 @@ import (
|
|||
var ErrDBClosed = errors.New("database not open")
|
||||
|
||||
// NewTestDB is a helper function that creates an BBolt database for testing.
|
||||
func NewTestDB(t *testing.T, clock clock.Clock) *BoltStore {
|
||||
func NewTestDB(t *testing.T, clock clock.Clock) Store {
|
||||
return NewTestDBFromPath(t, t.TempDir(), 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, dbPath string,
|
||||
clock clock.Clock) *BoltStore {
|
||||
clock clock.Clock) Store {
|
||||
|
||||
store, err := NewBoltStore(dbPath, DBFilename, clock)
|
||||
require.NoError(t, err)
|
||||
|
|
|
|||
|
|
@ -15,14 +15,14 @@ import (
|
|||
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) *SQLStore {
|
||||
func NewTestDB(t *testing.T, clock clock.Clock) Store {
|
||||
return NewSQLStore(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) *SQLStore {
|
||||
clock clock.Clock) Store {
|
||||
|
||||
return NewSQLStore(db.NewTestPostgresDB(t).BaseDB, clock)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,14 +15,14 @@ import (
|
|||
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) *SQLStore {
|
||||
func NewTestDB(t *testing.T, clock clock.Clock) Store {
|
||||
return NewSQLStore(db.NewTestSqliteDB(t).BaseDB, clock)
|
||||
}
|
||||
|
||||
// NewTestDBFromPath is a helper function that creates a new SQLStore with a
|
||||
// connection to an existing SQL database for testing.
|
||||
func NewTestDBFromPath(t *testing.T, dbPath string,
|
||||
clock clock.Clock) *SQLStore {
|
||||
clock clock.Clock) Store {
|
||||
|
||||
return NewSQLStore(
|
||||
db.NewTestSqliteDbHandleFromPath(t, dbPath).BaseDB, clock,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue