#!/usr/bin/env bash
set -e
CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck source=../shell_config.sh
. "$CUR_DIR"/../shell_config.sh
echo "
trace
true
9000
./
0
users.xml
" > $CUR_DIR/config.xml
echo "
::/0
default
default
" > $CUR_DIR/users.xml
local_opts=(
"--config-file=$CUR_DIR/config.xml"
"--send_logs_level=none")
${CLICKHOUSE_LOCAL} "${local_opts[@]}" --query 'Select 1' |& grep -v -e 'Processing configuration file'
rm -rf $CUR_DIR/users.xml
rm -rf $CUR_DIR/config.xml