ソースを参照

Rome to Constantinople migration test fix

Gleb Urvanov 4 年 前
コミット
c38eae6b18

+ 2 - 2
tests/network-tests/package.json

@@ -4,12 +4,12 @@
   "license": "GPL-3.0-only",
   "scripts": {
     "build": "tsc --build tsconfig.json",
-    "test": "mocha -r ts-node/register src/tests/**/*",
+    "test": "mocha -r ts-node/register src/tests/rome/* && mocha -r ts-node/register src/tests/proposals/*",
     "lint": "tslint --project tsconfig.json",
     "prettier": "prettier --write ./src"
   },
   "dependencies": {
-    "@joystream/types": "^0.7.0",
+    "@joystream/types": "../joystream-apps/packages/joy-types",
     "@rome/types@npm:@joystream/types": "^0.7.0",
     "@polkadot/api": "^0.96.1",
     "@polkadot/keyring": "^1.7.0-beta.5",

+ 4 - 1
tests/network-tests/src/tests/proposals/textProposalTest.ts

@@ -7,8 +7,9 @@ import { registerJoystreamTypes } from '@joystream/types';
 import { ApiWrapper } from '../../utils/apiWrapper';
 import { v4 as uuid } from 'uuid';
 import BN = require('bn.js');
+import { Utils } from '../../utils/utils';
 
-describe.skip('Text proposal network tests', () => {
+describe('Text proposal network tests', () => {
   initConfig();
   const keyring = new Keyring({ type: 'sr25519' });
   const nodeUrl: string = process.env.NODE_URL!;
@@ -26,6 +27,8 @@ describe.skip('Text proposal network tests', () => {
     registerJoystreamTypes();
     const provider = new WsProvider(nodeUrl);
     apiWrapper = await ApiWrapper.create(provider);
+
+    await Utils.wait(apiWrapper.getBlockDuration().muln(2.5).toNumber());
   });
 
   membershipTest(m1KeyPairs);

+ 1 - 1
tests/network-tests/src/tests/rome/electingCouncilTest.ts

@@ -2,7 +2,7 @@ import { membershipTest } from './membershipCreationTest';
 import { KeyringPair } from '@polkadot/keyring/types';
 import { ApiWrapper } from './utils/apiWrapper';
 import { WsProvider, Keyring } from '@polkadot/api';
-import { initConfig } from '../../utils/config';
+import { initConfig } from './utils/config';
 import BN = require('bn.js');
 import { registerJoystreamTypes, Seat } from '@rome/types';
 import { assert } from 'chai';

+ 1 - 1
tests/network-tests/src/tests/rome/membershipCreationTest.ts

@@ -5,7 +5,7 @@ import { assert } from 'chai';
 import { KeyringPair } from '@polkadot/keyring/types';
 import BN = require('bn.js');
 import { ApiWrapper } from './utils/apiWrapper';
-import { initConfig } from '../../utils/config';
+import { initConfig } from './utils/config';
 import { v4 as uuid } from 'uuid';
 
 export function membershipTest(nKeyPairs: KeyringPair[]) {

+ 5 - 11
tests/network-tests/src/tests/rome/romeRuntimeUpgradeTest.ts

@@ -1,9 +1,9 @@
-import { initConfig } from '../../utils/config';
+import { initConfig } from './utils/config';
 import { Keyring, WsProvider } from '@polkadot/api';
 import { Bytes } from '@polkadot/types';
 import { KeyringPair } from '@polkadot/keyring/types';
-import { membershipTest } from '../membershipCreationTest';
-import { councilTest } from '../electingCouncilTest';
+import { membershipTest } from './membershipCreationTest';
+import { councilTest } from './electingCouncilTest';
 import { registerJoystreamTypes } from '@rome/types';
 import { ApiWrapper } from './utils/apiWrapper';
 import BN = require('bn.js');
@@ -37,13 +37,9 @@ describe('Runtime upgrade integration tests', () => {
 
   it('Upgrading the runtime test', async () => {
     // Setup
-    console.log('7');
     sudo = keyring.addFromUri(sudoUri);
     // const runtime: Bytes = await apiWrapper.getRuntime();
     const runtime: string = Utils.readRuntimeFromFile('joystream_node_runtime.wasm');
-    console.log('runtime length ' + runtime.length);
-    console.log('runtime strart ' + runtime.slice(0, 10));
-    console.log('runtime end ' + runtime.slice(runtime.length - 10));
     const description: string = 'runtime upgrade proposal which is used for API integration testing';
     const runtimeProposalFee: BN = apiWrapper.estimateRomeProposeRuntimeUpgradeFee(
       proposalStake,
@@ -59,7 +55,6 @@ describe('Runtime upgrade integration tests', () => {
 
     // Proposal creation
     const proposalPromise = apiWrapper.expectProposalCreated();
-    console.log('proposal will be sent');
     await apiWrapper.proposeRuntimeRome(
       m1KeyPairs[0],
       proposalStake,
@@ -67,16 +62,15 @@ describe('Runtime upgrade integration tests', () => {
       'runtime to test proposal functionality',
       runtime
     );
-    console.log('proposal sent');
     const proposalNumber = await proposalPromise;
-    console.log('proposal created');
 
     // Approving runtime update proposal
     const runtimePromise = apiWrapper.expectRomeRuntimeUpgraded();
-    console.log('voting');
     await apiWrapper.batchApproveRomeProposal(m2KeyPairs, proposalNumber);
     // apiWrapper = await ApiWrapper.create(provider);
     await runtimePromise;
+
+    await Utils.wait(apiWrapper.getBlockDuration().muln(2.5).toNumber());
   }).timeout(defaultTimeout);
 
   //membershipTest(new Array<KeyringPair>());

+ 0 - 3
tests/network-tests/src/tests/rome/utils/apiWrapper.ts

@@ -387,7 +387,6 @@ export class ApiWrapper {
       await this.api.query.system.events<Vec<EventRecord>>(events => {
         events.forEach(record => {
           if (record.event.method.toString() === 'RuntimeUpdated') {
-            console.log('Runtime updated!!');
             resolve();
           }
         });
@@ -416,8 +415,6 @@ export class ApiWrapper {
 
   public async getProposal(id: BN) {
     const proposal = await this.api.query.proposalsEngine.proposals(id);
-    console.log('proposal to string ' + proposal.toString());
-    console.log('proposal to raw ' + proposal.toRawType());
     return;
   }
 

+ 5 - 0
tests/network-tests/src/tests/rome/utils/config.ts

@@ -0,0 +1,5 @@
+import { config } from 'dotenv';
+
+export function initConfig() {
+  config();
+}