github.com/aergoio/aergo@v1.3.1/consensus/impl/raftv2/test/test_leader_change.sh (about) 1 #!/usr/bin/env bash 2 echo "============================== leader change test(try="$1") ============================" 3 4 BP_NAME="" 5 6 #rm BP*.toml 7 #./aergoconf-gen.sh 10001 tmpl.toml 5 8 source set_test_env.sh 9 source test_common.sh 10 11 pushd $TEST_RAFT_INSTANCE 12 13 #chainSleep=1000 14 15 make_node.sh 16 17 kill_svr.sh 18 #DEBUG_CHAIN_BP_SLEEP=$chainSleep run_svr.sh 19 run_svr.sh 20 sleep 3 21 22 try=$1 23 if [ "$try" = "" ];then 24 try=10 25 fi 26 27 28 for ((idx=0; idx<=$try; idx++)); do 29 echo "try $idx" 30 changeLeader 31 32 # checkProgress 33 isChainHang 10001 4 34 ret=$? 35 echo "isHang=$ret" 36 37 if [ "$ret" = "1" ];then 38 echo "============== failed: chain hanged ==========" 39 exit 100 40 fi 41 42 checkLeaderValid 43 done 44 45 checkReorg 46 47 echo "============== succeed ==========" 48 49 popd