walletdb: generic param passing for walletdb test

This commit removes bbolt specific parameters from the interface
test to enable testing of other DB drivers trough the same entry
point.
This commit is contained in:
Andras Banki-Horvath 2020-02-18 17:08:12 +01:00
parent 704cd189ac
commit f2ed9c1c77
2 changed files with 3 additions and 5 deletions

View file

@ -23,5 +23,5 @@ import (
func TestInterface(t *testing.T) { func TestInterface(t *testing.T) {
dbPath := "interfacetest.db" dbPath := "interfacetest.db"
defer os.RemoveAll(dbPath) defer os.RemoveAll(dbPath)
walletdbtest.TestInterface(t, dbType, dbPath) walletdbtest.TestInterface(t, dbType, dbPath, true)
} }

View file

@ -7,7 +7,6 @@ package walletdbtest
import ( import (
"bytes" "bytes"
"fmt" "fmt"
"os"
"reflect" "reflect"
"sync" "sync"
@ -793,13 +792,12 @@ func testBatchInterface(tc *testContext) bool {
} }
// TestInterface performs all interfaces tests for this database driver. // TestInterface performs all interfaces tests for this database driver.
func TestInterface(t Tester, dbType, dbPath string) { func TestInterface(t Tester, dbType string, args ...interface{}) {
db, err := walletdb.Create(dbType, dbPath, true) db, err := walletdb.Create(dbType, args...)
if err != nil { if err != nil {
t.Errorf("Failed to create test database (%s) %v", dbType, err) t.Errorf("Failed to create test database (%s) %v", dbType, err)
return return
} }
defer os.Remove(dbPath)
defer db.Close() defer db.Close()
// Run all of the interface tests against the database. // Run all of the interface tests against the database.