mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 15:16:43 +00:00
Integration tests
This commit is contained in:
parent
9ec673870a
commit
9592534a69
3 changed files with 149 additions and 1 deletions
11
.github/matic-cli-config.yml
vendored
Normal file
11
.github/matic-cli-config.yml
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
defaultStake: 10000
|
||||
defaultFee: 2000
|
||||
borChainId: "15001"
|
||||
heimdallChainId: heimdall-15001
|
||||
contractsBranch: jc/v0.3.1-backport
|
||||
numOfValidators: 3
|
||||
numOfNonValidators: 0
|
||||
ethURL: http://ganache:9545
|
||||
devnetType: docker
|
||||
borDockerBuildContext: "../../bor"
|
||||
heimdallDockerBuildContext: "https://github.com/maticnetwork/heimdall.git#v0.3.0-dev"
|
||||
106
.github/workflows/ci.yml
vendored
106
.github/workflows/ci.yml
vendored
|
|
@ -3,6 +3,8 @@ on:
|
|||
push:
|
||||
branches:
|
||||
- "master"
|
||||
- "qa"
|
||||
- "develop"
|
||||
pull_request:
|
||||
branches:
|
||||
- "**"
|
||||
|
|
@ -77,4 +79,106 @@ jobs:
|
|||
- name: Upload coverage to Codecov
|
||||
uses: codecov/codecov-action@v1
|
||||
with:
|
||||
file: ./cover.out
|
||||
file: ./cover.out
|
||||
|
||||
integration-tests:
|
||||
if: (github.event.action != 'closed' || github.event.pull_request.merged == true)
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ ubuntu-20.04 ] # list of os: https://github.com/actions/virtual-environments
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
path: bor
|
||||
- name: Checkout submodules
|
||||
run: |
|
||||
cd bor
|
||||
git submodule update --init --recursive --force
|
||||
git fetch --no-tags --prune --depth=1 origin +refs/heads/master:refs/remotes/origin/master
|
||||
|
||||
- uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: 1.18.x
|
||||
|
||||
- name: Checkout matic-cli
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: maticnetwork/matic-cli
|
||||
ref: v0.3.0-dev
|
||||
path: matic-cli
|
||||
|
||||
- name: Install dependencies on Linux
|
||||
if: runner.os == 'Linux'
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install build-essential
|
||||
curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
|
||||
sudo snap install solc
|
||||
sudo apt install python2 jq curl
|
||||
sudo ln -sf /usr/bin/python2 /usr/bin/python
|
||||
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: '10.17.0'
|
||||
cache: 'npm'
|
||||
cache-dependency-path: |
|
||||
matic-cli/package-lock.json
|
||||
matic-cli/devnet/code/contracts/package-lock.json
|
||||
matic-cli/devnet/code/genesis-contracts/package-lock.json
|
||||
matic-cli/devnet/code/genesis-contracts/matic-contracts/package-lock.json
|
||||
|
||||
- name: Bootstrap devnet
|
||||
run: |
|
||||
cd matic-cli
|
||||
npm install --prefer-offline --no-audit --progress=false
|
||||
mkdir devnet
|
||||
cd devnet
|
||||
../bin/matic-cli setup devnet -c ../../bor/.github/matic-cli-config.yml
|
||||
|
||||
- name: Launch devnet
|
||||
run: |
|
||||
cd matic-cli/devnet
|
||||
bash docker-ganache-start.sh
|
||||
bash docker-heimdall-start-all.sh
|
||||
bash docker-bor-setup.sh
|
||||
bash docker-bor-start-all.sh
|
||||
sleep 120 && bash ganache-deployment-bor.sh
|
||||
sleep 120 && bash ganache-deployment-sync.sh
|
||||
sleep 120
|
||||
docker exec bor0 bash -c "bor attach /root/.bor/data/bor.ipc -exec 'admin.peers'"
|
||||
docker exec bor0 bash -c "bor attach /root/.bor/data/bor.ipc -exec 'eth.blockNumber'"
|
||||
|
||||
- name: Run smoke tests
|
||||
run: |
|
||||
echo "Deposit 100 matic for each account to bor network"
|
||||
cd matic-cli/devnet/code/contracts
|
||||
npm run truffle exec scripts/deposit.js -- --network development $(jq -r .root.tokens.MaticToken contractAddresses.json) 100000000000000000000
|
||||
cd -
|
||||
bash bor/integration-tests/smoke_test.sh
|
||||
|
||||
- name: Upload logs
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: logs_${{ github.run_id }}
|
||||
path: |
|
||||
matic-cli/devnet/logs
|
||||
|
||||
- name: Package code and chain data
|
||||
if: always()
|
||||
run: |
|
||||
cd matic-cli/devnet
|
||||
docker compose down
|
||||
cd -
|
||||
mkdir -p ${{ github.run_id }}/matic-cli
|
||||
sudo mv bor ${{ github.run_id }}
|
||||
sudo mv matic-cli/devnet ${{ github.run_id }}/matic-cli
|
||||
sudo tar czf code.tar.gz ${{ github.run_id }}
|
||||
|
||||
- name: Upload code and chain data
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: code_${{ github.run_id }}
|
||||
path: code.tar.gz
|
||||
|
|
|
|||
33
integration-tests/smoke_test.sh
Normal file
33
integration-tests/smoke_test.sh
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
delay=600
|
||||
|
||||
echo "Wait ${delay} seconds for state-sync..."
|
||||
sleep $delay
|
||||
|
||||
|
||||
balance=$(docker exec bor0 bash -c "bor attach /root/.bor/data/bor.ipc -exec 'Math.round(web3.fromWei(eth.getBalance(eth.accounts[0])))'")
|
||||
|
||||
if ! [[ "$balance" =~ ^[0-9]+$ ]]; then
|
||||
echo "Something is wrong! Can't find the balance of first account in bor network."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Found matic balance on account[0]: " $balance
|
||||
|
||||
if (( $balance <= 1001 )); then
|
||||
echo "Balance in bor network has not increased. This indicates that something is wrong with state sync."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
checkpointID=$(curl -sL http://localhost:1317/checkpoints/latest | jq .result.id)
|
||||
|
||||
if [ $checkpointID == "null" ]; then
|
||||
echo "Something is wrong! Could not find any checkpoint."
|
||||
exit 1
|
||||
else
|
||||
echo "Found checkpoint ID:" $checkpointID
|
||||
fi
|
||||
|
||||
echo "All tests have passed!"
|
||||
Loading…
Reference in a new issue