Skip to content

Commit

Permalink
Reorganized the tests into groups with identical config.ini steemit#2098
Browse files Browse the repository at this point in the history
  • Loading branch information
Kiwonik committed Feb 28, 2018
1 parent f3fec2d commit faca8ae
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 72 deletions.
File renamed without changes.
File renamed without changes.
37 changes: 37 additions & 0 deletions tests/smoketest/account_history/test_group.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash

function echo(){ builtin echo $(basename $0 .sh): "$@"; }
pushd () { command pushd "$@" > /dev/null; }
popd () { command popd "$@" > /dev/null; }

if [ $# -ne 6 ]
then
echo Usage: jobs 1st_address 1st_port 2nd_address 2nd_port working_dir
echo Example: 100 127.0.0.1 8090 ec2-34-235-166-184.compute-1.amazonaws.com 8090 logs
exit -1
fi

EXIT_CODE=0
JOBS=$1
TEST_ADDRESS=$2
TEST_PORT=$3
REF_ADDRESS=$4
REF_PORT=$5
BLOCK_LIMIT=$6
WDIR=logs

function run_test {
echo Running test $1
pushd $1

echo Running ./test.sh $JOBS $TEST_ADDRESS $TEST_PORT $REF_ADDRESS $REF_PORT $2
./test.sh 1 $TEST_ADDRESS $TEST_PORT $REF_ADDRESS $REF_PORT $2
[ $? -ne 0 ] && echo test $1 FAILED && EXIT_CODE=-1

popd
}

run_test "account_history" ./logs
run_test "get_ops_in_block" $BLOCK_LIMIT

exit $EXIT_CODE
60 changes: 0 additions & 60 deletions tests/smoketest/get_ops_in_block/config.ini

This file was deleted.

32 changes: 20 additions & 12 deletions tests/smoketest/smoketest.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
#!/bin/bash

EXIT_CODE=0
JOBS=1
API_TEST_PATH=../../python_scripts/tests/api_tests
BLOCK_SUBPATH=blockchain/block_log
STEEMD_CONFIG=config.ini
TEST_ADDRESS=127.0.0.1
TEST_PORT=8090
TEST_NODE=$TEST_ADDRESS:$TEST_PORT
TEST_NODE_OPT=--webserver-http-endpoint=$TEST_NODE

function echo(){ builtin echo $(basename $0 .sh): "$@"; }
pushd () { command pushd "$@" > /dev/null; }
popd () { command popd "$@" > /dev/null; }

function print_help_and_quit {
echo "Usage: path_to_tested_steemd path_to_blockchain_directory number_of_blocks_to_replay reference_node_address"
Expand All @@ -17,30 +21,31 @@ function print_help_and_quit {
}

function run_test_group {
echo Copying ./$1/config.ini over $WORK_PATH/config.ini
cp ./$1/config.ini $WORK_PATH/config.ini
[ $? -ne 0 ] && echo FATAL: Failed to copy ./$1/config.ini over $WORK_PATH/config.ini file. && exit -1
echo Running test group $1
pushd $1

echo Copying ./$STEEMD_CONFIG over $WORK_PATH/$STEEMD_CONFIG
cp ./$STEEMD_CONFIG $WORK_PATH/$STEEMD_CONFIG
[ $? -ne 0 ] && echo FATAL: Failed to copy ./$STEEMD_CONFIG over $WORK_PATH/$STEEMD_CONFIG file. && exit -1

echo Running replay of $BLOCK_LIMIT blocks
$STEEMD_PATH --replay --stop-replay-at-block $BLOCK_LIMIT -d $WORK_PATH
[ $? -ne 0 ] && echo FATAL: steemd failed to replay $BLOCK_LIMIT blocks. && exit -1

echo Running steemd to listen
$STEEMD_PATH $TEST_NODE_OPT -d $WORK_PATH & STEEMD_PID=$!
echo Running $1 test group
echo $TEST_ADDRESS $TEST_PORT
#echo $TEST_ADDRESS $TEST_PORT
REF_ADDRESS=$(echo $REF_NODE | cut -d ":" -f3 | cut -c 3-)
REF_PORT=$(echo $REF_NODE | grep -o ':[0-9]\{1,\}' | cut -c 2-)
echo REF_ADDRESS=$REF_ADDRESS REF_PORT=$REF_PORT
#echo REF_ADDRESS=$REF_ADDRESS REF_PORT=$REF_PORT

pushd ./$1
echo Running ./test.sh 1 $TEST_ADDRESS $TEST_PORT $REF_ADDRESS $REF_PORT $2
./test.sh 1 $TEST_ADDRESS $TEST_PORT $REF_ADDRESS $REF_PORT $2
echo Running ./test_group.sh $JOBS $TEST_ADDRESS $TEST_PORT $REF_ADDRESS $REF_PORT $BLOCK_LIMIT
./test_group.sh $JOBS $TEST_ADDRESS $TEST_PORT $REF_ADDRESS $REF_PORT $BLOCK_LIMIT
[ $? -ne 0 ] && echo test group $1 FAILED && EXIT_CODE=-1
popd

kill -s SIGINT $STEEMD_PID
wait
popd
}

if [ $# -ne 4 ]
Expand Down Expand Up @@ -78,7 +83,10 @@ else
echo FATAL: steemd not running at $REF_NODE? && exit -1
fi'

run_test_group "account_history" ./logs
run_test_group "get_ops_in_block" $BLOCK_LIMIT
for dir in ./*/
do
dir=${dir%*/}
run_test_group ${dir##*/}
done

exit $EXIT_CODE

0 comments on commit faca8ae

Please sign in to comment.