clickhouse-test: skipping tests with "zookeeper" in name when no zookeeper seems to be available. [#METR-2807]

This commit is contained in:
Michael Kolupaev 2014-07-31 17:53:54 +04:00
parent 5c529d7b4f
commit ba11ae3be5
3 changed files with 20 additions and 3 deletions

View File

@ -13,22 +13,34 @@ if [ -t 1 ]; then # stdout - терминал.
COLOR_FAIL="\033[1;31m"
COLOR_UNKNOWN="\033[1;30m"
COLOR_OK="\033[1;32m"
COLOR_SKIPPED="\033[1;34m"
else
COLOR_RESET=""
COLOR_WHITE=""
COLOR_FAIL=""
COLOR_UNKNOWN=""
COLOR_OK=""
COLOR_SKIPPED=""
fi
MSG_FAIL="${COLOR_WHITE}[ ${COLOR_FAIL}FAIL${COLOR_WHITE} ]${COLOR_RESET}"
MSG_UNKNOWN="${COLOR_WHITE}[ ${COLOR_UNKNOWN}UNKNOWN${COLOR_WHITE} ]${COLOR_RESET}"
MSG_OK="${COLOR_WHITE}[ ${COLOR_OK}OK${COLOR_WHITE} ]${COLOR_RESET}"
MSG_GENERATED="${COLOR_WHITE}[ ${COLOR_UNKNOWN}GENERATED${COLOR_WHITE} ]${COLOR_RESET}"
MSG_SKIPPED="${COLOR_WHITE}[ ${COLOR_SKIPPED}SKIPPED${COLOR_WHITE} ]${COLOR_RESET}"
ERRORS=0
if [ "$1" == "--zookeeper" ]; then
ZOOKEEPER=1
elif grep -q '<zookeeper' /etc/clickhouse-server/config-preprocessed.xml; then
ZOOKEEPER=1
else
ZOOKEEPER=0
fi
if [ "$1" == "--generate" ]; then
GENERATE=1
shift
@ -60,13 +72,18 @@ do
continue
fi
printf "%-60s" "$test_name: "
if [ $ZOOKEEPER -eq 0 ] && (echo "$test_name" | grep -q 'zookeeper'); then
echo -e "$MSG_SKIPPED - no zookeeper"
continue
fi
result_file=$QUERIES_DIR/$dir/$test_name.result
error_file=$QUERIES_DIR/$dir/$test_name.error
reference_file=$QUERIES_DIR/$dir/$test_name.reference
diff_file=$QUERIES_DIR/$dir/$test_name.diff
printf "%-60s" "$test_name: "
if [[ "$extension" == "sql" ]]; then
$CLIENT_PROGRAM < $query_file > $result_file 2> $error_file
ret_code=$?
@ -97,7 +114,7 @@ do
# надо сгенерировать эталонный результат
if [[ $GENERATE -eq 1 && ( -z "$1" || "$@" =~ "$test_name") ]]; then
cp $result_file $reference_file
echo -e "$MSG_GENERATED - no reference file"
echo -e "$MSG_GENERATED - generated reference file"
else
echo -e "$MSG_UNKNOWN - no reference file (use --generate [test_name]... to create)"
fi