git.delta.rocks / unique-network / refs/commits / c656b7b0d499

difftreelog

add 942057 migration scripts

Max Andreev2023-06-09parent: #cd2a1cb.patch.diff
in: master

5 files changed

addedtests/src/migrations/942057-appPromotion/collect-data.shdiffbeforeafterboth

no changes

addedtests/src/migrations/942057-appPromotion/collectData.tsdiffbeforeafterboth
--- /dev/null
+++ b/tests/src/migrations/942057-appPromotion/collectData.ts
@@ -0,0 +1,3 @@
+import {spawnSync} from 'child_process';
+
+export const collectData = () => spawnSync('sh', ['./collect-data.sh']);
modifiedtests/src/migrations/942057-appPromotion/correctStateAfterMaintenance.tsdiffbeforeafterboth
--- a/tests/src/migrations/942057-appPromotion/correctStateAfterMaintenance.ts
+++ b/tests/src/migrations/942057-appPromotion/correctStateAfterMaintenance.ts
@@ -49,7 +49,6 @@
 
     const failedBlocks: bigint[] = [];
     let isSuccess = true;
-    await helper.wait.newBlocks(1);
 
     for(const b of filteredBlocks) {
       if(((await api.query.appPromotion.pendingUnstake(b)).toJSON() as any[]).length != 0) {
addedtests/src/migrations/942057-appPromotion/index.tsdiffbeforeafterboth
--- /dev/null
+++ b/tests/src/migrations/942057-appPromotion/index.ts
@@ -0,0 +1,12 @@
+import {Migration} from '../../util/frankensteinMigrate';
+import {collectData} from './collectData';
+import {migrateLockedToFreeze} from './lockedToFreeze';
+
+export const migration: Migration = {
+  async before() {
+    await collectData();
+  },
+  async after() {
+    await migrateLockedToFreeze();
+  },
+};
modifiedtests/src/migrations/942057-appPromotion/lockedToFreeze.tsdiffbeforeafterboth
--- a/tests/src/migrations/942057-appPromotion/lockedToFreeze.ts
+++ b/tests/src/migrations/942057-appPromotion/lockedToFreeze.ts
@@ -13,7 +13,7 @@
   return isInteger(value) ? BigInt(value) : parseFloat(value);
 }
 
-const main = async(options: { wsEndpoint: string; donorSeed: string } = {
+export const migrateLockedToFreeze = async(options: { wsEndpoint: string; donorSeed: string } = {
   wsEndpoint: WS_ENDPOINT,
   donorSeed: DONOR_SEED,
 }) => {
@@ -254,12 +254,3 @@
   }
   console.log('Chainql data correct');
 };
-
-main({
-  wsEndpoint: process.env.WS_RPC!,
-  donorSeed: process.env.SUPERUSER_SEED!,
-}).then(() => process.exit(0))
-  .catch((e) => {
-    console.error(e);
-    process.exit(1);
-  });
\ No newline at end of file