payments/migration1: add migration test suite and helpers
Add test helpers plus sql_migration_test coverage for KV→SQL migration. Basic migration, sequence ordering, data integrity, and feature-specific cases (MPP/AMP, custom records, blinded routes, metadata, failure messages). Also cover duplicate payment migration to payment_duplicates, including missing attempt info to ensure terminal failure is recorded. This gives broad regression coverage for the migration path and its edge-cases.
This commit is contained in:
5 files changed
+2873
No files matched your search
@@ -0,0 +1,26 @@
|
||||
package migration1
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/lightningnetwork/lnd/lntypes"
|
||||
)
|
||||
|
||||
// TestHarness provides implementation-specific test utilities for the payments
|
||||
// database. Different database backends (KV, SQL) have different internal
|
||||
// structures and indexing mechanisms, so this interface allows tests to verify
|
||||
// implementation-specific behavior without coupling the test logic to a
|
||||
// particular backend.
|
||||
type TestHarness interface {
|
||||
// AssertPaymentIndex checks that a payment is correctly indexed.
|
||||
// For KV: verifies the payment index bucket entry exists and points
|
||||
// to the correct payment hash.
|
||||
// For SQL: no-op (SQL doesn't use a separate index bucket).
|
||||
AssertPaymentIndex(t *testing.T, expectedHash lntypes.Hash)
|
||||
|
||||
// AssertNoIndex checks that an index for a sequence number doesn't
|
||||
// exist.
|
||||
// For KV: verifies the index bucket entry is deleted.
|
||||
// For SQL: no-op.
|
||||
AssertNoIndex(t *testing.T, seqNr uint64)
|
||||
}
|
||||
Reference in new issue
Block a user