Files
lnd/graph/db/test_sql.go
Elle Mouton 5d7abcdf03 graph/db: refactor SQL DB creation files
Factor out the transaction executor construction so that we can have
access to the raw BatchedSQLQueries type from within tests.
2025-07-07 08:36:12 +02:00

24 lines
470 B
Go

//go:build test_db_postgres || test_db_sqlite
package graphdb
import (
"testing"
"github.com/btcsuite/btcd/chaincfg"
"github.com/stretchr/testify/require"
)
// NewTestDB is a helper function that creates a SQLStore backed by a SQL
// database for testing.
func NewTestDB(t testing.TB) V1Store {
store, err := NewSQLStore(
&SQLStoreConfig{
ChainHash: *chaincfg.MainNetParams.GenesisHash,
}, newBatchQuerier(t),
)
require.NoError(t, err)
return store
}