From f0ff9af332923901f81c4cba7b7d72c478db6406 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Mar=C3=ADn?= Date: Fri, 30 Jul 2021 13:40:49 +0200 Subject: [PATCH] Attempt to fix flaky 00705_drop_create_merge_tree --- .../0_stateless/00705_drop_create_merge_tree.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/queries/0_stateless/00705_drop_create_merge_tree.sh b/tests/queries/0_stateless/00705_drop_create_merge_tree.sh index ede490cf8f1..2ab35dacd0f 100755 --- a/tests/queries/0_stateless/00705_drop_create_merge_tree.sh +++ b/tests/queries/0_stateless/00705_drop_create_merge_tree.sh @@ -7,10 +7,20 @@ CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) function stress() { - while true; do + # We set up a signal handler to make sure to wait for all queries to be finished before ending + CONTINUE=true + handle_interruption() + { + CONTINUE=false + } + trap handle_interruption INT + + while $CONTINUE; do ${CLICKHOUSE_CLIENT} --query "CREATE TABLE IF NOT EXISTS table (x UInt8) ENGINE = MergeTree ORDER BY tuple()" 2>/dev/null ${CLICKHOUSE_CLIENT} --query "DROP TABLE table" 2>/dev/null done + + trap - INT } # https://stackoverflow.com/questions/9954794/execute-a-shell-function-with-timeout @@ -18,7 +28,7 @@ export -f stress for _ in {1..5}; do # Ten seconds are just barely enough to reproduce the issue in most of runs. - timeout 10 bash -c stress & + timeout -s INT 10 bash -c stress & done wait