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

This commit is contained in:
Andras Banki-Horvath committed 2020-05-22 11:26:25 +02:00
1 parent 3b7525659c
commit 248a00f211
7 files changed
+169 -40

No files matched your search

+10 -1
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)
}