mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 00:22:29 +00:00
Fix flakiness of expect tests for clickhouse-client by avoiding history overlap
Yes, all writes to the history file is done under flock, *but*, before writing the history file there is sort(), and so if you will run the following tests the 01300_client_save_history_when_terminated_long will fail: $ /src/tests/clickhouse-test --print-time -j2 01180_client_syntax_errors 01300_client_save_history_when_terminated_long 0001_select And it has nothing todo with timeouts: expect: does "" (spawn_id exp8) match glob pattern "for the history"? no f8f1dbfdaaca :) select (1, 2 expect: does "\u001b[1Gf8f1dbfdaaca :) select \u001b[0;22;33m(\u001b[0;22;32m1\u001b[0;1m,\u001b[0m \u001b[0;22;32m2\u001b[0m\u001b[J" (spawn_id exp8) match glob pattern "for the history"? no expect: does "\u001b[1Gf8f1dbfdaaca :) select \u001b[0;22;33m(\u001b[0;22;32m1\u001b[0;1m,\u001b[0m \u001b[0;22;32m2\u001b[0m\u001b[J\u001b[29G" (spawn_id exp8) match glob pattern "for the history"? no expect: timed out The "select (1, 2" is from 01180_client_syntax_errors And use real file only when the history should be preserved across runs (i.e. there are multiple invocations of clickhouse-client) CI: https://s3.amazonaws.com/clickhouse-test-reports/0/1adfbac19fed9813725d8b1df14e617b58a45d20/stateless_tests__asan__[2/2].html Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
This commit is contained in:
parent
5359dcc014
commit
238d44783b
1
.gitignore
vendored
1
.gitignore
vendored
@ -161,6 +161,7 @@ website/package-lock.json
|
||||
tests/queries/0_stateless/test_*
|
||||
tests/queries/0_stateless/*.binary
|
||||
tests/queries/0_stateless/*.generated-expect
|
||||
tests/queries/0_stateless/*.expect.history
|
||||
|
||||
# rust
|
||||
/rust/**/target
|
||||
|
@ -15,7 +15,7 @@ expect_after {
|
||||
timeout { exit 1 }
|
||||
}
|
||||
|
||||
spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT --disable_suggestion"
|
||||
spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT --disable_suggestion --history_file=/dev/null"
|
||||
expect ":) "
|
||||
|
||||
send -- "DROP TABLE IF EXISTS test_01179\r"
|
||||
|
@ -14,7 +14,7 @@ expect_after {
|
||||
timeout { exit 1 }
|
||||
}
|
||||
|
||||
spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT --disable_suggestion"
|
||||
spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT --disable_suggestion --history_file=/dev/null"
|
||||
expect ":) "
|
||||
|
||||
# Make a query with syntax error
|
||||
|
@ -3,6 +3,7 @@
|
||||
set basedir [file dirname $argv0]
|
||||
set basename [file tail $argv0]
|
||||
exp_internal -f $env(CLICKHOUSE_TMP)/$basename.debuglog 0
|
||||
set history_file $env(CLICKHOUSE_TMP)/$basename.history
|
||||
|
||||
log_user 0
|
||||
set timeout 10
|
||||
@ -18,7 +19,7 @@ expect_after {
|
||||
# useful debugging configuration
|
||||
# exp_internal 1
|
||||
|
||||
spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT --disable_suggestion"
|
||||
spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT --disable_suggestion --history_file=$history_file"
|
||||
expect ":) "
|
||||
|
||||
send -- "SELECT 1\r"
|
||||
@ -60,7 +61,7 @@ expect ":) "
|
||||
send -- ""
|
||||
expect eof
|
||||
|
||||
spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT --disable_suggestion --highlight 0 --multiline"
|
||||
spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT --disable_suggestion --highlight 0 --multiline --history_file=$history_file"
|
||||
expect ":) "
|
||||
|
||||
send -- "SELECT 1;\r"
|
||||
|
@ -14,7 +14,7 @@ expect_after {
|
||||
timeout { exit 1 }
|
||||
}
|
||||
|
||||
spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT --disable_suggestion"
|
||||
spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT --disable_suggestion --history_file=/dev/null"
|
||||
expect ":) "
|
||||
|
||||
send -- "SELECT 1\r"
|
||||
|
@ -4,6 +4,7 @@
|
||||
set basedir [file dirname $argv0]
|
||||
set basename [file tail $argv0]
|
||||
exp_internal -f $env(CLICKHOUSE_TMP)/$basename.debuglog 0
|
||||
set history_file $env(CLICKHOUSE_TMP)/$basename.history
|
||||
|
||||
log_user 0
|
||||
set timeout 60
|
||||
@ -15,7 +16,7 @@ expect_after {
|
||||
timeout { exit 1 }
|
||||
}
|
||||
|
||||
spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT --disable_suggestion"
|
||||
spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT --disable_suggestion --history_file=$history_file"
|
||||
expect ":) "
|
||||
|
||||
# Make a query
|
||||
@ -28,7 +29,7 @@ exec kill -9 [exp_pid]
|
||||
close
|
||||
|
||||
# Run client one more time and press "up" to see the last recorded query
|
||||
spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT"
|
||||
spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT --history_file=$history_file"
|
||||
expect ":) "
|
||||
send -- "\[A"
|
||||
expect "for the history"
|
||||
|
@ -14,7 +14,7 @@ expect_after {
|
||||
timeout { exit 1 }
|
||||
}
|
||||
|
||||
spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT"
|
||||
spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT --history_file=/dev/null"
|
||||
expect ":) "
|
||||
|
||||
# Make a query
|
||||
|
@ -14,7 +14,7 @@ expect_after {
|
||||
timeout { exit 1 }
|
||||
}
|
||||
|
||||
spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT --disable_suggestion"
|
||||
spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT --disable_suggestion --history_file=/dev/null"
|
||||
expect ":) "
|
||||
|
||||
# Make a query
|
||||
|
@ -19,7 +19,7 @@ expect_after {
|
||||
timeout { exit 1 }
|
||||
}
|
||||
|
||||
spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT --disable_suggestion -mn"
|
||||
spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT --disable_suggestion -mn --history_file=/dev/null"
|
||||
expect "\n:) "
|
||||
|
||||
send -- "DROP TABLE IF EXISTS t01565;\n"
|
||||
|
@ -14,7 +14,7 @@ expect_after {
|
||||
timeout { exit 1 }
|
||||
}
|
||||
|
||||
spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT --disable_suggestion"
|
||||
spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT --disable_suggestion --history_file=/dev/null"
|
||||
expect ":) "
|
||||
|
||||
# regression for heap-buffer-overflow issue (under ASAN)
|
||||
|
@ -1,10 +1,9 @@
|
||||
#!/usr/bin/expect -f
|
||||
# Tags: no-parallel
|
||||
# Tag no-parallel: Uses non unique history file
|
||||
|
||||
set basedir [file dirname $argv0]
|
||||
set basename [file tail $argv0]
|
||||
exp_internal -f $env(CLICKHOUSE_TMP)/$basename.debuglog 0
|
||||
set history_file $env(CLICKHOUSE_TMP)/$basename.history
|
||||
|
||||
log_user 0
|
||||
set timeout 60
|
||||
@ -16,17 +15,17 @@ expect_after {
|
||||
timeout { exit 1 }
|
||||
}
|
||||
|
||||
exec bash -c "echo select 1 > $argv0.txt"
|
||||
exec bash -c "echo select 1 >> $argv0.txt"
|
||||
exec bash -c "echo select 1 >> $argv0.txt"
|
||||
exec bash -c "echo select 1 > $history_file.txt"
|
||||
exec bash -c "echo select 1 >> $history_file.txt"
|
||||
exec bash -c "echo select 1 >> $history_file.txt"
|
||||
|
||||
spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT --history_file=$argv0.txt"
|
||||
expect "The history file ($argv0.txt) is in old format. 3 lines, 1 unique lines."
|
||||
spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT --history_file=$history_file.txt"
|
||||
expect "The history file ($history_file.txt) is in old format. 3 lines, 1 unique lines."
|
||||
expect ":) "
|
||||
send -- "\4"
|
||||
expect eof
|
||||
|
||||
spawn bash -c "wc -l $argv0.txt"
|
||||
spawn bash -c "wc -l $history_file.txt"
|
||||
# The following lines are expected:
|
||||
#
|
||||
# ### YYYY-MM-DD HH:MM:SS.SSS
|
||||
@ -35,4 +34,4 @@ spawn bash -c "wc -l $argv0.txt"
|
||||
expect "2"
|
||||
expect eof
|
||||
|
||||
exec bash -c "rm $argv0.txt"
|
||||
exec bash -c "rm $history_file.txt"
|
||||
|
@ -20,14 +20,14 @@ expect_after {
|
||||
|
||||
set Debug_type 0
|
||||
|
||||
spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT --disable_suggestion"
|
||||
spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT --disable_suggestion --history_file=/dev/null"
|
||||
expect ":) "
|
||||
|
||||
# Check debug type
|
||||
send -- "SELECT value FROM system.build_options WHERE name='BUILD_TYPE'\r"
|
||||
expect {
|
||||
"Debug" {
|
||||
set Debug_type 1
|
||||
set Debug_type 1
|
||||
expect ":) "
|
||||
}
|
||||
"RelWithDebInfo"
|
||||
@ -38,7 +38,7 @@ expect eof
|
||||
|
||||
if { $Debug_type > 0} {
|
||||
|
||||
spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT --disable_suggestion"
|
||||
spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT --disable_suggestion --history_file=/dev/null"
|
||||
expect "Warnings:"
|
||||
expect " * Server was built in debug mode. It will work slowly."
|
||||
expect ":) "
|
||||
@ -52,7 +52,7 @@ send -- "q\r"
|
||||
expect eof
|
||||
}
|
||||
|
||||
spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT --disable_suggestion --max_memory_usage_for_all_queries=123"
|
||||
spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT --disable_suggestion --max_memory_usage_for_all_queries=123 --history_file=/dev/null"
|
||||
expect "Warnings:"
|
||||
expect " * Some obsolete setting is changed."
|
||||
expect ":) "
|
||||
|
@ -22,7 +22,7 @@ expect_after {
|
||||
#
|
||||
# Check that the query will fail in clickhouse-client
|
||||
#
|
||||
spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT --disable_suggestion --max_memory_usage_in_client=1"
|
||||
spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT --disable_suggestion --max_memory_usage_in_client=1 --history_file=/dev/null"
|
||||
expect ":) "
|
||||
|
||||
send -- "SELECT arrayMap(x -> range(x), range(number)) FROM numbers(1000)\r"
|
||||
@ -37,7 +37,7 @@ expect eof
|
||||
#
|
||||
# Check that the query will fail in clickhouse-client
|
||||
#
|
||||
spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT --disable_suggestion --max_memory_usage_in_client=1"
|
||||
spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT --disable_suggestion --max_memory_usage_in_client=1 --history_file=/dev/null"
|
||||
expect ":) "
|
||||
|
||||
send -- "SELECT arrayMap(x -> range(x), range(number)) FROM numbers(1000)\r"
|
||||
@ -52,7 +52,7 @@ expect eof
|
||||
#
|
||||
# Check that the query will not fail (due to max_untracked_memory)
|
||||
#
|
||||
spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT --disable_suggestion --max_memory_usage_in_client=1"
|
||||
spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT --disable_suggestion --max_memory_usage_in_client=1 --history_file=/dev/null"
|
||||
expect ":) "
|
||||
|
||||
send -- "SELECT * FROM (SELECT * FROM system.numbers LIMIT 600000) as num WHERE num.number=60000\r"
|
||||
|
@ -15,7 +15,7 @@ expect_after {
|
||||
timeout { exit 1 }
|
||||
}
|
||||
|
||||
spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT --disable_suggestion"
|
||||
spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT --disable_suggestion --history_file=/dev/null"
|
||||
expect ":) "
|
||||
|
||||
send -- "DROP TABLE IF EXISTS test_02047\r"
|
||||
|
@ -5,7 +5,7 @@ set basename [file tail $argv0]
|
||||
exp_internal -f $env(CLICKHOUSE_TMP)/$basename.debuglog 0
|
||||
|
||||
log_user 0
|
||||
set timeout 02
|
||||
set timeout 60
|
||||
match_max 100000
|
||||
expect_after {
|
||||
# Do not ignore eof from expect
|
||||
@ -14,7 +14,7 @@ expect_after {
|
||||
timeout { exit 1 }
|
||||
}
|
||||
|
||||
spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT --disable_suggestion"
|
||||
spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT --disable_suggestion --history_file=/dev/null"
|
||||
expect ":) "
|
||||
|
||||
# Send a command
|
||||
|
@ -16,7 +16,7 @@ expect_after {
|
||||
timeout { exit 1 }
|
||||
}
|
||||
|
||||
spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT --disable_suggestion"
|
||||
spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT --disable_suggestion --history_file=/dev/null"
|
||||
|
||||
expect -re "ClickHouse client version \[\\d\]{2}.\[\\d\]{1,2}.\[\\d\]{1,2}.\[\\d\]{1,2}.\r"
|
||||
expect -re "Connecting to database .* at localhost:9000 as user default.\r"
|
||||
|
@ -5,7 +5,7 @@ set basename [file tail $argv0]
|
||||
exp_internal -f $env(CLICKHOUSE_TMP)/$basename.debuglog 0
|
||||
|
||||
log_user 0
|
||||
set timeout 3
|
||||
set timeout 60
|
||||
match_max 100000
|
||||
|
||||
expect_after {
|
||||
@ -18,7 +18,7 @@ expect_after {
|
||||
# useful debugging configuration
|
||||
# exp_internal 1
|
||||
|
||||
spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT --disable_suggestion --highlight 0"
|
||||
spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT --disable_suggestion --highlight 0 --history_file=/dev/null"
|
||||
expect ":) "
|
||||
|
||||
# Make a query
|
||||
|
@ -15,7 +15,7 @@ expect_after {
|
||||
timeout { exit 1 }
|
||||
}
|
||||
|
||||
spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT"
|
||||
spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT --history_file=/dev/null"
|
||||
expect ":) "
|
||||
|
||||
# Make a query
|
||||
|
@ -5,7 +5,7 @@ set basename [file tail $argv0]
|
||||
exp_internal -f $env(CLICKHOUSE_TMP)/$basename.debuglog 0
|
||||
|
||||
log_user 0
|
||||
set timeout 10
|
||||
set timeout 60
|
||||
match_max 100000
|
||||
|
||||
expect_after {
|
||||
@ -15,7 +15,7 @@ expect_after {
|
||||
timeout { exit 1 }
|
||||
}
|
||||
|
||||
spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT --disable_suggestion"
|
||||
spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT --disable_suggestion --history_file=/dev/null"
|
||||
expect ":) "
|
||||
|
||||
# -----------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user