From 39b7417797be6258ef6132c8b482a962c54ba2f9 Mon Sep 17 00:00:00 2001 From: ziggie Date: Wed, 13 Aug 2025 14:56:49 +0200 Subject: [PATCH] paymentsdb: use querypayments method to make test db agnostic --- payments/db/kv_store_test.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/payments/db/kv_store_test.go b/payments/db/kv_store_test.go index 49e80df13..04cd7264c 100644 --- a/payments/db/kv_store_test.go +++ b/payments/db/kv_store_test.go @@ -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(