mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-11-11 14:48:14 +01:00
Factor out the transaction executor construction so that we can have access to the raw BatchedSQLQueries type from within tests.
24 lines
470 B
Go
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
|
|
}
|