paymentsdb: use querypayments method to make test db agnostic

This commit is contained in:
ziggie
2025-08-13 14:56:49 +02:00
parent 46500f94e0
commit 39b7417797

View File

@@ -2,11 +2,13 @@ package paymentsdb
import (
"bytes"
"context"
"crypto/rand"
"crypto/sha256"
"errors"
"fmt"
"io"
"math"
"reflect"
"testing"
"time"
@@ -1372,9 +1374,21 @@ func assertPayments(t *testing.T, paymentDB *KVPaymentsDB,
t.Helper()
dbPayments, err := paymentDB.FetchPayments()
ctx := context.Background()
// We use the query method to fetch payments from the database which
// allows us to use this method db agnostic. We fetch all payments in
// one go.
queryResp, err := paymentDB.QueryPayments(ctx, Query{
IndexOffset: 0,
MaxPayments: math.MaxUint64,
Reversed: false,
IncludeIncomplete: true,
})
require.NoError(t, err, "could not fetch payments from db")
dbPayments := queryResp.Payments
// Make sure that the number of fetched payments is the same
// as expected.
require.Len(