mirror of
https://github.com/lightningnetwork/lnd.git
synced 2026-08-14 12:42:48 +02:00
21 lines
441 B
Go
21 lines
441 B
Go
//go:build test_db_postgres && !test_db_sqlite
|
|
|
|
package chainparams
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/lightningnetwork/lnd/sqldb"
|
|
)
|
|
|
|
// newTestDB creates a Postgres-backed BaseDB for use in unit tests.
|
|
func newTestDB(t testing.TB) *sqldb.BaseDB {
|
|
pgFixture := sqldb.NewTestPgFixture(
|
|
t, sqldb.DefaultPostgresFixtureLifetime,
|
|
)
|
|
t.Cleanup(func() {
|
|
pgFixture.TearDown(t)
|
|
})
|
|
|
|
return sqldb.NewTestPostgresDB(t, pgFixture).GetBaseDB()
|
|
}
|