diff --git a/graph/db/sql_migration_test.go b/graph/db/sql_migration_test.go index 977e5b772..1c3170488 100644 --- a/graph/db/sql_migration_test.go +++ b/graph/db/sql_migration_test.go @@ -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.