2021-12-26 16:10:25 +00:00
|
|
|
#!/usr/bin/expect -f
|
|
|
|
|
|
|
|
log_user 0
|
|
|
|
set timeout 60
|
|
|
|
set uuid ""
|
|
|
|
match_max 100000
|
|
|
|
expect_after {
|
2021-12-28 18:16:20 +00:00
|
|
|
# Do not ignore eof from read.
|
|
|
|
eof { exp_continue }
|
|
|
|
# A default timeout action is to do nothing, change it to fail
|
|
|
|
timeout { exit 1 }
|
2021-12-26 16:10:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
set basedir [file dirname $argv0]
|
|
|
|
spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT"
|
2021-12-28 18:16:20 +00:00
|
|
|
expect ":) "
|
2021-12-26 16:10:25 +00:00
|
|
|
|
|
|
|
# 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
|
2022-01-18 18:03:51 +00:00
|
|
|
# Ctrl-C
|
|
|
|
send -- "\3"
|
2021-12-26 16:10:25 +00:00
|
|
|
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"
|
2022-01-18 18:03:51 +00:00
|
|
|
# Ctrl-C
|
|
|
|
send -- "\3"
|
2021-12-26 16:10:25 +00:00
|
|
|
expect ":) "
|
|
|
|
|
|
|
|
send -- "new_${uuid}_ta"
|
|
|
|
expect "new_${uuid}_ta"
|
|
|
|
send -- "\t"
|
|
|
|
expect "ble"
|
2022-01-18 18:03:51 +00:00
|
|
|
# Ctrl-C
|
|
|
|
send -- "\3"
|
2021-12-26 16:10:25 +00:00
|
|
|
expect ":) "
|
|
|
|
|
|
|
|
send -- "new_${uuid}_col"
|
|
|
|
expect "new_${uuid}_col"
|
|
|
|
send -- "\t"
|
|
|
|
expect "umn"
|
2022-01-18 18:03:51 +00:00
|
|
|
# Ctrl-C
|
|
|
|
send -- "\3"
|
2021-12-26 16:10:25 +00:00
|
|
|
expect ":) "
|
|
|
|
|
|
|
|
# Cleanup
|
|
|
|
send -- "drop database new_${uuid}_database\r"
|
|
|
|
expect ":) "
|
|
|
|
send -- "drop table new_${uuid}_table\r"
|
|
|
|
expect ":) "
|
|
|
|
|
2022-01-18 18:03:51 +00:00
|
|
|
# Ctrl-D
|
|
|
|
send -- "\4"
|
2021-12-26 16:10:25 +00:00
|
|
|
expect eof
|