ClickHouse/tests/queries/0_stateless/01526_initial_query_id.sh

29 lines
763 B
Bash
Raw Normal View History

2020-10-19 21:26:10 +00:00
#!/usr/bin/env bash
set -ue
2021-01-30 23:22:55 +00:00
CLICKHOUSE_LOG_COMMENT=''
2020-10-19 21:26:10 +00:00
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
2020-12-28 11:46:53 +00:00
# shellcheck source=../shell_config.sh
2020-10-19 21:26:10 +00:00
. "$CURDIR"/../shell_config.sh
query_id=$(${CLICKHOUSE_CLIENT} -q "select lower(hex(reverse(reinterpretAsString(generateUUIDv4()))))")
${CLICKHOUSE_CLIENT} -q "select 1 format Null" "--query_id=$query_id"
${CLICKHOUSE_CURL} \
--header "X-ClickHouse-Query-Id: $query_id" \
2020-11-11 15:29:36 +00:00
$CLICKHOUSE_URL \
2020-10-19 21:26:10 +00:00
--get \
--data-urlencode "query=select 1 format Null"
${CLICKHOUSE_CLIENT} -n -q "
system flush logs;
select interface, initial_query_id = query_id
from system.query_log
where current_database = currentDatabase() AND query_id = '$query_id' and type = 'QueryFinish'
2020-10-19 21:26:10 +00:00
order by interface
;
"