Merge pull request #583 from maticnetwork/raneet10/pos-535

Speed up smoke test
This commit is contained in:
Raneet Debnath 2022-11-18 20:06:37 +05:30 committed by GitHub
commit a3e7769b5b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 33 additions and 29 deletions

View file

@ -154,7 +154,7 @@ jobs:
cd matic-cli/devnet/code/contracts cd matic-cli/devnet/code/contracts
npm run truffle exec scripts/deposit.js -- --network development $(jq -r .root.tokens.MaticToken contractAddresses.json) 100000000000000000000 npm run truffle exec scripts/deposit.js -- --network development $(jq -r .root.tokens.MaticToken contractAddresses.json) 100000000000000000000
cd - cd -
bash bor/integration-tests/smoke_test.sh timeout 20m bash bor/integration-tests/smoke_test.sh
- name: Upload logs - name: Upload logs
if: always() if: always()

View file

@ -3,11 +3,13 @@ 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])))'") 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 stateSyncFound="false"
checkpointFound="false"
echo "Wait ${delay} seconds for state-sync..." SECONDS=0
sleep $delay start_time=$SECONDS
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])))'") balance=$(docker exec bor0 bash -c "bor attach /root/.bor/data/bor.ipc -exec 'Math.round(web3.fromWei(eth.getBalance(eth.accounts[0])))'")
@ -16,25 +18,27 @@ if ! [[ "$balance" =~ ^[0-9]+$ ]]; then
exit 1 exit 1
fi fi
echo "Found matic balance on account[0]: " $balance if (( $balance > $balanceInit )); then
if [ $stateSyncFound != "true" ]; then
if (( $balance <= $balanceInit )); then stateSyncTime=$(( SECONDS - start_time ))
echo "Balance in bor network has not increased. This indicates that something is wrong with state sync." stateSyncFound="true"
exit 1 fi
fi fi
delayCheckpoint=300
echo "Wait ${delayCheckpoint} seconds for checkpoint..."
sleep $delayCheckpoint
checkpointID=$(curl -sL http://localhost:1317/checkpoints/latest | jq .result.id) checkpointID=$(curl -sL http://localhost:1317/checkpoints/latest | jq .result.id)
if [ $checkpointID == "null" ]; then if [ $checkpointID != "null" ]; then
echo "Something is wrong! Could not find any checkpoint." if [ $checkpointFound != "true" ]; then
exit 1 checkpointTime=$(( SECONDS - start_time ))
else checkpointFound="true"
echo "Found checkpoint ID:" $checkpointID fi
fi fi
echo "All tests have passed!" if [ $stateSyncFound == "true" ] && [ $checkpointFound == "true" ]; then
break
fi
done
echo "Both state sync and checkpoint went through. All tests have passed!"
echo "Time taken for state sync: $(printf '%02dm:%02ds\n' $(($stateSyncTime%3600/60)) $(($stateSyncTime%60)))"
echo "Time taken for checkpoint: $(printf '%02dm:%02ds\n' $(($checkpointTime%3600/60)) $(($checkpointTime%60)))"