waddrmgr: update tests to use db timeout param

This commit is contained in:
yyforyongyu 2020-08-12 03:51:32 +08:00
parent 08308c81ed
commit f6ea9d4d7b
No known key found for this signature in database
GPG key ID: 9BCD95C4FF296868
2 changed files with 7 additions and 3 deletions

View file

@ -200,6 +200,10 @@ var (
// expectedInternalAddrs is the list of expected internal addresses
// generated from the seed
expectedInternalAddrs = expectedAddrs[5:]
// defaultDBTimeout specifies the timeout value when opening the wallet
// database.
defaultDBTimeout = 10 * time.Second
)
// checkManagerError ensures the passed error is a ManagerError with an error
@ -238,7 +242,7 @@ func emptyDB(t *testing.T) (tearDownFunc func(), db walletdb.DB) {
t.Fatalf("Failed to create db temp dir: %v", err)
}
dbPath := filepath.Join(dirName, "mgrtest.db")
db, err = walletdb.Create("bdb", dbPath, true)
db, err = walletdb.Create("bdb", dbPath, true, defaultDBTimeout)
if err != nil {
_ = os.RemoveAll(dirName)
t.Fatalf("createDbNamespace: unexpected error: %v", err)
@ -259,7 +263,7 @@ func setupManager(t *testing.T) (tearDownFunc func(), db walletdb.DB, mgr *Manag
t.Fatalf("Failed to create db temp dir: %v", err)
}
dbPath := filepath.Join(dirName, "mgrtest.db")
db, err = walletdb.Create("bdb", dbPath, true)
db, err = walletdb.Create("bdb", dbPath, true, defaultDBTimeout)
if err != nil {
_ = os.RemoveAll(dirName)
t.Fatalf("createDbNamespace: unexpected error: %v", err)

View file

@ -1683,7 +1683,7 @@ func testConvertWatchingOnly(tc *testContext) bool {
defer os.Remove(woMgrName)
// Open the new database copy and get the address manager namespace.
db, err := walletdb.Open("bdb", woMgrName, true)
db, err := walletdb.Open("bdb", woMgrName, true, defaultDBTimeout)
if err != nil {
tc.t.Errorf("openDbNamespace: unexpected error: %v", err)
return false