Merge pull request #46779 from azat/tests/expect-timeout-fixes

Fix timeout for all expect tests (wrong usage of expect_after timeout)
This commit is contained in:
Alexander Tokmakov 2023-02-24 23:08:25 +03:00 committed by GitHub
commit 7a49521de8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
32 changed files with 85 additions and 74 deletions

View File

@ -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"

View File

@ -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

View File

@ -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"

View File

@ -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

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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 "$*"

View File

@ -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"

View File

@ -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

View File

@ -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"

View File

@ -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

View File

@ -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 }
}
#

View File

@ -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"
@ -31,5 +31,5 @@ expect "Received exception from server"
send -- "DROP TABLE test_02047\r"
expect "Ok."
send -- "\4"
send -- "exit\r"
expect eof

View File

@ -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"
@ -50,5 +50,5 @@ expect "Ok."
send -- "drop table t\r"
expect "Ok."
send -- "\4"
send -- "exit\r"
expect eof

View File

@ -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"
@ -20,15 +20,15 @@ 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"

View File

@ -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"

View File

@ -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'"

View File

@ -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"

View File

@ -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"

View File

@ -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
@ -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

View File

@ -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"

View File

@ -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 -- ""

View File

@ -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

View File

@ -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

View File

@ -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"

View File

@ -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 "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT --disable_suggestion --history_file=$history_file"

View File

@ -10,8 +10,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

View File

@ -10,8 +10,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

View File

@ -10,8 +10,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

View File

@ -338,6 +338,13 @@ for test_case in "${expect_tests[@]}"; do
pattern="^spawn.*CLICKHOUSE_CLIENT_BINARY.*--history_file$"
grep -q "$pattern" "$test_case" || echo "Missing '$pattern' in '$test_case'"
fi
# Otherwise expect_after/expect_before will not bail without stdin attached
# (and actually this is a hack anyway, correct way is to use $any_spawn_id)
pattern="-i \$any_spawn_id timeout"
grep -q -- "$pattern" "$test_case" || echo "Missing '$pattern' in '$test_case'"
pattern="-i \$any_spawn_id eof"
grep -q -- "$pattern" "$test_case" || echo "Missing '$pattern' in '$test_case'"
done
# Conflict markers