Browse Source

refactored to use node-tap

Gleb Urvanov 4 years ago
parent
commit
644ea805ed
23 changed files with 222 additions and 218 deletions
  1. 4 1
      .gitignore
  2. 5 10
      tests/network-tests/package.json
  3. 14 13
      tests/network-tests/src/tests/constantinople/electingCouncilTest.ts
  4. 16 15
      tests/network-tests/src/tests/constantinople/membershipCreationTest.ts
  5. 14 14
      tests/network-tests/src/tests/constantinople/proposals/electionParametersProposalTest.ts
  6. 14 14
      tests/network-tests/src/tests/constantinople/proposals/evictStoraveProviderTest.ts
  7. 14 14
      tests/network-tests/src/tests/constantinople/proposals/setLeadProposalTest.ts
  8. 14 14
      tests/network-tests/src/tests/constantinople/proposals/spendingProposalTest.ts
  9. 14 14
      tests/network-tests/src/tests/constantinople/proposals/storageRoleParametersProposalTest.ts
  10. 14 14
      tests/network-tests/src/tests/constantinople/proposals/textProposalTest.ts
  11. 15 16
      tests/network-tests/src/tests/constantinople/proposals/updateRuntimeTest.ts
  12. 14 14
      tests/network-tests/src/tests/constantinople/proposals/validatorCountProposalTest.ts
  13. 14 14
      tests/network-tests/src/tests/constantinople/proposals/workingGroupMintCapacityProposalTest.ts
  14. 1 1
      tests/network-tests/src/tests/constantinople/utils/apiWrapper.ts
  15. 1 1
      tests/network-tests/src/tests/constantinople/utils/sender.ts
  16. 2 2
      tests/network-tests/src/tests/constantinople/utils/utils.ts
  17. 14 13
      tests/network-tests/src/tests/rome/electingCouncilTest.ts
  18. 16 15
      tests/network-tests/src/tests/rome/membershipCreationTest.ts
  19. 18 15
      tests/network-tests/src/tests/rome/romeRuntimeUpgradeTest.ts
  20. 1 1
      tests/network-tests/src/tests/rome/utils/apiWrapper.ts
  21. 1 1
      tests/network-tests/src/tests/rome/utils/sender.ts
  22. 2 2
      tests/network-tests/src/tests/rome/utils/utils.ts
  23. 0 0
      tests/network-tests/src/tests/tap-parallel-not-ok

+ 4 - 1
.gitignore

@@ -27,4 +27,7 @@ yarn*
 *.wasm
 
 # Chain specificaiton
-chainspec.json
+chainspec.json
+
+# Istanbul report output
+**.nyc_output/

+ 5 - 10
tests/network-tests/package.json

@@ -4,21 +4,16 @@
   "license": "GPL-3.0-only",
   "scripts": {
     "build": "tsc --build tsconfig.json",
-<<<<<<< HEAD
-    "test": "mocha -r ts-node/register src/tests/constantinople/proposals/* --reporter tap",
-    "test-mocha": "mocha -r ts-node/register src/tests/constantinople/proposals/spendingProposalTest.ts",
-=======
-    "test": "mocha -r ts-node/register src/tests/constantinople/*",
->>>>>>> development
-    "test-migration": "mocha -r ts-node/register src/tests/rome/* && mocha -r ts-node/register src/tests/constantinople/*",
+    "test": "tap --files ts-node/register src/tests/constantinople/proposals/*",
+    "test-migration": "tap src/tests/rome/* && tap src/tests/constantinople/*",
     "lint": "tslint --project tsconfig.json",
     "prettier": "prettier --write ./src"
   },
   "dependencies": {
     "@joystream/types": "",
-    "@rome/types@npm:@joystream/types": "^0.7.0",
     "@polkadot/api": "^0.96.1",
     "@polkadot/keyring": "^1.7.0-beta.5",
+    "@rome/types@npm:@joystream/types": "^0.7.0",
     "@types/bn.js": "^4.11.5",
     "bn.js": "^4.11.8",
     "dotenv": "^8.2.0",
@@ -28,11 +23,11 @@
   "devDependencies": {
     "@polkadot/ts": "^0.3.14",
     "@types/chai": "^4.2.11",
-    "@types/mocha": "^7.0.2",
+    "@types/tap": "^14.10.0",
     "@types/uuid": "^7.0.2",
     "chai": "^4.2.0",
-    "mocha": "^7.1.1",
     "prettier": "2.0.2",
+    "tap": "^14.10.7",
     "ts-node": "^8.8.1",
     "tslint": "^6.1.0",
     "typescript": "^3.8.3"

+ 14 - 13
tests/network-tests/src/tests/constantinople/electingCouncilTest.ts

@@ -3,11 +3,12 @@ import { KeyringPair } from '@polkadot/keyring/types';
 import { ApiWrapper } from './utils/apiWrapper';
 import { WsProvider, Keyring } from '@polkadot/api';
 import { initConfig } from './utils/config';
-import BN = require('bn.js');
+import BN from 'bn.js';
 import { registerJoystreamTypes, Seat } from '@joystream/types';
 import { assert } from 'chai';
 import { v4 as uuid } from 'uuid';
 import { Utils } from './utils/utils';
+import tap from 'tap';
 
 export function councilTest(m1KeyPairs: KeyringPair[], m2KeyPairs: KeyringPair[]) {
   initConfig();
@@ -21,14 +22,15 @@ export function councilTest(m1KeyPairs: KeyringPair[], m2KeyPairs: KeyringPair[]
   let sudo: KeyringPair;
   let apiWrapper: ApiWrapper;
 
-  before(async function () {
-    this.timeout(defaultTimeout);
+  tap.setTimeout(defaultTimeout);
+
+  tap.test('Electing council test setup', { bail: true }, async () => {
     registerJoystreamTypes();
     const provider = new WsProvider(nodeUrl);
     apiWrapper = await ApiWrapper.create(provider);
   });
 
-  it('\n\tElecting a council test', async () => {
+  tap.test('Electing a council test', { bail: true }, async () => {
     // Setup goes here because M keypairs are generated after before() function
     sudo = keyring.addFromUri(sudoUri);
     let now = await apiWrapper.getBestBlock();
@@ -111,17 +113,16 @@ export function councilTest(m1KeyPairs: KeyringPair[], m2KeyPairs: KeyringPair[]
         `Member ${seat.member} has unexpected stake ${Utils.getTotalStake(seat)}`
       )
     );
-  }).timeout(defaultTimeout);
+  });
 
-  after(() => {
+  tap.teardown(() => {
     apiWrapper.close();
   });
 }
 
-describe('Council integration tests', () => {
-  const m1KeyPairs: KeyringPair[] = new Array();
-  const m2KeyPairs: KeyringPair[] = new Array();
-  membershipTest(m1KeyPairs);
-  membershipTest(m2KeyPairs);
-  councilTest(m1KeyPairs, m2KeyPairs);
-});
+const m1KeyPairs: KeyringPair[] = new Array();
+const m2KeyPairs: KeyringPair[] = new Array();
+
+membershipTest(m1KeyPairs);
+membershipTest(m2KeyPairs);
+councilTest(m1KeyPairs, m2KeyPairs);

+ 16 - 15
tests/network-tests/src/tests/constantinople/membershipCreationTest.ts

@@ -3,10 +3,11 @@ import { registerJoystreamTypes } from '@joystream/types';
 import { Keyring } from '@polkadot/keyring';
 import { assert } from 'chai';
 import { KeyringPair } from '@polkadot/keyring/types';
-import BN = require('bn.js');
+import BN from 'bn.js';
 import { ApiWrapper } from './utils/apiWrapper';
 import { initConfig } from './utils/config';
 import { v4 as uuid } from 'uuid';
+import tap from 'tap';
 
 export function membershipTest(nKeyPairs: KeyringPair[]) {
   initConfig();
@@ -15,15 +16,16 @@ export function membershipTest(nKeyPairs: KeyringPair[]) {
   const paidTerms: number = +process.env.MEMBERSHIP_PAID_TERMS!;
   const nodeUrl: string = process.env.NODE_URL!;
   const sudoUri: string = process.env.SUDO_ACCOUNT_URI!;
-  const defaultTimeout: number = 30000;
+  const defaultTimeout: number = 75000;
   let apiWrapper: ApiWrapper;
   let sudo: KeyringPair;
   let aKeyPair: KeyringPair;
   let membershipFee: BN;
   let membershipTransactionFee: BN;
 
-  before(async function () {
-    this.timeout(defaultTimeout);
+  tap.setTimeout(defaultTimeout);
+
+  tap.test('Membership creation test setup', { bail: true }, async () => {
     registerJoystreamTypes();
     const provider = new WsProvider(nodeUrl);
     apiWrapper = await ApiWrapper.create(provider);
@@ -42,7 +44,7 @@ export function membershipTest(nKeyPairs: KeyringPair[]) {
     await apiWrapper.transferBalance(sudo, aKeyPair.address, membershipTransactionFee);
   });
 
-  it('\n\tBuy membeship is accepted with sufficient funds', async () => {
+  tap.test('Buy membeship is accepted with sufficient funds', { bail: true }, async () => {
     await Promise.all(
       nKeyPairs.map(async (keyPair, index) => {
         await apiWrapper.buyMembership(keyPair, paidTerms, `new_member_${index}${keyPair.address.substring(0, 8)}`);
@@ -53,9 +55,9 @@ export function membershipTest(nKeyPairs: KeyringPair[]) {
         .getMemberIds(keyPair.address)
         .then(membership => assert(membership.length > 0, `Account ${keyPair.address} is not a member`))
     );
-  }).timeout(defaultTimeout);
+  });
 
-  it('\n\tAccount A can not buy the membership with insufficient funds', async () => {
+  tap.test('Account A can not buy the membership with insufficient funds', { bail: true }, async () => {
     await apiWrapper
       .getBalance(aKeyPair.address)
       .then(balance =>
@@ -68,9 +70,9 @@ export function membershipTest(nKeyPairs: KeyringPair[]) {
     apiWrapper
       .getMemberIds(aKeyPair.address)
       .then(membership => assert(membership.length === 0, 'Account A is a member'));
-  }).timeout(defaultTimeout);
+  });
 
-  it('\n\tAccount A was able to buy the membership with sufficient funds', async () => {
+  tap.test('Account A was able to buy the membership with sufficient funds', { bail: true }, async () => {
     await apiWrapper.transferBalance(sudo, aKeyPair.address, membershipFee.add(membershipTransactionFee));
     apiWrapper
       .getBalance(aKeyPair.address)
@@ -81,14 +83,13 @@ export function membershipTest(nKeyPairs: KeyringPair[]) {
     apiWrapper
       .getMemberIds(aKeyPair.address)
       .then(membership => assert(membership.length > 0, 'Account A is a not member'));
-  }).timeout(defaultTimeout);
+  });
 
-  after(() => {
+  tap.teardown(() => {
     apiWrapper.close();
   });
 }
 
-describe.skip('Membership integration tests', () => {
-  const nKeyPairs: KeyringPair[] = new Array();
-  membershipTest(nKeyPairs);
-});
+const nKeyPairs: KeyringPair[] = new Array();
+
+membershipTest(nKeyPairs);

+ 14 - 14
tests/network-tests/src/tests/constantinople/proposals/electionParametersProposalTest.ts

@@ -6,8 +6,9 @@ import { councilTest } from '../electingCouncilTest';
 import { registerJoystreamTypes } from '@joystream/types';
 import { ApiWrapper } from '../utils/apiWrapper';
 import { v4 as uuid } from 'uuid';
-import BN = require('bn.js');
+import BN from 'bn.js';
 import { assert } from 'chai';
+import tap from 'tap';
 
 export function electionParametersProposalTest(m1KeyPairs: KeyringPair[], m2KeyPairs: KeyringPair[]) {
   initConfig();
@@ -19,14 +20,15 @@ export function electionParametersProposalTest(m1KeyPairs: KeyringPair[], m2KeyP
   let apiWrapper: ApiWrapper;
   let sudo: KeyringPair;
 
-  before(async function () {
-    this.timeout(defaultTimeout);
+  tap.setTimeout(defaultTimeout);
+
+  tap.test('Election parameters proposal test setup', { bail: true }, async () => {
     registerJoystreamTypes();
     const provider = new WsProvider(nodeUrl);
     apiWrapper = await ApiWrapper.create(provider);
   });
 
-  it('\n\tElection parameters proposal test', async () => {
+  tap.test('Election parameters proposal test', { bail: true }, async () => {
     // Setup
     sudo = keyring.addFromUri(sudoUri);
     const proposalTitle: string = 'Testing proposal ' + uuid().substring(0, 8);
@@ -123,19 +125,17 @@ export function electionParametersProposalTest(m1KeyPairs: KeyringPair[], m2KeyP
       minVotingStake.addn(1).eq(newMinVotingStake),
       `Min voting stake has unexpected value ${newMinVotingStake}, expected ${minVotingStake.addn(1)}`
     );
-  }).timeout(defaultTimeout);
+  });
 
-  after(() => {
+  tap.teardown(() => {
     apiWrapper.close();
   });
 }
 
-describe('Election parameters proposal network tests', () => {
-  const m1KeyPairs: KeyringPair[] = new Array();
-  const m2KeyPairs: KeyringPair[] = new Array();
+const m1KeyPairs: KeyringPair[] = new Array();
+const m2KeyPairs: KeyringPair[] = new Array();
 
-  membershipTest(m1KeyPairs);
-  membershipTest(m2KeyPairs);
-  councilTest(m1KeyPairs, m2KeyPairs);
-  electionParametersProposalTest(m1KeyPairs, m2KeyPairs);
-});
+membershipTest(m1KeyPairs);
+membershipTest(m2KeyPairs);
+councilTest(m1KeyPairs, m2KeyPairs);
+electionParametersProposalTest(m1KeyPairs, m2KeyPairs);

+ 14 - 14
tests/network-tests/src/tests/constantinople/proposals/evictStoraveProviderTest.ts

@@ -6,9 +6,10 @@ import { councilTest } from '../electingCouncilTest';
 import { registerJoystreamTypes } from '@joystream/types';
 import { ApiWrapper } from '../utils/apiWrapper';
 import { v4 as uuid } from 'uuid';
-import BN = require('bn.js');
+import BN from 'bn.js';
 import { assert } from 'chai';
 import { Utils } from '../utils/utils';
+import tap from 'tap';
 
 export function evictStorageProviderTest(m1KeyPairs: KeyringPair[], m2KeyPairs: KeyringPair[]) {
   initConfig();
@@ -20,14 +21,15 @@ export function evictStorageProviderTest(m1KeyPairs: KeyringPair[], m2KeyPairs:
   let apiWrapper: ApiWrapper;
   let sudo: KeyringPair;
 
-  before(async function () {
-    this.timeout(defaultTimeout);
+  tap.setTimeout(defaultTimeout);
+
+  tap.test('Evict storage provider proposal test setup', { bail: true }, async () => {
     registerJoystreamTypes();
     const provider = new WsProvider(nodeUrl);
     apiWrapper = await ApiWrapper.create(provider);
   });
 
-  it('\n\tEvict storage provider proposal test', async () => {
+  tap.test('Evict storage provider proposal test', { bail: true }, async () => {
     // Setup
     sudo = keyring.addFromUri(sudoUri);
     const proposalTitle: string = 'Testing proposal ' + uuid().substring(0, 8);
@@ -69,19 +71,17 @@ export function evictStorageProviderTest(m1KeyPairs: KeyringPair[], m2KeyPairs:
       !(await apiWrapper.isStorageProvider(sudo.address)),
       `Account ${sudo.address} is storage provider after eviction`
     );
-  }).timeout(defaultTimeout);
+  });
 
-  after(() => {
+  tap.teardown(() => {
     apiWrapper.close();
   });
 }
 
-describe('Evict storage provider proposal network tests', () => {
-  const m1KeyPairs: KeyringPair[] = new Array();
-  const m2KeyPairs: KeyringPair[] = new Array();
+const m1KeyPairs: KeyringPair[] = new Array();
+const m2KeyPairs: KeyringPair[] = new Array();
 
-  membershipTest(m1KeyPairs);
-  membershipTest(m2KeyPairs);
-  councilTest(m1KeyPairs, m2KeyPairs);
-  evictStorageProviderTest(m1KeyPairs, m2KeyPairs);
-});
+membershipTest(m1KeyPairs);
+membershipTest(m2KeyPairs);
+councilTest(m1KeyPairs, m2KeyPairs);
+evictStorageProviderTest(m1KeyPairs, m2KeyPairs);

+ 14 - 14
tests/network-tests/src/tests/constantinople/proposals/setLeadProposalTest.ts

@@ -6,8 +6,9 @@ import { councilTest } from '../electingCouncilTest';
 import { registerJoystreamTypes } from '@joystream/types';
 import { ApiWrapper } from '../utils/apiWrapper';
 import { v4 as uuid } from 'uuid';
-import BN = require('bn.js');
+import BN from 'bn.js';
 import { assert } from 'chai';
+import tap from 'tap';
 
 export function setLeadProposalTest(m1KeyPairs: KeyringPair[], m2KeyPairs: KeyringPair[]) {
   initConfig();
@@ -19,14 +20,15 @@ export function setLeadProposalTest(m1KeyPairs: KeyringPair[], m2KeyPairs: Keyri
   let apiWrapper: ApiWrapper;
   let sudo: KeyringPair;
 
-  before(async function () {
-    this.timeout(defaultTimeout);
+  tap.setTimeout(defaultTimeout);
+
+  tap.test('Set lead proposal test', { bail: true }, async () => {
     registerJoystreamTypes();
     const provider = new WsProvider(nodeUrl);
     apiWrapper = await ApiWrapper.create(provider);
   });
 
-  it('\n\tLead proposal test', async () => {
+  tap.test('Lead proposal test', { bail: true }, async () => {
     // Setup
     sudo = keyring.addFromUri(sudoUri);
     const proposalTitle: string = 'Testing proposal ' + uuid().substring(0, 8);
@@ -53,19 +55,17 @@ export function setLeadProposalTest(m1KeyPairs: KeyringPair[], m2KeyPairs: Keyri
       newLead === m1KeyPairs[1].address,
       `New lead has unexpected value ${newLead}, expected ${m1KeyPairs[1].address}`
     );
-  }).timeout(defaultTimeout);
+  });
 
-  after(() => {
+  tap.teardown(() => {
     apiWrapper.close();
   });
 }
 
-describe('Lead proposal network tests', () => {
-  const m1KeyPairs: KeyringPair[] = new Array();
-  const m2KeyPairs: KeyringPair[] = new Array();
+const m1KeyPairs: KeyringPair[] = new Array();
+const m2KeyPairs: KeyringPair[] = new Array();
 
-  membershipTest(m1KeyPairs);
-  membershipTest(m2KeyPairs);
-  councilTest(m1KeyPairs, m2KeyPairs);
-  setLeadProposalTest(m1KeyPairs, m2KeyPairs);
-});
+membershipTest(m1KeyPairs);
+membershipTest(m2KeyPairs);
+councilTest(m1KeyPairs, m2KeyPairs);
+setLeadProposalTest(m1KeyPairs, m2KeyPairs);

+ 14 - 14
tests/network-tests/src/tests/constantinople/proposals/spendingProposalTest.ts

@@ -6,8 +6,9 @@ import { councilTest } from '../electingCouncilTest';
 import { registerJoystreamTypes } from '@joystream/types';
 import { ApiWrapper } from '../utils/apiWrapper';
 import { v4 as uuid } from 'uuid';
-import BN = require('bn.js');
+import BN from 'bn.js';
 import { assert } from 'chai';
+import tap from 'tap';
 
 export function spendingProposalTest(m1KeyPairs: KeyringPair[], m2KeyPairs: KeyringPair[]) {
   initConfig();
@@ -21,14 +22,15 @@ export function spendingProposalTest(m1KeyPairs: KeyringPair[], m2KeyPairs: Keyr
   let apiWrapper: ApiWrapper;
   let sudo: KeyringPair;
 
-  before(async function () {
-    this.timeout(defaultTimeout);
+  tap.setTimeout(defaultTimeout);
+
+  tap.test('Spending proposal test setup', { bail: true }, async () => {
     registerJoystreamTypes();
     const provider = new WsProvider(nodeUrl);
     apiWrapper = await ApiWrapper.create(provider);
   });
 
-  it('\n\tSpending proposal test', async () => {
+  tap.test('Spending proposal test', { bail: true }, async () => {
     // Setup
     sudo = keyring.addFromUri(sudoUri);
     const description: string = 'spending proposal which is used for API network testing with some mock data';
@@ -71,19 +73,17 @@ export function spendingProposalTest(m1KeyPairs: KeyringPair[], m2KeyPairs: Keyr
         m1KeyPairs[0].address
       } has unexpected balance ${balanceAfterMinting}, expected ${balanceBeforeMinting.add(spendingBalance)}`
     );
-  }).timeout(defaultTimeout);
+  });
 
-  after(() => {
+  tap.teardown(() => {
     apiWrapper.close();
   });
 }
 
-describe('Spending proposal network tests', () => {
-  const m1KeyPairs: KeyringPair[] = new Array();
-  const m2KeyPairs: KeyringPair[] = new Array();
+const m1KeyPairs: KeyringPair[] = new Array();
+const m2KeyPairs: KeyringPair[] = new Array();
 
-  membershipTest(m1KeyPairs);
-  membershipTest(m2KeyPairs);
-  councilTest(m1KeyPairs, m2KeyPairs);
-  spendingProposalTest(m1KeyPairs, m2KeyPairs);
-});
+membershipTest(m1KeyPairs);
+membershipTest(m2KeyPairs);
+councilTest(m1KeyPairs, m2KeyPairs);
+spendingProposalTest(m1KeyPairs, m2KeyPairs);

+ 14 - 14
tests/network-tests/src/tests/constantinople/proposals/storageRoleParametersProposalTest.ts

@@ -6,9 +6,10 @@ import { councilTest } from '../electingCouncilTest';
 import { registerJoystreamTypes } from '@joystream/types';
 import { ApiWrapper } from '../utils/apiWrapper';
 import { v4 as uuid } from 'uuid';
-import BN = require('bn.js');
+import BN from 'bn.js';
 import { assert } from 'chai';
 import { RoleParameters } from '@joystream/types/lib/roles';
+import tap from 'tap';
 
 export function storageRoleParametersProposalTest(m1KeyPairs: KeyringPair[], m2KeyPairs: KeyringPair[]) {
   initConfig();
@@ -20,14 +21,15 @@ export function storageRoleParametersProposalTest(m1KeyPairs: KeyringPair[], m2K
   let apiWrapper: ApiWrapper;
   let sudo: KeyringPair;
 
-  before(async function () {
-    this.timeout(defaultTimeout);
+  tap.setTimeout(defaultTimeout);
+
+  tap.test('Storage role parameters proposal test setup', { bail: true }, async () => {
     registerJoystreamTypes();
     const provider = new WsProvider(nodeUrl);
     apiWrapper = await ApiWrapper.create(provider);
   });
 
-  it('\n\tStorage role parameters proposal test', async () => {
+  tap.test('Storage role parameters proposal test', { bail: true }, async () => {
     // Setup
     sudo = keyring.addFromUri(sudoUri);
     const proposalTitle: string = 'Testing proposal ' + uuid().substring(0, 8);
@@ -134,19 +136,17 @@ export function storageRoleParametersProposalTest(m1KeyPairs: KeyringPair[], m2K
         .toBn()
         .addn(1)}`
     );
-  }).timeout(defaultTimeout);
+  });
 
-  after(() => {
+  tap.teardown(() => {
     apiWrapper.close();
   });
 }
 
-describe('Storage role parameters proposal network tests', () => {
-  const m1KeyPairs: KeyringPair[] = new Array();
-  const m2KeyPairs: KeyringPair[] = new Array();
+const m1KeyPairs: KeyringPair[] = new Array();
+const m2KeyPairs: KeyringPair[] = new Array();
 
-  membershipTest(m1KeyPairs);
-  membershipTest(m2KeyPairs);
-  councilTest(m1KeyPairs, m2KeyPairs);
-  storageRoleParametersProposalTest(m1KeyPairs, m2KeyPairs);
-});
+membershipTest(m1KeyPairs);
+membershipTest(m2KeyPairs);
+councilTest(m1KeyPairs, m2KeyPairs);
+storageRoleParametersProposalTest(m1KeyPairs, m2KeyPairs);

+ 14 - 14
tests/network-tests/src/tests/constantinople/proposals/textProposalTest.ts

@@ -6,7 +6,8 @@ import { councilTest } from '../electingCouncilTest';
 import { registerJoystreamTypes } from '@joystream/types';
 import { ApiWrapper } from '../utils/apiWrapper';
 import { v4 as uuid } from 'uuid';
-import BN = require('bn.js');
+import BN from 'bn.js';
+import tap from 'tap';
 
 export function textProposalTest(m1KeyPairs: KeyringPair[], m2KeyPairs: KeyringPair[]) {
   initConfig();
@@ -18,14 +19,15 @@ export function textProposalTest(m1KeyPairs: KeyringPair[], m2KeyPairs: KeyringP
   let apiWrapper: ApiWrapper;
   let sudo: KeyringPair;
 
-  before(async function () {
-    this.timeout(defaultTimeout);
+  tap.setTimeout(defaultTimeout);
+
+  tap.test('Text proposal test setup', { bail: true }, async () => {
     registerJoystreamTypes();
     const provider = new WsProvider(nodeUrl);
     apiWrapper = await ApiWrapper.create(provider);
   });
 
-  it('\n\tText proposal test', async () => {
+  tap.test('Text proposal test', { bail: true }, async () => {
     // Setup
     sudo = keyring.addFromUri(sudoUri);
     const proposalTitle: string = 'Testing proposal ' + uuid().substring(0, 8);
@@ -53,19 +55,17 @@ export function textProposalTest(m1KeyPairs: KeyringPair[], m2KeyPairs: KeyringP
     const textProposalPromise = apiWrapper.expectProposalFinalized();
     await apiWrapper.batchApproveProposal(m2KeyPairs, proposalNumber);
     await textProposalPromise;
-  }).timeout(defaultTimeout);
+  });
 
-  after(() => {
+  tap.teardown(() => {
     apiWrapper.close();
   });
 }
 
-describe('Text proposal network tests', () => {
-  const m1KeyPairs: KeyringPair[] = new Array();
-  const m2KeyPairs: KeyringPair[] = new Array();
+const m1KeyPairs: KeyringPair[] = new Array();
+const m2KeyPairs: KeyringPair[] = new Array();
 
-  membershipTest(m1KeyPairs);
-  membershipTest(m2KeyPairs);
-  councilTest(m1KeyPairs, m2KeyPairs);
-  textProposalTest(m1KeyPairs, m2KeyPairs);
-});
+membershipTest(m1KeyPairs);
+membershipTest(m2KeyPairs);
+councilTest(m1KeyPairs, m2KeyPairs);
+textProposalTest(m1KeyPairs, m2KeyPairs);

+ 15 - 16
tests/network-tests/src/tests/constantinople/proposals/updateRuntimeTest.ts

@@ -7,7 +7,8 @@ import { councilTest } from '../electingCouncilTest';
 import { registerJoystreamTypes } from '@joystream/types';
 import { ApiWrapper } from '../utils/apiWrapper';
 import { v4 as uuid } from 'uuid';
-import BN = require('bn.js');
+import BN from 'bn.js';
+import tap from 'tap';
 
 export function updateRuntimeTest(m1KeyPairs: KeyringPair[], m2KeyPairs: KeyringPair[]) {
   initConfig();
@@ -19,14 +20,15 @@ export function updateRuntimeTest(m1KeyPairs: KeyringPair[], m2KeyPairs: Keyring
   let apiWrapper: ApiWrapper;
   let sudo: KeyringPair;
 
-  before(async function () {
-    this.timeout(defaultTimeout);
+  tap.setTimeout(defaultTimeout);
+
+  tap.test('Update runtime test setup', { bail: true }, async () => {
     registerJoystreamTypes();
     const provider = new WsProvider(nodeUrl);
     apiWrapper = await ApiWrapper.create(provider);
   });
 
-  it('\n\tUpgrading the runtime test', async () => {
+  tap.test('\n\tUpgrading the runtime test', { bail: true }, async () => {
     // Setup
     sudo = keyring.addFromUri(sudoUri);
     const runtime: Bytes = await apiWrapper.getRuntime();
@@ -59,21 +61,18 @@ export function updateRuntimeTest(m1KeyPairs: KeyringPair[], m2KeyPairs: Keyring
     const runtimePromise = apiWrapper.expectProposalFinalized();
     await apiWrapper.batchApproveProposal(m2KeyPairs, proposalNumber);
     await runtimePromise;
-  }).timeout(defaultTimeout);
-
-  membershipTest(new Array<KeyringPair>());
+  });
 
-  after(() => {
+  tap.teardown(() => {
     apiWrapper.close();
   });
 }
 
-describe('Runtime upgrade networt tests', () => {
-  const m1KeyPairs: KeyringPair[] = new Array();
-  const m2KeyPairs: KeyringPair[] = new Array();
+const m1KeyPairs: KeyringPair[] = new Array();
+const m2KeyPairs: KeyringPair[] = new Array();
 
-  membershipTest(m1KeyPairs);
-  membershipTest(m2KeyPairs);
-  councilTest(m1KeyPairs, m2KeyPairs);
-  updateRuntimeTest(m1KeyPairs, m2KeyPairs);
-});
+membershipTest(m1KeyPairs);
+membershipTest(m2KeyPairs);
+councilTest(m1KeyPairs, m2KeyPairs);
+updateRuntimeTest(m1KeyPairs, m2KeyPairs);
+membershipTest(new Array<KeyringPair>());

+ 14 - 14
tests/network-tests/src/tests/constantinople/proposals/validatorCountProposal.ts → tests/network-tests/src/tests/constantinople/proposals/validatorCountProposalTest.ts

@@ -6,8 +6,9 @@ import { councilTest } from '../electingCouncilTest';
 import { registerJoystreamTypes } from '@joystream/types';
 import { ApiWrapper } from '../utils/apiWrapper';
 import { v4 as uuid } from 'uuid';
-import BN = require('bn.js');
+import BN from 'bn.js';
 import { assert } from 'chai';
+import tap from 'tap';
 
 export function validatorCountProposal(m1KeyPairs: KeyringPair[], m2KeyPairs: KeyringPair[]) {
   initConfig();
@@ -20,14 +21,15 @@ export function validatorCountProposal(m1KeyPairs: KeyringPair[], m2KeyPairs: Ke
   let apiWrapper: ApiWrapper;
   let sudo: KeyringPair;
 
-  before(async function () {
-    this.timeout(defaultTimeout);
+  tap.setTimeout(defaultTimeout);
+
+  tap.test('Validator count proposal test setup', { bail: true }, async () => {
     registerJoystreamTypes();
     const provider = new WsProvider(nodeUrl);
     apiWrapper = await ApiWrapper.create(provider);
   });
 
-  it('\n\tValidator count proposal test', async () => {
+  tap.test('Validator count proposal test', { bail: true }, async () => {
     // Setup
     sudo = keyring.addFromUri(sudoUri);
     const proposalTitle: string = 'Testing proposal ' + uuid().substring(0, 8);
@@ -63,19 +65,17 @@ export function validatorCountProposal(m1KeyPairs: KeyringPair[], m2KeyPairs: Ke
         validatorCountIncrement
       )}`
     );
-  }).timeout(defaultTimeout);
+  });
 
-  after(() => {
+  tap.teardown(() => {
     apiWrapper.close();
   });
 }
 
-describe('Validator count proposal network tests', () => {
-  const m1KeyPairs: KeyringPair[] = new Array();
-  const m2KeyPairs: KeyringPair[] = new Array();
+const m1KeyPairs: KeyringPair[] = new Array();
+const m2KeyPairs: KeyringPair[] = new Array();
 
-  membershipTest(m1KeyPairs);
-  membershipTest(m2KeyPairs);
-  councilTest(m1KeyPairs, m2KeyPairs);
-  validatorCountProposal(m1KeyPairs, m2KeyPairs);
-});
+membershipTest(m1KeyPairs);
+membershipTest(m2KeyPairs);
+councilTest(m1KeyPairs, m2KeyPairs);
+validatorCountProposal(m1KeyPairs, m2KeyPairs);

+ 14 - 14
tests/network-tests/src/tests/constantinople/proposals/workingGroupMintCapacityProposalTest.ts

@@ -6,8 +6,9 @@ import { councilTest } from '../electingCouncilTest';
 import { registerJoystreamTypes } from '@joystream/types';
 import { ApiWrapper } from '../utils/apiWrapper';
 import { v4 as uuid } from 'uuid';
-import BN = require('bn.js');
+import BN from 'bn.js';
 import { assert } from 'chai';
+import tap from 'tap';
 
 export function workingGroupMintCapacityProposalTest(m1KeyPairs: KeyringPair[], m2KeyPairs: KeyringPair[]) {
   initConfig();
@@ -20,14 +21,15 @@ export function workingGroupMintCapacityProposalTest(m1KeyPairs: KeyringPair[],
   let apiWrapper: ApiWrapper;
   let sudo: KeyringPair;
 
-  before(async function () {
-    this.timeout(defaultTimeout);
+  tap.setTimeout(defaultTimeout);
+
+  tap.test('Working group mint capacity proposal test', { bail: true }, async () => {
     registerJoystreamTypes();
     const provider = new WsProvider(nodeUrl);
     apiWrapper = await ApiWrapper.create(provider);
   });
 
-  it('\n\tMint capacity proposal test', async () => {
+  tap.test('Mint capacity proposal test', { bail: true }, async () => {
     // Setup
     sudo = keyring.addFromUri(sudoUri);
     const description: string = 'spending proposal which is used for API network testing';
@@ -67,19 +69,17 @@ export function workingGroupMintCapacityProposalTest(m1KeyPairs: KeyringPair[],
         mintingCapacityIncrement
       )}`
     );
-  }).timeout(defaultTimeout);
+  });
 
-  after(() => {
+  tap.teardown(() => {
     apiWrapper.close();
   });
 }
 
-describe('Working group mint capacity proposal network tests', () => {
-  const m1KeyPairs: KeyringPair[] = new Array();
-  const m2KeyPairs: KeyringPair[] = new Array();
+const m1KeyPairs: KeyringPair[] = new Array();
+const m2KeyPairs: KeyringPair[] = new Array();
 
-  membershipTest(m1KeyPairs);
-  membershipTest(m2KeyPairs);
-  councilTest(m1KeyPairs, m2KeyPairs);
-  workingGroupMintCapacityProposalTest(m1KeyPairs, m2KeyPairs);
-});
+membershipTest(m1KeyPairs);
+membershipTest(m2KeyPairs);
+councilTest(m1KeyPairs, m2KeyPairs);
+workingGroupMintCapacityProposalTest(m1KeyPairs, m2KeyPairs);

+ 1 - 1
tests/network-tests/src/tests/constantinople/utils/apiWrapper.ts

@@ -8,7 +8,7 @@ import { Lead, LeadId } from '@joystream/types/lib/content-working-group';
 import { RoleParameters } from '@joystream/types/lib/roles';
 import { Seat } from '@joystream/types';
 import { Balance, EventRecord, AccountId, BlockNumber, BalanceOf } from '@polkadot/types/interfaces';
-import BN = require('bn.js');
+import BN from 'bn.js';
 import { SubmittableExtrinsic } from '@polkadot/api/types';
 import { Sender } from './sender';
 import { Utils } from './utils';

+ 1 - 1
tests/network-tests/src/tests/constantinople/utils/sender.ts

@@ -1,4 +1,4 @@
-import BN = require('bn.js');
+import BN from 'bn.js';
 import { ApiPromise } from '@polkadot/api';
 import { Index } from '@polkadot/types/interfaces';
 import { SubmittableExtrinsic } from '@polkadot/api/types';

+ 2 - 2
tests/network-tests/src/tests/constantinople/utils/utils.ts

@@ -2,8 +2,8 @@ import { IExtrinsic } from '@polkadot/types/types';
 import { Bytes } from '@polkadot/types';
 import { compactToU8a, stringToU8a } from '@polkadot/util';
 import { blake2AsHex } from '@polkadot/util-crypto';
-import BN = require('bn.js');
-import fs = require('fs');
+import BN from 'bn.js';
+import fs from 'fs';
 import { decodeAddress } from '@polkadot/keyring';
 import { Seat } from '@joystream/types';
 

+ 14 - 13
tests/network-tests/src/tests/rome/electingCouncilTest.ts

@@ -3,11 +3,12 @@ import { KeyringPair } from '@polkadot/keyring/types';
 import { ApiWrapper } from './utils/apiWrapper';
 import { WsProvider, Keyring } from '@polkadot/api';
 import { initConfig } from './utils/config';
-import BN = require('bn.js');
+import BN from 'bn.js';
 import { registerJoystreamTypes, Seat } from '@rome/types';
 import { assert } from 'chai';
 import { v4 as uuid } from 'uuid';
 import { Utils } from './utils/utils';
+import tap from 'tap';
 
 export function councilTest(m1KeyPairs: KeyringPair[], m2KeyPairs: KeyringPair[]) {
   initConfig();
@@ -21,14 +22,15 @@ export function councilTest(m1KeyPairs: KeyringPair[], m2KeyPairs: KeyringPair[]
   let sudo: KeyringPair;
   let apiWrapper: ApiWrapper;
 
-  before(async function () {
-    this.timeout(defaultTimeout);
+  tap.setTimeout(defaultTimeout);
+
+  tap.test('Electing council test setup', { bail: true }, async () => {
     registerJoystreamTypes();
     const provider = new WsProvider(nodeUrl);
     apiWrapper = await ApiWrapper.create(provider);
   });
 
-  it('Electing a council test', async () => {
+  tap.test('Electing a council test', { bail: true }, async () => {
     // Setup goes here because M keypairs are generated after before() function
     sudo = keyring.addFromUri(sudoUri);
     let now = await apiWrapper.getBestBlock();
@@ -111,17 +113,16 @@ export function councilTest(m1KeyPairs: KeyringPair[], m2KeyPairs: KeyringPair[]
         `Member ${seat.member} has unexpected stake ${Utils.getTotalStake(seat)}`
       )
     );
-  }).timeout(defaultTimeout);
+  });
 
-  after(() => {
+  tap.teardown(() => {
     apiWrapper.close();
   });
 }
 
-describe.skip('Council integration tests', () => {
-  const m1KeyPairs: KeyringPair[] = new Array();
-  const m2KeyPairs: KeyringPair[] = new Array();
-  membershipTest(m1KeyPairs);
-  membershipTest(m2KeyPairs);
-  councilTest(m1KeyPairs, m2KeyPairs);
-});
+const m1KeyPairs: KeyringPair[] = new Array();
+const m2KeyPairs: KeyringPair[] = new Array();
+
+membershipTest(m1KeyPairs);
+membershipTest(m2KeyPairs);
+councilTest(m1KeyPairs, m2KeyPairs);

+ 16 - 15
tests/network-tests/src/tests/rome/membershipCreationTest.ts

@@ -3,10 +3,11 @@ import { registerJoystreamTypes } from '@rome/types';
 import { Keyring } from '@polkadot/keyring';
 import { assert } from 'chai';
 import { KeyringPair } from '@polkadot/keyring/types';
-import BN = require('bn.js');
+import BN from 'bn.js';
 import { ApiWrapper } from './utils/apiWrapper';
 import { initConfig } from './utils/config';
 import { v4 as uuid } from 'uuid';
+import tap from 'tap';
 
 export function membershipTest(nKeyPairs: KeyringPair[]) {
   initConfig();
@@ -15,15 +16,16 @@ export function membershipTest(nKeyPairs: KeyringPair[]) {
   const paidTerms: number = +process.env.MEMBERSHIP_PAID_TERMS!;
   const nodeUrl: string = process.env.NODE_URL!;
   const sudoUri: string = process.env.SUDO_ACCOUNT_URI!;
-  const defaultTimeout: number = 30000;
+  const defaultTimeout: number = 75000;
   let apiWrapper: ApiWrapper;
   let sudo: KeyringPair;
   let aKeyPair: KeyringPair;
   let membershipFee: BN;
   let membershipTransactionFee: BN;
 
-  before(async function () {
-    this.timeout(defaultTimeout);
+  tap.setTimeout(defaultTimeout);
+
+  tap.test('Membership creation test setup', { bail: true }, async () => {
     registerJoystreamTypes();
     const provider = new WsProvider(nodeUrl);
     apiWrapper = await ApiWrapper.create(provider);
@@ -42,7 +44,7 @@ export function membershipTest(nKeyPairs: KeyringPair[]) {
     await apiWrapper.transferBalance(sudo, aKeyPair.address, membershipTransactionFee);
   });
 
-  it('Buy membeship is accepted with sufficient funds', async () => {
+  tap.test('Buy membeship is accepted with sufficient funds', { bail: true }, async () => {
     await Promise.all(
       nKeyPairs.map(async (keyPair, index) => {
         await apiWrapper.buyMembership(keyPair, paidTerms, `new_member_${index}${keyPair.address.substring(0, 8)}`);
@@ -53,9 +55,9 @@ export function membershipTest(nKeyPairs: KeyringPair[]) {
         .getMemberIds(keyPair.address)
         .then(membership => assert(membership.length > 0, `Account ${keyPair.address} is not a member`))
     );
-  }).timeout(defaultTimeout);
+  });
 
-  it('Account A can not buy the membership with insufficient funds', async () => {
+  tap.test('Account A can not buy the membership with insufficient funds', { bail: true }, async () => {
     await apiWrapper
       .getBalance(aKeyPair.address)
       .then(balance =>
@@ -68,9 +70,9 @@ export function membershipTest(nKeyPairs: KeyringPair[]) {
     apiWrapper
       .getMemberIds(aKeyPair.address)
       .then(membership => assert(membership.length === 0, 'Account A is a member'));
-  }).timeout(defaultTimeout);
+  });
 
-  it('Account A was able to buy the membership with sufficient funds', async () => {
+  tap.test('Account A was able to buy the membership with sufficient funds', { bail: true }, async () => {
     await apiWrapper.transferBalance(sudo, aKeyPair.address, membershipFee.add(membershipTransactionFee));
     apiWrapper
       .getBalance(aKeyPair.address)
@@ -81,14 +83,13 @@ export function membershipTest(nKeyPairs: KeyringPair[]) {
     apiWrapper
       .getMemberIds(aKeyPair.address)
       .then(membership => assert(membership.length > 0, 'Account A is a not member'));
-  }).timeout(defaultTimeout);
+  });
 
-  after(() => {
+  tap.teardown(() => {
     apiWrapper.close();
   });
 }
 
-describe.skip('Membership integration tests', () => {
-  const nKeyPairs: KeyringPair[] = new Array();
-  membershipTest(nKeyPairs);
-});
+const nKeyPairs: KeyringPair[] = new Array();
+
+membershipTest(nKeyPairs);

+ 18 - 15
tests/network-tests/src/tests/rome/romeRuntimeUpgradeTest.ts

@@ -5,10 +5,11 @@ import { membershipTest } from './membershipCreationTest';
 import { councilTest } from './electingCouncilTest';
 import { registerJoystreamTypes } from '@rome/types';
 import { ApiWrapper } from './utils/apiWrapper';
-import BN = require('bn.js');
+import BN from 'bn.js';
 import { Utils } from './utils/utils';
+import tap from 'tap';
 
-describe('Runtime upgrade integration tests', () => {
+export function romeRuntimeUpgradeTest(m1KeyPairs: KeyringPair[], m2KeyPairs: KeyringPair[]) {
   initConfig();
   const keyring = new Keyring({ type: 'sr25519' });
   const nodeUrl: string = process.env.NODE_URL!;
@@ -17,25 +18,19 @@ describe('Runtime upgrade integration tests', () => {
   const runtimePath: string = process.env.RUNTIME_WASM_PATH!;
   const defaultTimeout: number = 180000;
 
-  const m1KeyPairs: KeyringPair[] = new Array();
-  const m2KeyPairs: KeyringPair[] = new Array();
-
   let apiWrapper: ApiWrapper;
   let sudo: KeyringPair;
   let provider: WsProvider;
 
-  before(async function () {
-    this.timeout(defaultTimeout);
+  tap.setTimeout(defaultTimeout);
+
+  tap.test('Rome runtime upgrade test setup', { bail: true }, async () => {
     registerJoystreamTypes();
     provider = new WsProvider(nodeUrl);
     apiWrapper = await ApiWrapper.create(provider);
   });
 
-  membershipTest(m1KeyPairs);
-  membershipTest(m2KeyPairs);
-  councilTest(m1KeyPairs, m2KeyPairs);
-
-  it('Upgrading the runtime test', async () => {
+  tap.test('Upgrading the runtime test', { bail: true }, async () => {
     // Setup
     sudo = keyring.addFromUri(sudoUri);
     const runtime: string = Utils.readRuntimeFromFile(runtimePath);
@@ -67,9 +62,17 @@ describe('Runtime upgrade integration tests', () => {
     const runtimePromise = apiWrapper.expectRuntimeUpgraded();
     await apiWrapper.batchApproveProposal(m2KeyPairs, proposalNumber);
     await runtimePromise;
-  }).timeout(defaultTimeout);
+  });
 
-  after(() => {
+  tap.teardown(() => {
     apiWrapper.close();
   });
-});
+}
+
+const m1KeyPairs: KeyringPair[] = new Array();
+const m2KeyPairs: KeyringPair[] = new Array();
+
+membershipTest(m1KeyPairs);
+membershipTest(m2KeyPairs);
+councilTest(m1KeyPairs, m2KeyPairs);
+romeRuntimeUpgradeTest(m1KeyPairs, m2KeyPairs);

+ 1 - 1
tests/network-tests/src/tests/rome/utils/apiWrapper.ts

@@ -5,7 +5,7 @@ import { KeyringPair } from '@polkadot/keyring/types';
 import { UserInfo, PaidMembershipTerms, MemberId } from '@rome/types/lib/members';
 import { Seat, VoteKind } from '@rome/types';
 import { Balance, EventRecord } from '@polkadot/types/interfaces';
-import BN = require('bn.js');
+import BN from 'bn.js';
 import { SubmittableExtrinsic } from '@polkadot/api/types';
 import { Sender } from './sender';
 import { Utils } from './utils';

+ 1 - 1
tests/network-tests/src/tests/rome/utils/sender.ts

@@ -1,4 +1,4 @@
-import BN = require('bn.js');
+import BN from 'bn.js';
 import { ApiPromise } from '@polkadot/api';
 import { Index } from '@polkadot/types/interfaces';
 import { SubmittableExtrinsic } from '@polkadot/api/types';

+ 2 - 2
tests/network-tests/src/tests/rome/utils/utils.ts

@@ -1,8 +1,8 @@
 import { IExtrinsic } from '@polkadot/types/types';
 import { compactToU8a, stringToU8a, u8aToHex } from '@polkadot/util';
 import { blake2AsHex } from '@polkadot/util-crypto';
-import BN = require('bn.js');
-import fs = require('fs');
+import BN from 'bn.js';
+import fs from 'fs';
 import { decodeAddress } from '@polkadot/keyring';
 import { Seat } from '@rome/types';
 

+ 0 - 0
tests/network-tests/src/tests/tap-parallel-not-ok