mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-10-11 04:32:42 +02:00
kvdb: add sqlite
This commit is contained in:
35
kvdb/sqlite/db_test.go
Normal file
35
kvdb/sqlite/db_test.go
Normal file
@@ -0,0 +1,35 @@
|
||||
//go:build kvdb_sqlite && !(windows && (arm || 386)) && !(linux && (ppc64 || mips || mipsle || mips64))
|
||||
|
||||
package sqlite
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcwallet/walletdb/walletdbtest"
|
||||
"github.com/lightningnetwork/lnd/kvdb/sqlbase"
|
||||
"github.com/stretchr/testify/require"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
// TestInterface performs all interfaces tests for this database driver.
|
||||
func TestInterface(t *testing.T) {
|
||||
// dbType is the database type name for this driver.
|
||||
dir := t.TempDir()
|
||||
ctx := context.Background()
|
||||
|
||||
sqlbase.Init(0)
|
||||
|
||||
cfg := &Config{
|
||||
BusyTimeout: time.Second * 5,
|
||||
}
|
||||
|
||||
sqlDB, err := NewSqliteBackend(ctx, cfg, dir, "tmp.db", "table")
|
||||
require.NoError(t, err)
|
||||
|
||||
t.Cleanup(func() {
|
||||
require.NoError(t, sqlDB.Close())
|
||||
})
|
||||
|
||||
walletdbtest.TestInterface(t, dbType, ctx, cfg, dir, "tmp.db", "temp")
|
||||
}
|
Reference in New Issue
Block a user