multi: replace defer cleanup with t.Cleanup

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
This commit is contained in:
Eng Zer Jun
2022-08-27 15:04:55 +08:00
parent 5c5997935d
commit c70e39cd21
29 changed files with 393 additions and 606 deletions

View File

@@ -398,11 +398,10 @@ func TestQueryPayments(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
db, cleanup, err := MakeTestDB()
db, err := MakeTestDB(t)
if err != nil {
t.Fatalf("unable to init db: %v", err)
}
defer cleanup()
// Make a preliminary query to make sure it's ok to
// query when we have no payments.
@@ -514,11 +513,9 @@ func TestQueryPayments(t *testing.T) {
// case where a specific duplicate is not found and the duplicates bucket is not
// present when we expect it to be.
func TestFetchPaymentWithSequenceNumber(t *testing.T) {
db, cleanup, err := MakeTestDB()
db, err := MakeTestDB(t)
require.NoError(t, err)
defer cleanup()
pControl := NewPaymentControl(db)
// Generate a test payment which does not have duplicates.