diff --git a/tests/cli/common.sh b/tests/cli/common.sh index 12ca5d5a6..4ceacd222 100644 --- a/tests/cli/common.sh +++ b/tests/cli/common.sh @@ -77,7 +77,7 @@ initServer() { return $? } -# usage: startServer SERVE_DIR SERVER_LOG +# XXX Ex Usage: startServer $SERVE_DIR $SERVER_LOG startServer() { ${SERVER_EXE} start --home=$1 >>$2 2>&1 & sleep 5 @@ -90,13 +90,6 @@ startServer() { fi } -# XXX Ex Usage: stopServer $PID_SERVER -stopServer() { - echo "stopping $SERVER_EXE test server..." - kill -9 $1 >/dev/null 2>&1 - sleep 1 -} - # XXX Ex Usage1: initClient $CHAINID # XXX Ex Usage2: initClient $CHAINID $PORTPREFIX # Desc: Initialize the client program diff --git a/tests/cli/restart.sh b/tests/cli/restart.sh index 09187594e..90ce98e94 100755 --- a/tests/cli/restart.sh +++ b/tests/cli/restart.sh @@ -3,36 +3,16 @@ # these are two globals to control all scripts (can use eg. counter instead) SERVER_EXE=basecoin CLIENT_EXE=basecli +ACCOUNTS=(jae ethan bucky rigel igor) +RICH=${ACCOUNTS[0]} +POOR=${ACCOUNTS[4]} oneTimeSetUp() { - # these are passed in as args - BASE_DIR=$HOME/.basecoin_test_restart - CHAIN_ID=restart-chain - - rm -rf $BASE_DIR 2>/dev/null - mkdir -p $BASE_DIR - - # set up client - make sure you use the proper prefix if you set - # a custom CLIENT_EXE - export BC_HOME=${BASE_DIR}/client - prepareClient - - # start basecoin server (with counter) - initServer $BASE_DIR $CHAIN_ID 3456 - if [ $? != 0 ]; then return 1; fi - - initClient $CHAIN_ID 34567 - - echo "...Testing may begin!" - echo - echo - echo + quickSetup .basecoin_test_restart restart-chain } oneTimeTearDown() { - echo - echo - stopServer $PID_SERVER + quickTearDown } test00PreRestart() { @@ -53,7 +33,6 @@ test00PreRestart() { } - test01OnRestart() { SENDER=$(getAddr $RICH) RECV=$(getAddr $POOR) @@ -78,11 +57,12 @@ test01OnRestart() { if [ $? != 0 ]; then echo "can't make second tx!"; return 1; fi # now we do a restart... - stopServer $PID_SERVER + quickTearDown startServer $BASE_DIR/server $BASE_DIR/${SERVER_EXE}.log if [ $? != 0 ]; then echo "can't restart server!"; return 1; fi # make sure queries still work properly, with all 3 tx now executed + echo "Checking state after restart..." checkAccount $SENDER "3" "9007199254710000" checkAccount $RECV "0" "30992"