kvdb+etcd: enable channeldb testing with both bdb/etcd

This commit is contained in:
Andras Banki-Horvath
2020-03-09 19:27:50 +01:00
parent 3b7525659c
commit 248a00f211
7 changed files with 169 additions and 40 deletions

View File

@@ -98,13 +98,22 @@ func makeTestDB() (*DB, func(), error) {
}
// Next, create channeldb for the first time.
cdb, err := Open(tempDirName, OptionClock(testClock))
backend, backendCleanup, err := kvdb.GetTestBackend(tempDirName, "cdb")
if err != nil {
backendCleanup()
return nil, nil, err
}
cdb, err := CreateWithBackend(backend, OptionClock(testClock))
if err != nil {
backendCleanup()
os.RemoveAll(tempDirName)
return nil, nil, err
}
cleanUp := func() {
cdb.Close()
backendCleanup()
os.RemoveAll(tempDirName)
}