Files
lnd/graph/db/test_kvdb.go
Elle Mouton d8337be968 graph/db: add helper variable for tests
Add an isSQLDB variable that will let us quickly check in tests if the
backing DB is KVStore or SQLStore.
2026-02-13 07:21:21 +02:00

27 lines
585 B
Go

//go:build !test_db_sqlite && !test_db_postgres
package graphdb
import (
"testing"
"github.com/lightningnetwork/lnd/kvdb"
"github.com/stretchr/testify/require"
)
// isSQLDB indicates that this build does not use a SQL database.
var isSQLDB = false
// NewTestDB is a helper function that creates an BBolt database for testing.
func NewTestDB(t testing.TB) Store {
backend, backendCleanup, err := kvdb.GetTestBackend(t.TempDir(), "cgr")
require.NoError(t, err)
t.Cleanup(backendCleanup)
graphStore, err := NewKVStore(backend)
require.NoError(t, err)
return graphStore
}