quick setup/tear-down

This commit is contained in:
rigel rozanski 2017-06-21 05:46:37 -04:00 committed by Ethan Frey
parent a78a24bbe9
commit dcb4a40bd2
3 changed files with 39 additions and 46 deletions

View File

@ -8,31 +8,11 @@ RICH=${ACCOUNTS[0]}
POOR=${ACCOUNTS[4]}
oneTimeSetUp() {
# These are passed in as args
BASE_DIR=$HOME/.basecoin_test_basictx
CHAIN_ID=my-test-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
printf "...Testing may begin!\n\n\n"
quickSetup .basecoin_test_basictx basictx-chain
}
oneTimeTearDown() {
printf "\n\nstopping $SERVER_EXE test server..."
kill -9 $PID_SERVER >/dev/null 2>&1
sleep 1
quickTearDown
}
test00GetAccount() {

View File

@ -7,6 +7,41 @@
# ACCOUNTS=(foo bar) # List of accounts for initialization
# RICH=${ACCOUNTS[0]} # Account to assign genesis balance
# XXX Ex Usage: quickSetup $WORK_NAME $CHAIN_ID
# Desc: Start the program, use with shunit2 OneTimeSetUp()
quickSetup() {
# These are passed in as args
BASE_DIR=$HOME/$1
CHAIN_ID=$2
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
if [ $? != 0 ]; then return 1; fi
initClient $CHAIN_ID
if [ $? != 0 ]; then return 1; fi
printf "...Testing may begin!\n\n\n"
}
# XXX Ex Usage: quickTearDown
# Desc: close the test server, use with shunit2 OneTimeTearDown()
quickTearDown() {
printf "\n\nstopping $SERVER_EXE test server..."
kill -9 $PID_SERVER >/dev/null 2>&1
sleep 1
}
############################################################
prepareClient() {
echo "Preparing client keys..."
${CLIENT_EXE} reset_all

View File

@ -8,35 +8,13 @@ RICH=${ACCOUNTS[0]}
POOR=${ACCOUNTS[4]}
oneTimeSetUp() {
# These are passed in as args
BASE_DIR=$HOME/.basecoin_test_counter
CHAIN_ID="counter-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 1234
if [ $? != 0 ]; then return 1; fi
initClient $CHAIN_ID 12347
if [ $? != 0 ]; then return 1; fi
printf "...Testing may begin!\n\n\n"
quickSetup .basecoin_test_counter counter-chain
}
oneTimeTearDown() {
printf "\n\nstopping $SERVER_EXE test server..."
kill -9 $PID_SERVER >/dev/null 2>&1
sleep 1
quickTearDown
}
test00GetAccount() {
SENDER=$(getAddr $RICH)
RECV=$(getAddr $POOR)