From f2ed9c1c77a29c9e56e0f6a6e3c6fc5883e15bec Mon Sep 17 00:00:00 2001 From: Andras Banki-Horvath Date: Tue, 18 Feb 2020 17:08:12 +0100 Subject: [PATCH] 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. --- walletdb/bdb/interface_test.go | 2 +- walletdb/walletdbtest/interface.go | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/walletdb/bdb/interface_test.go b/walletdb/bdb/interface_test.go index ec10fec..1dcf605 100644 --- a/walletdb/bdb/interface_test.go +++ b/walletdb/bdb/interface_test.go @@ -23,5 +23,5 @@ import ( func TestInterface(t *testing.T) { dbPath := "interfacetest.db" defer os.RemoveAll(dbPath) - walletdbtest.TestInterface(t, dbType, dbPath) + walletdbtest.TestInterface(t, dbType, dbPath, true) } diff --git a/walletdb/walletdbtest/interface.go b/walletdb/walletdbtest/interface.go index fe338a7..037de1c 100644 --- a/walletdb/walletdbtest/interface.go +++ b/walletdb/walletdbtest/interface.go @@ -7,7 +7,6 @@ package walletdbtest import ( "bytes" "fmt" - "os" "reflect" "sync" @@ -793,13 +792,12 @@ func testBatchInterface(tc *testContext) bool { } // TestInterface performs all interfaces tests for this database driver. -func TestInterface(t Tester, dbType, dbPath string) { - db, err := walletdb.Create(dbType, dbPath, true) +func TestInterface(t Tester, dbType string, args ...interface{}) { + db, err := walletdb.Create(dbType, args...) if err != nil { t.Errorf("Failed to create test database (%s) %v", dbType, err) return } - defer os.Remove(dbPath) defer db.Close() // Run all of the interface tests against the database.