lightning-terminal/firewalldb/test_postgres.go
Elle Mouton 297313e9c1
firewalldb: add clock.Clock to firewalldb DB impls
In preparation for using the clock to get an Action's AttemptedAt time
in an upcoming commit, we let both the bbolt and SQL impls of the
firewalldb take a clock.
2025-05-13 08:06:16 +02:00

21 lines
645 B
Go

//go:build test_db_postgres && !test_db_sqlite
package firewalldb
import (
"testing"
"github.com/lightninglabs/lightning-terminal/db"
"github.com/lightningnetwork/lnd/clock"
)
// NewTestDB is a helper function that creates an BBolt database for testing.
func NewTestDB(t *testing.T, clock clock.Clock) *SQLDB {
return NewSQLDB(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) *SQLDB {
return NewSQLDB(db.NewTestPostgresDB(t).BaseDB, clock)
}