ClickHouse/tests/queries/0_stateless/02160_client_autocomplete_parse_query.expect
Azat Khuzhin 4a9ef3ba76 Use hex char numbers for Ctrl-C/Ctrl-V in 02160_client_autocomplete_parse_query
Since special symbols for Ctrl-C/Ctrl-V are not rendered in github UI,
yes vim renders it, but this does not makes review easier.
2022-01-18 21:03:51 +03:00

87 lines
1.7 KiB
Plaintext
Executable File

#!/usr/bin/expect -f
log_user 0
set timeout 60
set uuid ""
match_max 100000
expect_after {
# Do not ignore eof from read.
eof { exp_continue }
# A default timeout action is to do nothing, change it to fail
timeout { exit 1 }
}
set basedir [file dirname $argv0]
spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT"
expect ":) "
# Make a query
send -- "set max_distributed"
expect "set max_distributed"
# Wait for suggestions to load, they are loaded in background
set is_done 0
set timeout 1
while {$is_done == 0} {
send -- "\t"
expect {
"_" {
set is_done 1
}
default {
# Reset the expect_after
}
}
}
set timeout 60
# Ctrl-C
send -- "\3"
expect ":) "
# Generate UIUD to avoid matching old database/tables/columns from previous test runs.
send -- "select 'begin-' || replace(toString(generateUUIDv4()), '-', '') || '-end' format TSV\r"
expect -re TSV.*TSV.*begin-(.*)-end.*
set uuid $expect_out(1,string)
expect ":) "
# Create
send -- "create database new_${uuid}_database\r"
expect ":) "
send -- "create table new_${uuid}_table (new_${uuid}_column Int) engine=Null()\r"
expect ":) "
# Check completion
send -- "new_${uuid}_data"
expect "new_${uuid}_data"
send -- "\t"
expect "base"
# Ctrl-C
send -- "\3"
expect ":) "
send -- "new_${uuid}_ta"
expect "new_${uuid}_ta"
send -- "\t"
expect "ble"
# Ctrl-C
send -- "\3"
expect ":) "
send -- "new_${uuid}_col"
expect "new_${uuid}_col"
send -- "\t"
expect "umn"
# Ctrl-C
send -- "\3"
expect ":) "
# Cleanup
send -- "drop database new_${uuid}_database\r"
expect ":) "
send -- "drop table new_${uuid}_table\r"
expect ":) "
# Ctrl-D
send -- "\4"
expect eof