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.
27 lines
942 B
Go
27 lines
942 B
Go
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)
|
|
}
|