mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-11-11 06:37:21 +01:00
sqldb: add helpers to create test DBs migrated up to a select version
This commit is contained in:
@@ -9,5 +9,21 @@ import (
|
||||
|
||||
// NewTestDB is a helper function that creates a Postgres database for testing.
|
||||
func NewTestDB(t *testing.T) *PostgresStore {
|
||||
return NewTestPostgresDB(t)
|
||||
pgFixture := NewTestPgFixture(t, DefaultPostgresFixtureLifetime)
|
||||
t.Cleanup(func() {
|
||||
pgFixture.TearDown(t)
|
||||
})
|
||||
|
||||
return NewTestPostgresDB(t, pgFixture)
|
||||
}
|
||||
|
||||
// NewTestDBWithVersion is a helper function that creates a Postgres database
|
||||
// for testing and migrates it to the given version.
|
||||
func NewTestDBWithVersion(t *testing.T, version uint) *PostgresStore {
|
||||
pgFixture := NewTestPgFixture(t, DefaultPostgresFixtureLifetime)
|
||||
t.Cleanup(func() {
|
||||
pgFixture.TearDown(t)
|
||||
})
|
||||
|
||||
return NewTestPostgresDBWithVersion(t, pgFixture, version)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user