mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-08 14:57:38 +02:00
kvdb/test: add bolt test
This commit is contained in:
80
kvdb/bolt_test.go
Normal file
80
kvdb/bolt_test.go
Normal file
@@ -0,0 +1,80 @@
|
||||
package kvdb
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/btcsuite/btcwallet/walletdb"
|
||||
)
|
||||
|
||||
func TestBolt(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
test func(*testing.T, walletdb.DB)
|
||||
}{
|
||||
{
|
||||
name: "read cursor empty interval",
|
||||
test: testReadCursorEmptyInterval,
|
||||
},
|
||||
{
|
||||
name: "read cursor non empty interval",
|
||||
test: testReadCursorNonEmptyInterval,
|
||||
},
|
||||
{
|
||||
name: "read write cursor",
|
||||
test: testReadWriteCursor,
|
||||
},
|
||||
{
|
||||
name: "read write cursor with bucket and value",
|
||||
test: testReadWriteCursorWithBucketAndValue,
|
||||
},
|
||||
{
|
||||
name: "bucket creation",
|
||||
test: testBucketCreation,
|
||||
},
|
||||
{
|
||||
name: "bucket deletion",
|
||||
test: testBucketDeletion,
|
||||
},
|
||||
{
|
||||
name: "bucket for each",
|
||||
test: testBucketForEach,
|
||||
},
|
||||
{
|
||||
name: "bucket for each with error",
|
||||
test: testBucketForEachWithError,
|
||||
},
|
||||
{
|
||||
name: "bucket sequence",
|
||||
test: testBucketSequence,
|
||||
},
|
||||
{
|
||||
name: "key clash",
|
||||
test: testKeyClash,
|
||||
},
|
||||
{
|
||||
name: "bucket create delete",
|
||||
test: testBucketCreateDelete,
|
||||
},
|
||||
{
|
||||
name: "tx manual commit",
|
||||
test: testTxManualCommit,
|
||||
},
|
||||
{
|
||||
name: "tx rollback",
|
||||
test: testTxRollback,
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
test := test
|
||||
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
f := NewBoltFixture(t)
|
||||
defer f.Cleanup()
|
||||
|
||||
test.test(t, f.NewBackend())
|
||||
})
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user