Skip to content

Commit

Permalink
Add integration test step in circle CI config
Browse files Browse the repository at this point in the history
  • Loading branch information
Marccio Silva committed Jul 30, 2021
1 parent 45c06c4 commit 6c170b7
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 6 deletions.
15 changes: 12 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ jobs:
# documented at https://circleci.com/docs/2.0/circleci-images/
# - image: circleci/mongo:3.4.4
- image: trufflesuite/ganache-cli
command: ganache-cli -i 5777 -l 6700000
command: ganache-cli -i 5777 -l 6700000 -k istanbul
- image: trufflesuite/ganache-cli
command: ganache-cli -i 5776 -p 8546 -k istanbul
steps:
- checkout
# Download and cache dependencies
Expand All @@ -19,6 +21,7 @@ jobs:
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run: cd bridge && npm ci
- run: cd federator && npm ci
- save_cache:
paths:
- bridge/node_modules
Expand All @@ -29,12 +32,18 @@ jobs:
cd bridge
npm run lint
- run:
name: contracts migrate
name: deploy contracts in development and mirror
command: |
cd bridge
npm run migrate
npm run deployLocalIntegrationTest
- run:
name: contracts integration test
command: |
cd federator
npm run integrationTest
- run:
name: contracts test
command: |
cd bridge
npm test
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,11 @@ See the ['federator'](./federator/README.md) for more information about federati

An integration test is prepared for contracts and federators. To properly run integration test, you need check network config in the `truffle-config.js` and `package.json` in `bridge` folder with your test chains' configuration before run `npm run deployIntegrationTest`.

For testing purposes only, an empty `test.local.federator.key` file is available in `federator/config`, which fulfills the role that a `federator.key` file would have in production.
Also, a `test.local.config.js` configuration is provided in `federator/config` for the same purpose, acting as the `config.js` file would in a productive environment.

1. Check `mnemonic.key` in `bridge`
1. Check `infura.key` in `bridge`
1. Check `federator.key` in `federator/config`
1. Check `config.js` in `federator/config`
1. Check your `networkName` in `bridge/migrations/4_deploy_erc1820.js` when your test network does not have **ERC1820:Pseudo-introspection Registry Contract** deployed.

Then
Expand Down
12 changes: 12 additions & 0 deletions federator/config/test.local.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const fs = require('fs');
module.exports = {
mainchain: require('./development.json'), //the json containing the smart contract addresses in rsk
sidechain: require('./mirrorDevelopment.json'), //the json containing the smart contract addresses in eth
runEvery: 2, // In minutes,
confirmations: 0, // Number of blocks before processing it, if working with ganache set as 0
privateKey: fs.readFileSync(`${__dirname}/test.local.federator.key`, 'utf8'),
storagePath: './db',
etherscanApiKey: '',
runHeartbeatEvery: 1, // In hours
endpointsPort: 5000, // Server port
}
Empty file.
3 changes: 2 additions & 1 deletion federator/integrationTest/integrationTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ const Web3 = require('web3');
const log4js = require('log4js');

//configurations
const config = require('../config/config.js');
// the following file should only be used for integration tests
const config = require('../config/test.local.config.js');
const logConfig = require('../config/log-config.json');
const abiBridge = require('../../abis/Bridge.json');
const abiMainToken = require('../../abis/ERC677.json');
Expand Down

0 comments on commit 6c170b7

Please sign in to comment.