Files
lnd/graph/db/test_sqlite.go
Elle Mouton c9a775e7fb graph/db: fix build flag directive
Fix a typo in the build directive.
2025-07-07 08:36:12 +02:00

34 lines
673 B
Go

//go:build !test_db_postgres && test_db_sqlite
package graphdb
import (
"database/sql"
"testing"
"github.com/btcsuite/btcd/chaincfg"
"github.com/lightningnetwork/lnd/sqldb"
"github.com/stretchr/testify/require"
)
// NewTestDB is a helper function that creates a SQLStore backed by a sqlite
// database for testing.
func NewTestDB(t testing.TB) V1Store {
db := sqldb.NewTestSqliteDB(t).BaseDB
executor := sqldb.NewTransactionExecutor(
db, func(tx *sql.Tx) SQLQueries {
return db.WithTx(tx)
},
)
store, err := NewSQLStore(
&SQLStoreConfig{
ChainHash: *chaincfg.MainNetParams.GenesisHash,
}, executor,
)
require.NoError(t, err)
return store
}