mirror of
https://github.com/lightningnetwork/lnd.git
synced 2024-11-19 01:43:16 +01:00
0edc16aa01
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
36 lines
609 B
Go
36 lines
609 B
Go
package kvdb
|
|
|
|
import (
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
"github.com/btcsuite/btcwallet/walletdb"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
type boltFixture struct {
|
|
t *testing.T
|
|
tempDir string
|
|
}
|
|
|
|
func NewBoltFixture(t *testing.T) *boltFixture {
|
|
return &boltFixture{
|
|
t: t,
|
|
tempDir: t.TempDir(),
|
|
}
|
|
}
|
|
|
|
func (b *boltFixture) NewBackend() walletdb.DB {
|
|
dbPath := filepath.Join(b.tempDir)
|
|
|
|
db, err := GetBoltBackend(&BoltBackendConfig{
|
|
DBPath: dbPath,
|
|
DBFileName: "test.db",
|
|
NoFreelistSync: true,
|
|
DBTimeout: DefaultDBTimeout,
|
|
})
|
|
require.NoError(b.t, err)
|
|
|
|
return db
|
|
}
|