From 2b51bda3e79eba393984f0c71871ff9e4f81d720 Mon Sep 17 00:00:00 2001 From: Michael Harding Date: Mon, 13 May 2019 11:27:12 -0400 Subject: [PATCH] Update system test scripts --- src/client/spark_test/System/LimitsTests.cs | 2 +- ...der_tests.sh => spreader_simple_sanity.sh} | 0 .../system_test_scripts/test_clip_limits.sh | 21 ++++++++++- .../system_test_scripts/test_join_algo.sh | 35 ++++++++++++------- .../test_position_limits.sh | 21 ++++++++++- 5 files changed, 64 insertions(+), 15 deletions(-) rename src/client/spark_test/system_test_scripts/{spreader_tests.sh => spreader_simple_sanity.sh} (100%) diff --git a/src/client/spark_test/System/LimitsTests.cs b/src/client/spark_test/System/LimitsTests.cs index 0eb96bf24..0a3357561 100644 --- a/src/client/spark_test/System/LimitsTests.cs +++ b/src/client/spark_test/System/LimitsTests.cs @@ -104,7 +104,7 @@ namespace bts.tests var all_securities = await all_futures(test_symbol); List security_list = all_securities.ToList(); - Assert.IsTrue(all_securities.Count() >= 2); + Assert.IsTrue(all_securities.Count() >= 2, "At least two securities are needed"); SecurityImmutable first_sec = security_list[0]; SecurityImmutable second_sec = security_list[1]; diff --git a/src/client/spark_test/system_test_scripts/spreader_tests.sh b/src/client/spark_test/system_test_scripts/spreader_simple_sanity.sh similarity index 100% rename from src/client/spark_test/system_test_scripts/spreader_tests.sh rename to src/client/spark_test/system_test_scripts/spreader_simple_sanity.sh diff --git a/src/client/spark_test/system_test_scripts/test_clip_limits.sh b/src/client/spark_test/system_test_scripts/test_clip_limits.sh index e90607b04..8928e476d 100644 --- a/src/client/spark_test/system_test_scripts/test_clip_limits.sh +++ b/src/client/spark_test/system_test_scripts/test_clip_limits.sh @@ -2,6 +2,24 @@ rm -r ~/sparkdata/data/databases/ > /dev/null + +mv ~/sparkdata/conf/spark.conf ~/sparkdata/conf/spark.conf.bak +cat << EOF > ~/sparkdata/conf/spark.conf + ExchangeSim { + value { + merge_with_md:true + } + } + Logging { + value { + console { default_level: "Error" } + syslog { default_level: "Error" } + file { default_level: "Error" } + } +} +EOF + + nohup ./sparkd run & pid=$! echo "sparkd pid: " $pid @@ -11,4 +29,5 @@ sleep 120 dotnet sparkcmd.dll test test_clip_limits -kill $pid \ No newline at end of file +kill $pid +mv ~/sparkdata/conf/spark.conf.bak ~/sparkdata/conf/spark.conf \ No newline at end of file diff --git a/src/client/spark_test/system_test_scripts/test_join_algo.sh b/src/client/spark_test/system_test_scripts/test_join_algo.sh index a9dd79390..775ee0b05 100644 --- a/src/client/spark_test/system_test_scripts/test_join_algo.sh +++ b/src/client/spark_test/system_test_scripts/test_join_algo.sh @@ -55,7 +55,7 @@ say_verbose() { is_merge_with_md_on() { eval $invocation - + if [ $(./sparkd configcheck ExchangeSim | grep merge_with_md: | cut -d " " -f 2) == "false" ]; then return 0 else @@ -65,14 +65,14 @@ is_merge_with_md_on() { set_merge_with_md_off() { eval $invocation - + if [ -f $config_file_path ]; then say_verbose "config file exists ... removing" rm $config_file_path fi - + echo "$merge_with_md_key" >> $config_file_path && test_config_file_created=true - + return 0 } @@ -81,29 +81,37 @@ set_merge_with_md_off() { # class_name - $2 get_tests_in_class() { eval $invocation - + local return_var=$1 local class_name=$2 - local arr=($(dotnet sparkcmd.dll test --system --list | perl -ne '/^( *)/; $i = length $1; $j && $i >= $j and print, next; $j = 0; /'"$class_name"'/ and $j = $i + 1, print' | tail -n +2)) + local arr=($(dotnet sparkcmd.dll test --type System --list | perl -ne '/^( *)/; $i = length $1; $j && $i >= $j and print, next; $j = 0; /'"$class_name"'/ and $j = $i + 1, print' | tail -n +2)) eval $return_var='("${arr[@]}")' - + return 0 } +# Start sparkd +nohup ./sparkd run & +pid=$! +echo "sparkd pid: " $pid +echo "sleeping for 120 seconds..." +sleep 120 + + # args # class_name - $1 run_bts_test() { eval $invocation - + class_name=$1 - + local test_names_tuple=() get_tests_in_class test_names_tuple $class_name - for test_name in ${test_names_tuple[@]}; do + for test_name in ${test_names_tuple[@]}; do say_verbose "running test with name: $test_name ..."; dotnet sparkcmd.dll test $test_name done - + return 0 } @@ -127,7 +135,7 @@ if is_merge_with_md_on; then say_err "Please investigate manually" exit 1 fi -else +else say_verbose "merge with md is already off" fi @@ -137,4 +145,7 @@ if [ "$test_config_file_created" = true ]; then rm $config_file_path fi +# Kill sparkd +kill $pid + say "Test has finished." diff --git a/src/client/spark_test/system_test_scripts/test_position_limits.sh b/src/client/spark_test/system_test_scripts/test_position_limits.sh index 06efd0c0c..7a688b7fe 100644 --- a/src/client/spark_test/system_test_scripts/test_position_limits.sh +++ b/src/client/spark_test/system_test_scripts/test_position_limits.sh @@ -2,6 +2,24 @@ rm -r ~/sparkdata/data/databases/ > /dev/null + +mv ~/sparkdata/conf/spark.conf ~/sparkdata/conf/spark.conf.bak +cat << EOF > ~/sparkdata/conf/spark.conf + ExchangeSim { + value { + merge_with_md:true + } + } + Logging { + value { + console { default_level: "Error" } + syslog { default_level: "Error" } + file { default_level: "Error" } + } +} +EOF + + nohup ./sparkd run & pid=$! echo "sparkd pid: " $pid @@ -10,4 +28,5 @@ echo "sleeping for 120 seconds..." sleep 120 dotnet sparkcmd.dll test test_position_limits -kill $pid \ No newline at end of file +kill $pid +mv ~/sparkdata/conf/spark.conf.bak ~/sparkdata/conf/spark.conf \ No newline at end of file