Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix timeout for all expect tests (wrong usage of expect_after timeout) #46779

Merged
merged 10 commits into from
Feb 24, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ match_max 100000

expect_after {
# Do not ignore eof from expect
eof { exp_continue }
-i $any_spawn_id eof { exp_continue }
# A default timeout action is to do nothing, change it to fail
timeout { exit 1 }
-i $any_spawn_id timeout { exit 1 }
}

spawn bash -c "source $basedir/../shell_config.sh ; \$MYSQL_CLIENT_BINARY \$MYSQL_CLIENT_OPT"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ expect "2020-01-01 00:00:00.000\t2"
send -- "DROP TABLE test_01179\r"
expect "Ok."

send -- "\4"
send -- "exit\r"
expect eof
4 changes: 2 additions & 2 deletions tests/queries/0_stateless/01180_client_syntax_errors.expect
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ set timeout 60
match_max 100000
expect_after {
# Do not ignore eof from expect
eof { exp_continue }
-i $any_spawn_id eof { exp_continue }
# A default timeout action is to do nothing, change it to fail
timeout { exit 1 }
-i $any_spawn_id timeout { exit 1 }
}

spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT --disable_suggestion --history_file=$history_file"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ match_max 100000

expect_after {
# Do not ignore eof from expect
eof { exp_continue }
-i $any_spawn_id eof { exp_continue }
# A default timeout action is to do nothing, change it to fail
timeout { exit 1 }
-i $any_spawn_id timeout { exit 1 }
}

# useful debugging configuration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ set timeout 60
match_max 100000
expect_after {
# Do not ignore eof from expect
eof { exp_continue }
-i $any_spawn_id eof { exp_continue }
# A default timeout action is to do nothing, change it to fail
timeout { exit 1 }
-i $any_spawn_id timeout { exit 1 }
}

spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT --disable_suggestion --history_file=$history_file"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ set timeout 60
match_max 100000
expect_after {
# Do not ignore eof from expect
eof { exp_continue }
-i $any_spawn_id eof { exp_continue }
# A default timeout action is to do nothing, change it to fail
timeout { exit 1 }
-i $any_spawn_id timeout { exit 1 }
}

spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT --disable_suggestion --history_file=$history_file"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ set timeout 60
match_max 100000
expect_after {
# Do not ignore eof from expect
eof { exp_continue }
-i $any_spawn_id eof { exp_continue }
# A default timeout action is to do nothing, change it to fail
timeout { exit 1 }
-i $any_spawn_id timeout { exit 1 }
}

spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT --history_file=$history_file"
Expand Down
4 changes: 2 additions & 2 deletions tests/queries/0_stateless/01520_client_print_query_id.expect
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ set timeout 60
match_max 100000
expect_after {
# Do not ignore eof from expect
eof { exp_continue }
-i $any_spawn_id eof { exp_continue }
# A default timeout action is to do nothing, change it to fail
timeout { exit 1 }
-i $any_spawn_id timeout { exit 1 }
}

spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT --disable_suggestion --history_file=$history_file"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ set timeout 60
match_max 100000
expect_after {
# Do not ignore eof from expect
eof { exp_continue }
-i \$any_spawn_id eof { exp_continue }
# A default timeout action is to do nothing, change it to fail
timeout { exit 1 }
-i \$any_spawn_id timeout { exit 1 }
}

spawn bash -c "$*"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ set timeout 60
match_max 100000
expect_after {
# Do not ignore eof from expect
eof { exp_continue }
-i $any_spawn_id eof { exp_continue }
# A default timeout action is to do nothing, change it to fail
timeout { exit 1 }
-i $any_spawn_id timeout { exit 1 }
}

spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT --disable_suggestion --history_file=$history_file"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ set timeout 60
match_max 100000
expect_after {
# Do not ignore eof from expect
eof { exp_continue }
-i $any_spawn_id eof { exp_continue }
# A default timeout action is to do nothing, change it to fail
timeout { exit 1 }
-i $any_spawn_id timeout { exit 1 }
}

# history file is not required, in-memory history is enough
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ set timeout 60
match_max 100000
expect_after {
# Do not ignore eof from expect
eof { exp_continue }
-i $any_spawn_id eof { exp_continue }
# A default timeout action is to do nothing, change it to fail
timeout { exit 1 }
-i $any_spawn_id timeout { exit 1 }
}

exec bash -c "echo select 1 > $history_file.txt"
Expand Down
4 changes: 2 additions & 2 deletions tests/queries/0_stateless/01945_show_debug_warning.expect
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ match_max 100000

expect_after {
# Do not ignore eof from expect
eof { exp_continue }
-i $any_spawn_id eof { exp_continue }
# A default timeout action is to do nothing, change it to fail
timeout { exit 1 }
-i $any_spawn_id timeout { exit 1 }
}

set Debug_type 0
Expand Down
4 changes: 2 additions & 2 deletions tests/queries/0_stateless/02003_memory_limit_in_client.expect
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ match_max 100000

expect_after {
# Do not ignore eof from expect
eof { exp_continue }
-i $any_spawn_id eof { exp_continue }
# A default timeout action is to do nothing, change it to fail
timeout { exit 1 }
-i $any_spawn_id timeout { exit 1 }
}

#
Expand Down
8 changes: 4 additions & 4 deletions tests/queries/0_stateless/02047_client_exception.expect
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ exp_internal -f $env(CLICKHOUSE_TMP)/$basename.debuglog 0
set history_file $env(CLICKHOUSE_TMP)/$basename.history

log_user 0
set timeout 20
set timeout 60
match_max 100000

expect_after {
# Do not ignore eof from expect
eof { exp_continue }
-i $any_spawn_id eof { exp_continue }
# A default timeout action is to do nothing, change it to fail
timeout { exit 1 }
-i $any_spawn_id timeout { exit 1 }
}

spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT --disable_suggestion --history_file=$history_file"
Expand All @@ -31,5 +31,5 @@ expect "Received exception from server"
send -- "DROP TABLE test_02047\r"
expect "Ok."

send -- "\4"
send -- "exit\r"
expect eof
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ set basename [file tail $argv0]
exp_internal -f $env(CLICKHOUSE_TMP)/$basename.debuglog 0

log_user 0
set timeout 20
set timeout 60
match_max 100000

expect_after {
# Do not ignore eof from expect
eof { exp_continue }
-i $any_spawn_id eof { exp_continue }
# A default timeout action is to do nothing, change it to fail
timeout { exit 1 }
-i $any_spawn_id timeout { exit 1 }
}

spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_LOCAL --disable_suggestion"
Expand Down Expand Up @@ -50,5 +50,5 @@ expect "Ok."
send -- "drop table t\r"
expect "Ok."

send -- "\4"
send -- "exit\r"
expect eof
10 changes: 5 additions & 5 deletions tests/queries/0_stateless/02105_backslash_letter_commands.expect
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,25 @@ set timeout 60
match_max 100000
expect_after {
# Do not ignore eof from expect
eof { exp_continue }
-i $any_spawn_id eof { exp_continue }
# A default timeout action is to do nothing, change it to fail
timeout { exit 1 }
-i $any_spawn_id timeout { exit 1 }
}

spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT --disable_suggestion --history_file=$history_file"
expect ":) "

# Send a command
send -- "\\ld;\r"
expect "Syntax error: *"
expect "Syntax error: "
expect ":) "

send -- "\\c;\r"
expect "Syntax error: *"
expect "Syntax error: "
expect ":) "

send -- " \\l ; \\d; \r"
expect "Syntax error (Multi-statements are not allowed): *"
expect "Syntax error (Multi-statements are not allowed): "
expect ":) "

send -- " \\l ;\r"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ match_max 100000

expect_after {
# Do not ignore eof from expect
eof { exp_continue }
-i $any_spawn_id eof { exp_continue }
# A default timeout action is to do nothing, change it to fail
timeout { exit 1 }
-i $any_spawn_id timeout { exit 1 }
}

system "$basedir/helpers/02112_prepare.sh"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ match_max 100000

expect_after {
# Do not ignore eof from expect
eof { exp_continue }
-i $any_spawn_id eof { exp_continue }
# A default timeout action is to do nothing, change it to fail
timeout { exit 1 }
-i $any_spawn_id timeout { exit 1 }
}

spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_LOCAL --disable_suggestion --interactive --query 'create table t(i Int32) engine=Memory; insert into t select 1'"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ match_max 100000

expect_after {
# Do not ignore eof from expect
eof { exp_continue }
-i $any_spawn_id eof { exp_continue }
# A default timeout action is to do nothing, change it to fail
timeout { exit 1 }
-i $any_spawn_id timeout { exit 1 }
}

system "$basedir/helpers/02112_prepare.sh"
Expand Down
4 changes: 2 additions & 2 deletions tests/queries/0_stateless/02116_interactive_hello.expect
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ match_max 100000

expect_after {
# Do not ignore eof from expect
eof { exp_continue }
-i $any_spawn_id eof { exp_continue }
# A default timeout action is to do nothing, change it to fail
timeout { exit 1 }
-i $any_spawn_id timeout { exit 1 }
}

spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT --disable_suggestion --history_file=$history_file"
Expand Down
18 changes: 11 additions & 7 deletions tests/queries/0_stateless/02132_client_history_navigation.expect
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ match_max 100000

expect_after {
# Do not ignore eof from expect
eof { exp_continue }
-i $any_spawn_id eof { exp_continue }
# A default timeout action is to do nothing, change it to fail
timeout { exit 1 }
-i $any_spawn_id timeout { exit 1 }
}

# useful debugging configuration
Expand All @@ -23,16 +23,20 @@ spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \
expect ":) "

# Make a query
send -- "SELECT 1\r"
send -- "SELECT 'unique1'\r"
expect "1"
expect ":) "
send -- "SELECT 2"
send -- "SELECT 'unique2'"
# NOTE: it does not work for alacritty with TERM=xterm
send -- "\033\[A"
expect "SELECT 1"
expect "SELECT 'unique1'"
send -- "\033\[B"
expect "SELECT 2"
expect "SELECT 'unique2'"
send -- "\r"
expect "2"
# First is echoed command
expect "'unique2'"
# Second is the response from the server
expect "'unique2'"

send -- "exit\r"
expect eof
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ set uuid ""
match_max 100000
expect_after {
# Do not ignore eof from read.
eof { exp_continue }
-i $any_spawn_id eof { exp_continue }
# A default timeout action is to do nothing, change it to fail
timeout { exit 1 }
-i $any_spawn_id timeout { exit 1 }
}

spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT --history_file=$history_file"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ set timeout 20
match_max 100000

expect_after {
eof { exp_continue }
timeout { exit 1 }
-i $any_spawn_id eof { exp_continue }
-i $any_spawn_id timeout { exit 1 }
}

spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_LOCAL --disable_suggestion"

expect ":) "
send -- "insert into table function null() format TSV some trash here 123 \n 456\r"
expect -re ".*DB::Exception: Table function 'null' requires 'structure'.*\r"
expect "EMPTY_LIST_OF_COLUMNS_PASSED"
expect ":) "

send -- ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ match_max 100000
set stty_init "rows 25 cols 120"

expect_after {
eof { exp_continue }
timeout { exit 1 }
-i $any_spawn_id eof { exp_continue }
-i $any_spawn_id timeout { exit 1 }
}

spawn bash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ match_max 100000
set stty_init "rows 25 cols 120"

expect_after {
eof { exp_continue }
timeout { exit 1 }
-i $any_spawn_id eof { exp_continue }
-i $any_spawn_id timeout { exit 1 }
}

spawn bash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ match_max 100000

expect_after {
# Do not ignore eof from expect
eof { exp_continue }
-i $any_spawn_id eof { exp_continue }
# A default timeout action is to do nothing, change it to fail
timeout { exit 1 }
-i $any_spawn_id timeout { exit 1 }
}

spawn bash -c "echo 'select 1;\nselect 2;\nselect 3' > queries_02352"
Expand Down