paymentsdb: move db interface dependant tests to different file
This commit starts reusing test cases which are not dependant on the kv db backend. So they can be later used with the native db implementation as well.
This commit is contained in:
3 files changed
+998
-972
No files matched your search
@@ -8,7 +8,24 @@ import (
|
||||
)
|
||||
|
||||
// NewTestDB is a helper function that creates an BBolt database for testing.
|
||||
func NewTestDB(t *testing.T, opts ...OptionModifier) *KVPaymentsDB {
|
||||
func NewTestDB(t *testing.T, opts ...OptionModifier) DB {
|
||||
backend, backendCleanup, err := kvdb.GetTestBackend(
|
||||
t.TempDir(), "paymentsDB",
|
||||
)
|
||||
require.NoError(t, err)
|
||||
|
||||
t.Cleanup(backendCleanup)
|
||||
|
||||
paymentDB, err := NewKVPaymentsDB(backend, opts...)
|
||||
require.NoError(t, err)
|
||||
|
||||
return paymentDB
|
||||
}
|
||||
|
||||
// NewKVTestDB is a helper function that creates an BBolt database for testing
|
||||
// and there is no need to convert the interface to the KVPaymentsDB because for
|
||||
// some unit tests we still need access to the kvdb interface.
|
||||
func NewKVTestDB(t *testing.T, opts ...OptionModifier) *KVPaymentsDB {
|
||||
backend, backendCleanup, err := kvdb.GetTestBackend(
|
||||
t.TempDir(), "kvPaymentDB",
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user