Skip to content

Commit f947f37

Browse files
firewalldb: update NewTestDB funcs to return FirewallDBs
1 parent 9e9d425 commit f947f37

File tree

4 files changed

+16
-11
lines changed

4 files changed

+16
-11
lines changed

firewalldb/test_kvdb.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,35 @@ package firewalldb
55
import (
66
"testing"
77

8+
"github.com/lightninglabs/lightning-terminal/session"
89
"github.com/lightningnetwork/lnd/clock"
910
"github.com/stretchr/testify/require"
1011
)
1112

1213
// NewTestDB is a helper function that creates an BBolt database for testing.
13-
func NewTestDB(t *testing.T, clock clock.Clock) *BoltDB {
14+
func NewTestDB(t *testing.T, clock clock.Clock) FirewallDBs {
1415
return NewTestDBFromPath(t, t.TempDir(), clock)
1516
}
1617

1718
// NewTestDBFromPath is a helper function that creates a new BoltStore with a
1819
// connection to an existing BBolt database for testing.
19-
func NewTestDBFromPath(t *testing.T, dbPath string, clock clock.Clock) *BoltDB {
20+
func NewTestDBFromPath(t *testing.T, dbPath string,
21+
clock clock.Clock) FirewallDBs {
22+
2023
return newDBFromPathWithSessions(t, dbPath, nil, nil, clock)
2124
}
2225

2326
// NewTestDBWithSessions creates a new test BoltDB Store with access to an
2427
// existing sessions DB.
25-
func NewTestDBWithSessions(t *testing.T, sessStore SessionDB,
26-
clock clock.Clock) *BoltDB {
28+
func NewTestDBWithSessions(t *testing.T, sessStore session.Store,
29+
clock clock.Clock) FirewallDBs {
2730

2831
return newDBFromPathWithSessions(t, t.TempDir(), sessStore, nil, clock)
2932
}
3033

3134
func newDBFromPathWithSessions(t *testing.T, dbPath string,
32-
sessStore SessionDB, acctStore AccountsDB, clock clock.Clock) *BoltDB {
35+
sessStore session.Store, acctStore AccountsDB,
36+
clock clock.Clock) FirewallDBs {
3337

3438
store, err := NewBoltDB(dbPath, DBFilename, sessStore, acctStore, clock)
3539
require.NoError(t, err)

firewalldb/test_postgres.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ import (
1010
)
1111

1212
// NewTestDB is a helper function that creates an BBolt database for testing.
13-
func NewTestDB(t *testing.T, clock clock.Clock) *SQLDB {
13+
func NewTestDB(t *testing.T, clock clock.Clock) FirewallDBs {
1414
return NewSQLDB(db.NewTestPostgresDB(t).BaseDB, clock)
1515
}
1616

1717
// NewTestDBFromPath is a helper function that creates a new BoltStore with a
1818
// connection to an existing BBolt database for testing.
19-
func NewTestDBFromPath(t *testing.T, _ string, clock clock.Clock) *SQLDB {
19+
func NewTestDBFromPath(t *testing.T, _ string, clock clock.Clock) FirewallDBs {
2020
return NewSQLDB(db.NewTestPostgresDB(t).BaseDB, clock)
2121
}

firewalldb/test_sql.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ import (
1313
// NewTestDBWithSessions creates a new test SQLDB Store with access to an
1414
// existing sessions DB.
1515
func NewTestDBWithSessions(t *testing.T, sessionStore session.Store,
16-
clock clock.Clock) *SQLDB {
17-
16+
clock clock.Clock) FirewallDBs {
1817
sessions, ok := sessionStore.(*session.SQLStore)
1918
require.True(t, ok)
2019

firewalldb/test_sqlite.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@ import (
1010
)
1111

1212
// NewTestDB is a helper function that creates an BBolt database for testing.
13-
func NewTestDB(t *testing.T, clock clock.Clock) *SQLDB {
13+
func NewTestDB(t *testing.T, clock clock.Clock) FirewallDBs {
1414
return NewSQLDB(db.NewTestSqliteDB(t).BaseDB, clock)
1515
}
1616

1717
// NewTestDBFromPath is a helper function that creates a new BoltStore with a
1818
// connection to an existing BBolt database for testing.
19-
func NewTestDBFromPath(t *testing.T, dbPath string, clock clock.Clock) *SQLDB {
19+
func NewTestDBFromPath(t *testing.T, dbPath string,
20+
clock clock.Clock) FirewallDBs {
21+
2022
return NewSQLDB(
2123
db.NewTestSqliteDbHandleFromPath(t, dbPath).BaseDB, clock,
2224
)

0 commit comments

Comments
 (0)