@@ -6,14 +6,17 @@ import (
66 "time"
77
88 "github.com/btcsuite/btcd/btcec/v2"
9+ "github.com/lightningnetwork/lnd/clock"
910 "github.com/stretchr/testify/require"
1011)
1112
13+ var testTime = time .Date (2020 , 1 , 1 , 0 , 0 , 0 , 0 , time .UTC )
14+
1215// TestBasicSessionStore tests the basic getters and setters of the session
1316// store.
1417func TestBasicSessionStore (t * testing.T ) {
1518 // Set up a new DB.
16- db , err := NewDB (t .TempDir (), "test.db" )
19+ db , err := NewDB (t .TempDir (), "test.db" , clock . NewTestClock ( testTime ) )
1720 require .NoError (t , err )
1821 t .Cleanup (func () {
1922 _ = db .Close ()
@@ -89,7 +92,7 @@ func TestBasicSessionStore(t *testing.T) {
8992// TestLinkingSessions tests that session linking works as expected.
9093func TestLinkingSessions (t * testing.T ) {
9194 // Set up a new DB.
92- db , err := NewDB (t .TempDir (), "test.db" )
95+ db , err := NewDB (t .TempDir (), "test.db" , clock . NewTestClock ( testTime ) )
9396 require .NoError (t , err )
9497 t .Cleanup (func () {
9598 _ = db .Close ()
@@ -125,7 +128,7 @@ func TestLinkingSessions(t *testing.T) {
125128// of the GetGroupID and GetSessionIDs methods.
126129func TestLinkedSessions (t * testing.T ) {
127130 // Set up a new DB.
128- db , err := NewDB (t .TempDir (), "test.db" )
131+ db , err := NewDB (t .TempDir (), "test.db" , clock . NewTestClock ( testTime ) )
129132 require .NoError (t , err )
130133 t .Cleanup (func () {
131134 _ = db .Close ()
@@ -192,7 +195,7 @@ func TestLinkedSessions(t *testing.T) {
192195// method correctly checks if each session in a group passes a predicate.
193196func TestCheckSessionGroupPredicate (t * testing.T ) {
194197 // Set up a new DB.
195- db , err := NewDB (t .TempDir (), "test.db" )
198+ db , err := NewDB (t .TempDir (), "test.db" , clock . NewTestClock ( testTime ) )
196199 require .NoError (t , err )
197200 t .Cleanup (func () {
198201 _ = db .Close ()
0 commit comments