Add an isSQLDB variable that will let us quickly check in tests if the backing DB is KVStore or SQLStore.
27 lines
585 B
Go
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
|
|
}
|