mirror of
https://github.com/lightninglabs/lightning-terminal.git
synced 2026-08-13 12:33:36 +02:00
If there are no RPCParamsJson set for an action, the value is represented differently in KVDB vs SQL. In the SQL DB, empty RPCParamsJson are represented as nil, while they are represented as an empty array in the KVDB version. Therefore, we need to override the RPCParamsJson in that scenario, so that they are set to the same representation when a KVDB and an SQL action is compared.
26 lines
778 B
Go
26 lines
778 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"
|
|
)
|
|
|
|
// 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, db.NewTestSqliteDB(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, dbPath string, clock clock.Clock) FirewallDBs {
|
|
return createStore(
|
|
t, db.NewTestSqliteDbHandleFromPath(t, dbPath).BaseDB, clock,
|
|
)
|
|
}
|