Fix 02160_client_autocomplete_parse_query

Sad (since I wanted to make the test a little bit cleaner/easier to
understand), but you cannot use send_user in tests, since expect
send_user works only if stdin is a tty, so the following will fail (so
as in CI):

    $ ./tests/clickhouse-test --database default 02160  < /dev/null
    Using queries from '/src/ch/clickhouse-upstream/tests/queries' directory
    Using clickhouse-client as client program (expecting split build)
    Connecting to ClickHouse server... OK

    Running 1 stateless tests (MainProcess).

    02160_client_autocomplete_parse_query:                                  [ FAIL ] - return code: 1
    send: spawn id exp0 not open
        while executing
    "send_user "Completion loaded\n""
        (file "/src/ch/clickhouse-upstream/tests/queries/0_stateless/02160_client_autocomplete_parse_query.expect" line 40)
    , result:

    stdout:

    Database: default
This commit is contained in:
Azat Khuzhin 2021-12-28 10:05:14 +03:00
parent 36c4fc054c
commit 72dd5a2d2f
2 changed files with 0 additions and 15 deletions

View File

@ -7,7 +7,6 @@ match_max 100000
# A default timeout action is to do nothing, change it to fail
expect_after {
timeout {
send_user "FAILED (uuid=$uuid)\n"
exit 1
}
}
@ -37,21 +36,18 @@ while {$is_done == 0} {
set timeout 60
send -- ""
expect ":) "
send_user "Completion loaded\n"
# 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 ":) "
send_user "UUID generated\n"
# Create
send -- "create database new_${uuid}_database\r"
expect ":) "
send -- "create table new_${uuid}_table (new_${uuid}_column Int) engine=Null()\r"
expect ":) "
send_user "Structure created\n"
# Check completion
send -- "new_${uuid}_data"
@ -60,7 +56,6 @@ send -- "\t"
expect "base"
send -- ""
expect ":) "
send_user "Database completion works\n"
send -- "new_${uuid}_ta"
expect "new_${uuid}_ta"
@ -68,7 +63,6 @@ send -- "\t"
expect "ble"
send -- ""
expect ":) "
send_user "Table completion works\n"
send -- "new_${uuid}_col"
expect "new_${uuid}_col"
@ -76,14 +70,12 @@ send -- "\t"
expect "umn"
send -- ""
expect ":) "
send_user "Column completion works\n"
# Cleanup
send -- "drop database new_${uuid}_database\r"
expect ":) "
send -- "drop table new_${uuid}_table\r"
expect ":) "
send_user "Cleanup\n"
send -- ""
expect eof

View File

@ -1,7 +0,0 @@
Completion loaded
UUID generated
Structure created
Database completion works
Table completion works
Column completion works
Cleanup