mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Fix test 00505_secure with random ports (#2433)
This commit is contained in:
parent
421d1602ab
commit
895b8e6515
@ -1,4 +1,3 @@
|
||||
<yandex>
|
||||
<tcp_port_secure>59440</tcp_port_secure>
|
||||
<insert_format_max_block_size>100000</insert_format_max_block_size>
|
||||
</yandex>
|
||||
|
@ -25,8 +25,8 @@ export CLICKHOUSE_CONFIG=${CLICKHOUSE_CONFIG:=${CONFIG_SERVER_DIR}server-test.xm
|
||||
[ ! -d "$QUERIES_DIR" ] && [ -d "/usr/share/clickhouse-test/queries" ] && QUERIES_DIR=${QUERIES_DIR=/usr/share/clickhouse-test/queries}
|
||||
CLICKHOUSE_EXTRACT_CONFIG=${CLICKHOUSE_EXTRACT_CONFIG:="${BIN_DIR}${CLICKHOUSE_BINARY}-extract-from-config --config=$CLICKHOUSE_CONFIG"}
|
||||
|
||||
PORT_RANDOM=${PORT_RANDOM=1}
|
||||
if [ "${PORT_RANDOM}" ]; then
|
||||
TEST_PORT_RANDOM=${TEST_PORT_RANDOM=1}
|
||||
if [ "${TEST_PORT_RANDOM}" ]; then
|
||||
CLICKHOUSE_PORT_BASE=${CLICKHOUSE_PORT_BASE:=$(( ( RANDOM % 50000 ) + 10000 ))}
|
||||
CLICKHOUSE_PORT_TCP=${CLICKHOUSE_PORT_TCP:=$(($CLICKHOUSE_PORT_BASE + 1))}
|
||||
CLICKHOUSE_PORT_HTTP=${CLICKHOUSE_PORT_HTTP:=$(($CLICKHOUSE_PORT_BASE + 2))}
|
||||
@ -58,23 +58,35 @@ if [ "$TEST_GDB" ]; then
|
||||
fi
|
||||
|
||||
# Start a local clickhouse server which will be used to run tests
|
||||
#PATH=$PATH:$BIN_DIR \
|
||||
$GDB ${BIN_DIR}clickhouse-server --config-file=$CLICKHOUSE_CONFIG -- --http_port=$CLICKHOUSE_PORT_HTTP --tcp_port=$CLICKHOUSE_PORT_TCP --https_port=$CLICKHOUSE_PORT_HTTPS --tcp_port_secure=$CLICKHOUSE_PORT_TCP_SECURE --interserver_http_port=$CLICKHOUSE_PORT_INTERSERVER > $LOG_DIR/stdout 2>&1 &
|
||||
|
||||
# TODO: fix change shard ports:
|
||||
# --remote_servers.test_shard_localhost_secure.shard.replica.port=$CLICKHOUSE_PORT_TCP_SECURE \
|
||||
# --remote_servers.test_shard_localhost.shard.replica.port=$CLICKHOUSE_PORT_TCP \
|
||||
|
||||
$GDB ${BIN_DIR}clickhouse-server --config-file=$CLICKHOUSE_CONFIG -- \
|
||||
--http_port=$CLICKHOUSE_PORT_HTTP \
|
||||
--tcp_port=$CLICKHOUSE_PORT_TCP \
|
||||
--https_port=$CLICKHOUSE_PORT_HTTPS \
|
||||
--tcp_port_secure=$CLICKHOUSE_PORT_TCP_SECURE \
|
||||
--interserver_http_port=$CLICKHOUSE_PORT_INTERSERVER \
|
||||
> $LOG_DIR/stdout 2>&1 &
|
||||
CH_PID=$!
|
||||
sleep 3
|
||||
|
||||
|
||||
|
||||
if [ "$GDB" ]; then
|
||||
# Long symbols read
|
||||
sleep 40
|
||||
fi
|
||||
|
||||
tail -n50 $LOG_DIR/*
|
||||
tail -n50 $LOG_DIR/*.log || true
|
||||
|
||||
# Define needed stuff to kill test clickhouse server after tests completion
|
||||
function finish {
|
||||
kill $CH_PID || true
|
||||
wait
|
||||
tail -n 50 $LOG_DIR/*
|
||||
tail -n 50 $LOG_DIR/*.log || true
|
||||
if [ "$GDB" ]; then
|
||||
cat $DATA_DIR/gdb.log || true
|
||||
fi
|
||||
|
@ -11,7 +11,7 @@ INSERT INTO test.secure1 VALUES (11,12,13,14,15);
|
||||
INSERT INTO test.secure2 VALUES (21,22,23,24,25);
|
||||
INSERT INTO test.secure3 VALUES (31,32,33,34,35);
|
||||
|
||||
SELECT sleep(1);
|
||||
SELECT 'sleep', sleep(1);
|
||||
|
||||
SELECT * FROM test.secure1 ORDER BY a;
|
||||
SELECT * FROM test.secure2 ORDER BY a;
|
||||
|
@ -1,8 +1,8 @@
|
||||
1
|
||||
2
|
||||
3
|
||||
1
|
||||
0
|
||||
4
|
||||
sleep 0
|
||||
1970-01-02 2 3 4 5
|
||||
1970-01-12 12 13 14 15
|
||||
1970-01-22 22 23 24 25
|
||||
|
@ -1,22 +1,40 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#set -x
|
||||
|
||||
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
. $CURDIR/../shell_config.sh
|
||||
|
||||
# Not default server config needed
|
||||
|
||||
tcp_port_secure=`${CLICKHOUSE_EXTRACT_CONFIG} -k tcp_port_secure 2>/dev/null`
|
||||
if [ -z ${tcp_port_secure} ]; then
|
||||
tcp_port_secure=`$CLICKHOUSE_EXTRACT_CONFIG -k tcp_port_secure 2>/dev/null`
|
||||
if [ -z $tcp_port_secure ]; then
|
||||
# Secure port disabled. Fake result
|
||||
cat $CURDIR/00505_secure.reference
|
||||
else
|
||||
# Auto port detect
|
||||
${CLICKHOUSE_CLIENT} --secure -q "SELECT 1";
|
||||
${CLICKHOUSE_CLIENT} --secure --port=${CLICKHOUSE_PORT_TCP_SECURE} -q "SELECT 2";
|
||||
|
||||
${CLICKHOUSE_CURL} -sS --insecure ${CLICKHOUSE_URL_HTTPS}?query=SELECT%203
|
||||
if [[ $CLICKHOUSE_CLIENT != *"--port"* ]]; then
|
||||
CLICKHOUSE_CLIENT_SECURE=${CLICKHOUSE_CLIENT_SECURE:="$CLICKHOUSE_CLIENT --secure --port=$CLICKHOUSE_PORT_TCP_SECURE"}
|
||||
|
||||
${CLICKHOUSE_CLIENT} --secure -q "SELECT 1";
|
||||
# Auto port detect. Cant test with re-definedvia command line ports
|
||||
$CLICKHOUSE_CLIENT --secure -q "SELECT 1";
|
||||
else
|
||||
CLICKHOUSE_CLIENT_BINARY=${CLICKHOUSE_CLIENT_BINARY:="${CLICKHOUSE_BINARY}-client"}
|
||||
CLICKHOUSE_CLIENT_SECURE=${CLICKHOUSE_CLIENT_SECURE:="$CLICKHOUSE_CLIENT_BINARY --secure --port=$CLICKHOUSE_PORT_TCP_SECURE"}
|
||||
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;"
|
||||
|
||||
# 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
|
||||
|
||||
cat $CURDIR/00505_distributed_secure.data | $CLICKHOUSE_CLIENT --secure -n -m
|
||||
fi
|
||||
|
8
debian/pbuilder-hooks/B90test-server
vendored
8
debian/pbuilder-hooks/B90test-server
vendored
@ -5,7 +5,7 @@ set -x
|
||||
TEST_CONNECT=${TEST_CONNECT=1}
|
||||
TEST_SSL=${TEST_SSL=1}
|
||||
PACKAGE_INSTALL=${PACKAGE_INSTALL=1}
|
||||
PORT_RANDOM=${PORT_RANDOM=1}
|
||||
TEST_PORT_RANDOM=${TEST_PORT_RANDOM=1}
|
||||
|
||||
if [ "${PACKAGE_INSTALL}" ]; then
|
||||
for PKG in $(ls /tmp/buildd/*.deb | sed -e's,.*/,,;s,_.*,,' ); do
|
||||
@ -25,7 +25,7 @@ fi
|
||||
|
||||
mkdir -p /etc/clickhouse-server/config.d /etc/clickhouse-client/config.d
|
||||
|
||||
if [ "${PORT_RANDOM}" ]; then
|
||||
if [ "${TEST_PORT_RANDOM}" ]; then
|
||||
CLICKHOUSE_PORT_BASE=${CLICKHOUSE_PORT_BASE:=$(( ( RANDOM % 50000 ) + 10000 ))}
|
||||
CLICKHOUSE_PORT_TCP=${CLICKHOUSE_PORT_TCP:=$(($CLICKHOUSE_PORT_BASE + 1))}
|
||||
CLICKHOUSE_PORT_HTTP=${CLICKHOUSE_PORT_HTTP:=$(($CLICKHOUSE_PORT_BASE + 2))}
|
||||
@ -41,10 +41,10 @@ export CLICKHOUSE_PORT_TCP_SECURE=${CLICKHOUSE_PORT_TCP_SECURE:=9440}
|
||||
export CLICKHOUSE_PORT_HTTPS=${CLICKHOUSE_PORT_HTTPS:=8443}
|
||||
|
||||
if [ "${TEST_CONNECT}" ]; then
|
||||
[ "${PORT_RANDOM}" ] && echo "<yandex><http_port>${CLICKHOUSE_PORT_HTTP}</http_port><tcp_port>${CLICKHOUSE_PORT_TCP}</tcp_port><interserver_http_port>${CLICKHOUSE_PORT_INTERSERVER}</interserver_http_port></yandex>" > /etc/clickhouse-server/config.d/port.xml
|
||||
[ "${TEST_PORT_RANDOM}" ] && echo "<yandex><http_port>${CLICKHOUSE_PORT_HTTP}</http_port><tcp_port>${CLICKHOUSE_PORT_TCP}</tcp_port><interserver_http_port>${CLICKHOUSE_PORT_INTERSERVER}</interserver_http_port></yandex>" > /etc/clickhouse-server/config.d/port.xml
|
||||
|
||||
if [ "${TEST_SSL}" ]; then
|
||||
[ "${PORT_RANDOM}" ] && echo "<yandex><https_port>${CLICKHOUSE_PORT_HTTPS}</https_port><tcp_port_secure>${CLICKHOUSE_PORT_TCP_SECURE}</tcp_port_secure></yandex>" > /etc/clickhouse-server/config.d/ssl.xml
|
||||
[ "${TEST_PORT_RANDOM}" ] && echo "<yandex><https_port>${CLICKHOUSE_PORT_HTTPS}</https_port><tcp_port_secure>${CLICKHOUSE_PORT_TCP_SECURE}</tcp_port_secure></yandex>" > /etc/clickhouse-server/config.d/ssl.xml
|
||||
echo "<yandex><openSSL><client><verificationMode>none</verificationMode><invalidCertificateHandler><name>AcceptCertificateHandler</name></invalidCertificateHandler></client></openSSL></yandex>" > /etc/clickhouse-client/config.d/ssl.xml
|
||||
openssl dhparam -out /etc/clickhouse-server/dhparam.pem 256
|
||||
openssl req -subj "/CN=localhost" -new -newkey rsa:2048 -days 365 -nodes -x509 -keyout /etc/clickhouse-server/server.key -out /etc/clickhouse-server/server.crt
|
||||
|
@ -37,6 +37,6 @@ cmake $CUR_DIR/../.. -DCMAKE_CXX_COMPILER=`which $DEB_CXX $CXX` -DCMAKE_C_COMPIL
|
||||
`# Skip tests:` \
|
||||
`# 00281 requires internal compiler` \
|
||||
`# 00428 requires sudo (not all vms allow this)` \
|
||||
&& ( [ ! ${TEST_RUN=1} ] || ( ( cd $CUR_DIR/../.. && env TEST_OPT="--skip long compile 00428 $TEST_OPT" TEST_PERF= bash -x dbms/tests/clickhouse-test-server ) || ${TEST_TRUE=false} ) )
|
||||
&& ( [ ! ${TEST_RUN=1} ] || ( ( cd $CUR_DIR/../.. && env TEST_OPT="--skip long compile 00428 $TEST_OPT" TEST_PORT_RANDOM= TEST_PERF= bash -x dbms/tests/clickhouse-test-server ) || ${TEST_TRUE=false} ) )
|
||||
|
||||
date
|
||||
|
@ -12,6 +12,7 @@ df -h
|
||||
date
|
||||
|
||||
env TEST_RUN=${TEST_RUN=1} \
|
||||
TEST_PORT_RANDOM= \
|
||||
`# Skip tests:` \
|
||||
`# 00281 requires internal compiler` \
|
||||
`# 00416 requires patched poco from contrib/` \
|
||||
|
Loading…
Reference in New Issue
Block a user