wtxmgr: update tests to use db timeout param

This commit is contained in:
yyforyongyu 2020-08-12 03:52:10 +08:00
parent f6ea9d4d7b
commit 368301866e
No known key found for this signature in database
GPG key ID: 9BCD95C4FF296868

View file

@ -45,6 +45,10 @@ var (
Block: Block{Hash: *TstSignedTxBlockHash, Height: TstSpendingTxBlockHeight},
Time: time.Unix(1389114091, 0),
}
// defaultDBTimeout specifies the timeout value when opening the wallet
// database.
defaultDBTimeout = 10 * time.Second
)
func testDB() (walletdb.DB, func(), error) {
@ -52,7 +56,9 @@ func testDB() (walletdb.DB, func(), error) {
if err != nil {
return nil, func() {}, err
}
db, err := walletdb.Create("bdb", filepath.Join(tmpDir, "db"), true)
db, err := walletdb.Create(
"bdb", filepath.Join(tmpDir, "db"), true, defaultDBTimeout,
)
return db, func() { os.RemoveAll(tmpDir) }, err
}
@ -64,7 +70,9 @@ func testStore() (*Store, walletdb.DB, func(), error) {
return nil, nil, func() {}, err
}
db, err := walletdb.Create("bdb", filepath.Join(tmpDir, "db"), true)
db, err := walletdb.Create(
"bdb", filepath.Join(tmpDir, "db"), true, defaultDBTimeout,
)
if err != nil {
os.RemoveAll(tmpDir)
return nil, nil, nil, err