Browse Source

better handling of non-updating indices

ignazio 3 years ago
parent
commit
f1d0b1a5d4
1 changed files with 11 additions and 7 deletions
  1. 11 7
      tests/network-tests/src/misc/postMigrationAssertionsFlow.ts

+ 11 - 7
tests/network-tests/src/misc/postMigrationAssertionsFlow.ts

@@ -19,15 +19,19 @@ export default async function postMigrationAssertions({ api }: FlowProps): Promi
         let video_migration_new = await api.query.content.videoMigration();
 
         // assert invariant in order to prevent infinite loop
-        assert(channel_migration_new.current_id.toNumber() > channel_migration.current_id.toNumber());
-        assert(video_migration_new.current_id.toNumber() > video_migration.current_id.toNumber());
+        if (channel_migration_new.current_id.toNumber() > channel_migration.current_id.toNumber() &&
+            video_migration_new.current_id.toNumber() > video_migration.current_id.toNumber()) {
 
-        // update migration variables
-        channel_migration = channel_migration_new;
-        video_migration = video_migration_new;
+            // update migration variables
+            channel_migration = channel_migration_new;
+            video_migration = video_migration_new;
+
+            // wait 6 seconds
+            await Utils.wait(6000)
+        } else {
+            throw "Migration indices not updating";
+        }
 
-        // wait 6 seconds
-        await Utils.wait(6000)
     }
 
     debug('Check all new  working groups have been correctly initialized')