mirror of
https://github.com/lightninglabs/lightning-terminal.git
synced 2026-08-13 12:33:36 +02:00
Update the firewalldb package to use the `sqldb/v2` package instead of the older version.
32 lines
889 B
Go
32 lines
889 B
Go
//go:build test_db_sqlite && !test_db_postgres
|
|
|
|
package firewalldb
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/lightninglabs/lightning-terminal/db"
|
|
"github.com/lightningnetwork/lnd/clock"
|
|
"github.com/lightningnetwork/lnd/sqldb/v2"
|
|
)
|
|
|
|
// isSqlite is true if the test_db_sqlite build flag is set.
|
|
var isSqlite = true
|
|
|
|
// NewTestDB is a helper function that creates an BBolt database for testing.
|
|
func NewTestDB(t *testing.T, clock clock.Clock) FirewallDBs {
|
|
return createStore(
|
|
t, sqldb.NewTestSqliteDB(t, db.LitdMigrationStreams).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, dbPath string,
|
|
clock clock.Clock) FirewallDBs {
|
|
|
|
tDb := sqldb.NewTestSqliteDBFromPath(t, dbPath, db.LitdMigrationStreams)
|
|
|
|
return createStore(t, tDb.BaseDB, clock)
|
|
}
|