mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-24 04:34:39 +02:00
graph/db: let the rapid migration test also tests idempotency
This commit is contained in:
@@ -1372,6 +1372,8 @@ func TestMigrateGraphToSQLRapid(t *testing.T) {
|
||||
// SQL store, generates random nodes and channels, populates the KV store,
|
||||
// runs the migration, and asserts that the SQL store contains the expected
|
||||
// state.
|
||||
//
|
||||
// The migration is run twice in order to test idempotency and retry-safety.
|
||||
func testMigrateGraphToSQLRapidOnce(t *testing.T, rt *rapid.T,
|
||||
dbFixture *sqldb.TestPgFixture, maxNumNodes, maxNumChannels int) {
|
||||
|
||||
@@ -1522,6 +1524,15 @@ func testMigrateGraphToSQLRapidOnce(t *testing.T, rt *rapid.T,
|
||||
nodes: nodesSlice,
|
||||
chans: chanSetForState,
|
||||
})
|
||||
|
||||
// The migration is expected to be idempotent and retry-safe. So running
|
||||
// it again should yield the same result.
|
||||
err = MigrateGraphToSQL(ctx, sql.cfg, kvDB.db, sql.db)
|
||||
require.NoError(t, err)
|
||||
assertResultState(t, sql, dbState{
|
||||
nodes: nodesSlice,
|
||||
chans: chanSetForState,
|
||||
})
|
||||
}
|
||||
|
||||
// genRandomChannel is a rapid generator for creating random channel edge infos.
|
||||
|
Reference in New Issue
Block a user