This commit is contained in:
Nikita Mikhaylov 2024-07-29 11:00:21 +00:00
parent 80a003f994
commit 5b5e88b7e3

View File

@ -8,18 +8,22 @@ CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
set -o pipefail set -o pipefail
MISTER_USER="test_01238_http_$RANDOM"
# Create another user to check limit on the amount of memory reliabily
${CLICKHOUSE_CLIENT} --format Null -q "CREATE USER $MISTER_USER"
# This is needed to keep at least one running query for user for the time of test. # This is needed to keep at least one running query for user for the time of test.
# (1k http queries takes ~1 second, let's run for 5x more to avoid flaps) # (1k http queries takes ~1 second, let's run for 5x more to avoid flaps)
${CLICKHOUSE_CLIENT} --function_sleep_max_microseconds_per_block 5000000 --format Null -n <<<'SELECT sleepEachRow(1) FROM numbers(5)' & ${CLICKHOUSE_CLIENT} --user ${MISTER_USER} --function_sleep_max_microseconds_per_block 5000000 --format Null -n <<<'SELECT sleepEachRow(1) FROM numbers(5)' &
# ignore "yes: standard output: Broken pipe" # ignore "yes: standard output: Broken pipe"
yes 'SELECT 1' 2>/dev/null | { yes 'SELECT 1' 2>/dev/null | {
head -n1000 head -n1000
} | { } | {
xargs -I{} ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}&wait_end_of_query=1&max_memory_usage_for_user=$((1<<30))" -d '{}' xargs -I{} ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}&user=${MISTER_USER}&wait_end_of_query=1&max_memory_usage_for_user=$((1<<30))" -d '{}'
} | grep -x -c 1 } | grep -x -c 1
wait wait
# Reset max_memory_usage_for_user, so it will not affect other tests # Reset max_memory_usage_for_user, so it will not affect other tests
${CLICKHOUSE_CLIENT} --max_memory_usage_for_user=0 -q "SELECT 1 FORMAT Null" ${CLICKHOUSE_CLIENT} --user ${MISTER_USER} --max_memory_usage_for_user=0 -q "SELECT 1 FORMAT Null"