2018-03-29 01:41:06 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2018-06-18 21:13:11 +00:00
|
|
|
# set -x
|
2018-05-28 20:38:46 +00:00
|
|
|
|
2018-03-29 01:41:06 +00:00
|
|
|
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
|
|
|
. $CURDIR/../shell_config.sh
|
|
|
|
|
|
|
|
# Not default server config needed
|
|
|
|
|
2018-05-28 20:55:13 +00:00
|
|
|
|
|
|
|
if [ -n $CLICKHOUSE_CONFIG_CLIENT ]; then
|
2018-06-18 21:13:11 +00:00
|
|
|
USE_CONFIG="--config-file $CLICKHOUSE_CONFIG_CLIENT"
|
2018-05-28 20:55:13 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
2018-05-28 20:38:46 +00:00
|
|
|
tcp_port_secure=`$CLICKHOUSE_EXTRACT_CONFIG -k tcp_port_secure 2>/dev/null`
|
|
|
|
if [ -z $tcp_port_secure ]; then
|
2018-03-29 01:41:06 +00:00
|
|
|
# Secure port disabled. Fake result
|
|
|
|
cat $CURDIR/00505_secure.reference
|
|
|
|
else
|
|
|
|
|
2019-03-20 20:04:49 +00:00
|
|
|
CLICKHOUSE_CLIENT_SECURE=${CLICKHOUSE_CLIENT_SECURE:="$CLICKHOUSE_CLIENT_BINARY $USE_CONFIG --secure --port=$CLICKHOUSE_PORT_TCP_SECURE"}
|
2018-05-28 20:38:46 +00:00
|
|
|
if [[ $CLICKHOUSE_CLIENT != *"--port"* ]]; then
|
2019-03-20 20:04:49 +00:00
|
|
|
# Auto port detect. Cant test with re-defined via command line ports
|
2018-06-18 21:13:11 +00:00
|
|
|
$CLICKHOUSE_CLIENT_BINARY $USE_CONFIG --secure -q "SELECT 1";
|
2018-05-28 20:38:46 +00:00
|
|
|
else
|
|
|
|
echo 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
$CLICKHOUSE_CLIENT_SECURE -q "SELECT 2;"
|
|
|
|
|
|
|
|
$CLICKHOUSE_CURL -sS --insecure ${CLICKHOUSE_URL_HTTPS}?query=SELECT%203
|
|
|
|
|
|
|
|
$CLICKHOUSE_CLIENT_SECURE -q "SELECT 4;"
|
2018-03-29 01:41:06 +00:00
|
|
|
|
2018-05-28 20:38:46 +00:00
|
|
|
# TODO: can test only on unchanged port. Possible solutions: generate config or pass shard port via command line
|
|
|
|
if [[ "$CLICKHOUSE_PORT_TCP_SECURE" = "$tcp_port_secure" ]]; then
|
|
|
|
cat $CURDIR/00505_distributed_secure.data | $CLICKHOUSE_CLIENT_SECURE -n -m
|
|
|
|
else
|
|
|
|
tail -n 13 $CURDIR/00505_secure.reference
|
|
|
|
fi
|
2018-03-29 01:41:06 +00:00
|
|
|
|
|
|
|
fi
|