github.com/aergoio/aergo@v1.3.1/consensus/impl/raftv2/test/rm_member.sh (about) 1 #!/usr/bin/env bash 2 source test_common.sh 3 4 if [ "$1" = "" ] ; then 5 echo "use:rm_member.sh aergo1~aergo3" 6 exit 100 7 fi 8 9 10 rmnode=$1 11 12 13 # get leader 14 myleader= 15 getleader myleader 16 echo "myleader=$myleader" 17 18 19 getLeaderPort leaderport 20 prevCnt=$(getClusterTotal $leaderport) 21 22 23 raftID="" 24 getRaftID $leaderport $rmnode raftID 25 26 # get leader port 27 28 echo "leader=$myleader, port=$leaderport, raftId=$raftID" 29 30 #echo "aergocli -p $leaderport cluster remove --nodeid $raftID" 31 #aergocli -p $leaderport cluster remove --nodeid $raftID 32 33 walletFile="$TEST_RAFT_INSTANCE/genesis_wallet.txt" 34 ADMIN= 35 getAdminUnlocked $leaderport $walletFile ADMIN 36 37 rmJson="$(makeRemoveMemberJson $raftID)" 38 39 echo "aergocli -p "$leaderport" contract call --governance "$ADMIN" aergo.enterprise changeCluster "$rmJson 40 aergocli -p $leaderport contract call --governance $ADMIN aergo.enterprise changeCluster "$rmJson" 41 echo "remove Done" 42 43 # check if total count is decremented 44 reqCnt=$((prevCnt-1)) 45 echo "reqClusterTotal=$reqCnt" 46 if [ "$myleader" = "$rmnode" ];then 47 leaderport=10001 48 fi 49 waitClusterTotal $reqCnt 100 50 if [ $? -ne 1 ]; then 51 echo "remove failed" 52 exit 100 53 fi