mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 16:12:01 +00:00
a3b3e2dcc1
By default expect matches patterns against output from the current process, however if you don't have stdin attached (like the case for CI), you will not have anything to check against, hence "timeout" simply does not work. Likely expect has $any_spawn_id (another option is to put expect_after after spawn). v2: use $any_spawn_id Refs: https://github.com/ClickHouse/ClickHouse/pull/43819 Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
55 lines
1.7 KiB
Plaintext
Executable File
55 lines
1.7 KiB
Plaintext
Executable File
#!/usr/bin/expect -f
|
|
|
|
set basedir [file dirname $argv0]
|
|
set basename [file tail $argv0]
|
|
exp_internal -f $env(CLICKHOUSE_TMP)/$basename.debuglog 0
|
|
|
|
log_user 0
|
|
set timeout 60
|
|
match_max 100000
|
|
set stty_init "rows 25 cols 120"
|
|
|
|
expect_after {
|
|
-i $any_spawn_id eof { exp_continue }
|
|
-i $any_spawn_id timeout { exit 1 }
|
|
}
|
|
|
|
spawn bash
|
|
send "source $basedir/../shell_config.sh\r"
|
|
|
|
# Progress is not displayed by default
|
|
send "\$CLICKHOUSE_LOCAL --query 'SELECT sleep(1), \$\$Hello\$\$ FROM numbers(3) SETTINGS max_block_size = 1' 2>/dev/null\r"
|
|
expect -exact "0\tHello\r\n"
|
|
send "\3"
|
|
|
|
# The option --progress has implicit value of true
|
|
send "\$CLICKHOUSE_LOCAL --progress --query 'SELECT sum(sleep(1) = 0) FROM numbers(3) SETTINGS max_block_size = 1' >/dev/null\r"
|
|
expect "Progress: "
|
|
expect "█"
|
|
send "\3"
|
|
|
|
# It works even if we redirect both stdout and stderr to /dev/null
|
|
send "\$CLICKHOUSE_LOCAL --progress --query 'SELECT sum(sleep(1) = 0) FROM numbers(3) SETTINGS max_block_size = 1' >/dev/null 2>&1\r"
|
|
expect "Progress: "
|
|
expect "█"
|
|
send "\3"
|
|
|
|
# But we can set it to false
|
|
send "\$CLICKHOUSE_LOCAL --progress false --query 'SELECT sleep(1), \$\$Hello\$\$ FROM numbers(3) SETTINGS max_block_size = 1' 2>/dev/null\r"
|
|
expect -exact "0\tHello\r\n"
|
|
send "\3"
|
|
|
|
# As well as to 0 for the same effect
|
|
send "\$CLICKHOUSE_LOCAL --progress 0 --query 'SELECT sleep(1), \$\$Hello\$\$ FROM numbers(3) SETTINGS max_block_size = 1' 2>/dev/null\r"
|
|
expect -exact "0\tHello\r\n"
|
|
send "\3"
|
|
|
|
# If we set it to 1, the progress will be displayed as well
|
|
send "\$CLICKHOUSE_LOCAL --progress 1 --query 'SELECT sum(sleep(1) = 0) FROM numbers(3) SETTINGS max_block_size = 1' >/dev/null 2>&1\r"
|
|
expect "Progress: "
|
|
expect "█"
|
|
send "\3"
|
|
|
|
send "exit\r"
|
|
expect eof
|