Merge pull request #48106 from Algunenano/enforce_test_numbers

This commit is contained in:
Vladimir C 2023-03-28 16:01:28 +02:00 committed by GitHub
commit 1dda438351
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 2 deletions

View File

@ -10,7 +10,7 @@ TESTS_PATH=$(dirname ${BASH_SOURCE[0]})
set -ue
# shellcheck disable=SC2010
LAST_TEST_NO=$(ls -1 ${TESTS_PATH} | grep -P -o '^\d+' | sort -nr | head -1)
LAST_TEST_NO=$(ls -1 ${TESTS_PATH} | grep -E -o '^[0-9]+' | sort -nr | head -1)
# remove leading zeros, increment and add padding zeros to 5 digits
NEW_TEST_NO=$(printf "%05d\n" $((10#$LAST_TEST_NO + 1)))

View File

@ -165,7 +165,7 @@ find $ROOT_PATH/tests/queries -iname '*fail*' |
grep . && echo 'Tests should not be named with "fail" in their names. It makes looking at the results less convenient when you search for "fail" substring in browser.'
# Queries to system.query_log/system.query_thread_log should have current_database = currentDatabase() condition
# NOTE: it is not that accuate, but at least something.
# NOTE: it is not that accurate, but at least something.
tests_with_query_log=( $(
find $ROOT_PATH/tests/queries -iname '*.sql' -or -iname '*.sh' -or -iname '*.py' -or -iname '*.j2' |
grep -vP $EXCLUDE_DIRS |
@ -177,6 +177,17 @@ for test_case in "${tests_with_query_log[@]}"; do
} || echo "Queries to system.query_log/system.query_thread_log does not have current_database = currentDatabase() condition in $test_case"
done
# There shouldn't be large jumps between test numbers (since they should be consecutive)
max_diff=$(
find $ROOT_PATH/tests/queries -iname '*.sql' -or -iname '*.sh' -or -iname '*.py' -or -iname '*.j2' |
grep -oP '\d+\D+\K\d+' | sort -n -u | awk 's{print ($0-s) " diff " s " and " $0 }{s=$0}' | sort -n | tail -n 1
)
max_diff_value=( $(echo $max_diff) )
if [[ $max_diff_value -ge 100 ]];
then
echo "Too big of a difference between test numbers: $max_diff"
fi
# Queries to:
tables_with_database_column=(
system.tables