From e004e5f298aa4c178f7e7f18614ea963ab4be0f9 Mon Sep 17 00:00:00 2001 From: Raneet Debnath Date: Thu, 17 Nov 2022 11:11:42 +0530 Subject: [PATCH] init: pos-535 smoke test --- .github/workflows/ci.yml | 3 +- integration-tests/smoke_test.sh | 54 +++++++++++++++++++-------------- 2 files changed, 34 insertions(+), 23 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 002752d6aa..8dfd9953fb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,6 +5,7 @@ on: - "master" - "qa" - "develop" + - "raneet10/pos-535" # RMV pull_request: branches: - "**" @@ -154,7 +155,7 @@ jobs: 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 + timeout 10m bash bor/integration-tests/smoke_test.sh - name: Upload logs if: always() diff --git a/integration-tests/smoke_test.sh b/integration-tests/smoke_test.sh index 4181f9f20c..d3e422eefe 100644 --- a/integration-tests/smoke_test.sh +++ b/integration-tests/smoke_test.sh @@ -3,33 +3,43 @@ set -e balanceInit=$(docker exec bor0 bash -c "bor attach /root/.bor/data/bor.ipc -exec 'Math.round(web3.fromWei(eth.getBalance(eth.accounts[0])))'") -delay=600 +#delay=600 +#echo "Wait ${delay} seconds for state-sync..." +#sleep $delay +count=0 +while true +do + + balance=$(docker exec bor0 bash -c "bor attach /root/.bor/data/bor.ipc -exec 'Math.round(web3.fromWei(eth.getBalance(eth.accounts[0])))'") -echo "Wait ${delay} seconds for state-sync..." -sleep $delay + 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 -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 <= $balanceInit )); then + echo "Balance in bor network has not increased. Waiting for state sync..." + #exit 1 + else + echo "State Sync occured!" + $count=$count+1 + fi -if ! [[ "$balance" =~ ^[0-9]+$ ]]; then - echo "Something is wrong! Can't find the balance of first account in bor network." - exit 1 -fi + checkpointID=$(curl -sL http://localhost:1317/checkpoints/latest | jq .result.id) -echo "Found matic balance on account[0]: " $balance + if [ $checkpointID == "null" ]; then + echo "Checkpoint didn't arrive yet! Waiting..." + #exit 1 + else + echo "Found checkpoint ID:" $checkpointID + $count=$count+1 + fi -if (( $balance <= $balanceInit )); 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 + if [ $count -eq 2 ]; then + break + fi +done echo "All tests have passed!"