2015-12-01 19:44:58 +01:00
|
|
|
// Copyright (c) 2014 The btcsuite developers
|
|
|
|
// Use of this source code is governed by an ISC
|
|
|
|
// license that can be found in the LICENSE file.
|
2014-11-10 01:34:40 +01:00
|
|
|
|
|
|
|
// This file intended to be copied into each backend driver directory. Each
|
|
|
|
// driver should have their own driver_test.go file which creates a database and
|
|
|
|
// invokes the testInterface function in this file to ensure the driver properly
|
|
|
|
// implements the interface. See the bdb backend driver for a working example.
|
|
|
|
//
|
|
|
|
// NOTE: When copying this file into the backend driver folder, the package name
|
|
|
|
// will need to be changed accordingly.
|
|
|
|
|
|
|
|
package bdb_test
|
|
|
|
|
|
|
|
import (
|
2020-04-03 23:13:53 +02:00
|
|
|
"io/ioutil"
|
2017-01-20 01:07:56 +01:00
|
|
|
"os"
|
2020-04-03 23:13:53 +02:00
|
|
|
"path/filepath"
|
2014-11-10 01:34:40 +01:00
|
|
|
"testing"
|
|
|
|
|
2021-08-26 00:58:28 +02:00
|
|
|
"github.com/lbryio/lbcwallet/walletdb/walletdbtest"
|
2014-11-10 01:34:40 +01:00
|
|
|
)
|
|
|
|
|
2017-01-20 01:07:56 +01:00
|
|
|
// TestInterface performs all interfaces tests for this database driver.
|
|
|
|
func TestInterface(t *testing.T) {
|
2020-04-03 23:13:53 +02:00
|
|
|
tempDir, err := ioutil.TempDir("", "interfacetest")
|
|
|
|
if err != nil {
|
|
|
|
t.Errorf("unable to create temp dir: %v", err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
defer os.Remove(tempDir)
|
|
|
|
|
|
|
|
dbPath := filepath.Join(tempDir, "db")
|
2017-01-20 01:07:56 +01:00
|
|
|
defer os.RemoveAll(dbPath)
|
2020-08-11 14:15:46 +02:00
|
|
|
walletdbtest.TestInterface(t, dbType, dbPath, true, defaultDBTimeout)
|
2014-11-10 01:34:40 +01:00
|
|
|
}
|