2020-07-08 08:41:39 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2020-10-21 20:11:35 +00:00
|
|
|
# fail on errors, verbose and export all env variables
|
|
|
|
set -e -x -a
|
2020-07-08 08:41:39 +00:00
|
|
|
|
|
|
|
dpkg -i package_folder/clickhouse-common-static_*.deb
|
|
|
|
dpkg -i package_folder/clickhouse-common-static-dbg_*.deb
|
|
|
|
dpkg -i package_folder/clickhouse-server_*.deb
|
|
|
|
dpkg -i package_folder/clickhouse-client_*.deb
|
|
|
|
dpkg -i package_folder/clickhouse-test_*.deb
|
|
|
|
|
2020-09-24 08:18:36 +00:00
|
|
|
# install test configs
|
|
|
|
/usr/share/clickhouse-test/config/install.sh
|
2021-03-13 01:25:13 +00:00
|
|
|
#cp /use_test_keeper.xml /etc/clickhouse-server/config.d/zookeeper.xml
|
|
|
|
#cp /enable_test_keeper1.xml /etc/clickhouse-server/config.d/test_keeper_port.xml
|
|
|
|
#cp /clusters2.xml /etc/clickhouse-server/config.d/
|
|
|
|
|
|
|
|
#mkdir /etc/clickhouse-server2
|
|
|
|
#chown clickhouse /etc/clickhouse-server2
|
|
|
|
#chgrp clickhouse /etc/clickhouse-server2
|
|
|
|
#sudo -u clickhouse cp -r /etc/clickhouse-server/* /etc/clickhouse-server2
|
|
|
|
#rm /etc/clickhouse-server2/config.d/macros.xml
|
|
|
|
#sudo -u clickhouse cat /etc/clickhouse-server/config.d/macros.xml | sed "s|<replica>r1</replica>|<replica>r2</replica>|" > /etc/clickhouse-server2/config.d/macros.xml
|
|
|
|
|
|
|
|
#cat /usr/bin/clickhouse-test | sed "s| ENGINE=Replicated('/test/clickhouse/db/{}', 's1', 'r1')| ON CLUSTER test_cluster_database_replicated ENGINE=Replicated('/test/clickhouse/db/{}', '{{shard}}', '{{replica}}')|" > /usr/bin/clickhouse-test-tmp
|
|
|
|
#mv /usr/bin/clickhouse-test-tmp /usr/bin/clickhouse-test
|
|
|
|
#chmod a+x /usr/bin/clickhouse-test
|
2020-07-08 08:41:39 +00:00
|
|
|
|
2020-12-21 10:06:36 +00:00
|
|
|
# For flaky check we also enable thread fuzzer
|
|
|
|
if [ "$NUM_TRIES" -gt "1" ]; then
|
|
|
|
export THREAD_FUZZER_CPU_TIME_PERIOD_US=1000
|
|
|
|
export THREAD_FUZZER_SLEEP_PROBABILITY=0.1
|
|
|
|
export THREAD_FUZZER_SLEEP_TIME_US=100000
|
2020-12-21 20:24:16 +00:00
|
|
|
|
|
|
|
export THREAD_FUZZER_pthread_mutex_lock_BEFORE_MIGRATE_PROBABILITY=1
|
|
|
|
export THREAD_FUZZER_pthread_mutex_lock_AFTER_MIGRATE_PROBABILITY=1
|
|
|
|
export THREAD_FUZZER_pthread_mutex_unlock_BEFORE_MIGRATE_PROBABILITY=1
|
|
|
|
export THREAD_FUZZER_pthread_mutex_unlock_AFTER_MIGRATE_PROBABILITY=1
|
|
|
|
|
|
|
|
export THREAD_FUZZER_pthread_mutex_lock_BEFORE_SLEEP_PROBABILITY=0.001
|
|
|
|
export THREAD_FUZZER_pthread_mutex_lock_AFTER_SLEEP_PROBABILITY=0.001
|
|
|
|
export THREAD_FUZZER_pthread_mutex_unlock_BEFORE_SLEEP_PROBABILITY=0.001
|
|
|
|
export THREAD_FUZZER_pthread_mutex_unlock_AFTER_SLEEP_PROBABILITY=0.001
|
|
|
|
export THREAD_FUZZER_pthread_mutex_lock_BEFORE_SLEEP_TIME_US=10000
|
|
|
|
export THREAD_FUZZER_pthread_mutex_lock_AFTER_SLEEP_TIME_US=10000
|
|
|
|
export THREAD_FUZZER_pthread_mutex_unlock_BEFORE_SLEEP_TIME_US=10000
|
|
|
|
export THREAD_FUZZER_pthread_mutex_unlock_AFTER_SLEEP_TIME_US=10000
|
|
|
|
|
2020-12-21 10:06:36 +00:00
|
|
|
# simpliest way to forward env variables to server
|
2020-12-21 20:09:32 +00:00
|
|
|
sudo -E -u clickhouse /usr/bin/clickhouse-server --config /etc/clickhouse-server/config.xml --daemon
|
2020-12-21 10:06:36 +00:00
|
|
|
else
|
2021-03-13 01:25:13 +00:00
|
|
|
service clickhouse-server start
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -n "$USE_DATABASE_REPLICATED" ]] && [[ "$USE_DATABASE_REPLICATED" -eq 1 ]]; then
|
|
|
|
# There is a bug in config reloading, so we cannot override macros using --macros.replica r2
|
|
|
|
# And we have to copy configs...
|
|
|
|
mkdir /etc/clickhouse-server2
|
|
|
|
chown clickhouse /etc/clickhouse-server2
|
|
|
|
chgrp clickhouse /etc/clickhouse-server2
|
|
|
|
sudo -u clickhouse cp -r /etc/clickhouse-server/* /etc/clickhouse-server2
|
|
|
|
rm /etc/clickhouse-server2/config.d/macros.xml
|
|
|
|
sudo -u clickhouse cat /etc/clickhouse-server/config.d/macros.xml | sed "s|<replica>r1</replica>|<replica>r2</replica>|" > /etc/clickhouse-server2/config.d/macros.xml
|
|
|
|
|
|
|
|
sudo mkdir /var/lib/clickhouse2
|
|
|
|
sudo chmod a=rwx /var/lib/clickhouse2
|
|
|
|
sudo -E -u clickhouse /usr/bin/clickhouse-server --config /etc/clickhouse-server2/config.xml --daemon \
|
|
|
|
-- --path /var/lib/clickhouse2/ --logger.stderr /var/log/clickhouse-server/stderr2.log \
|
|
|
|
--logger.log /var/log/clickhouse-server/clickhouse-server2.log --logger.errorlog /var/log/clickhouse-server/clickhouse-server2.err.log \
|
|
|
|
--tcp_port 19000 --tcp_port_secure 19440 --http_port 18123 --https_port 18443 --interserver_http_port 19009 --tcp_with_proxy_port 19010 \
|
|
|
|
--mysql_port 19004 \
|
|
|
|
--test_keeper_server.tcp_port 19181 --test_keeper_server.server_id 2 \
|
|
|
|
--macros.replica r2 # It doesn't work :(
|
2020-12-21 10:06:36 +00:00
|
|
|
fi
|
2020-07-08 08:41:39 +00:00
|
|
|
|
2021-03-13 01:25:13 +00:00
|
|
|
sleep 5
|
|
|
|
|
2020-09-30 17:06:14 +00:00
|
|
|
if grep -q -- "--use-skip-list" /usr/bin/clickhouse-test; then
|
2020-07-08 08:41:39 +00:00
|
|
|
SKIP_LIST_OPT="--use-skip-list"
|
|
|
|
fi
|
|
|
|
|
2020-09-29 09:44:28 +00:00
|
|
|
function run_tests()
|
|
|
|
{
|
2020-10-22 14:33:23 +00:00
|
|
|
# We can have several additional options so we path them as array because it's
|
|
|
|
# more idiologically correct.
|
|
|
|
read -ra ADDITIONAL_OPTIONS <<< "${ADDITIONAL_OPTIONS:-}"
|
2020-10-23 10:18:06 +00:00
|
|
|
|
|
|
|
# Skip these tests, because they fail when we rerun them multiple times
|
|
|
|
if [ "$NUM_TRIES" -gt "1" ]; then
|
|
|
|
ADDITIONAL_OPTIONS+=('--skip')
|
2020-10-23 12:32:57 +00:00
|
|
|
ADDITIONAL_OPTIONS+=('00000_no_tests_to_skip')
|
2021-01-29 12:51:10 +00:00
|
|
|
ADDITIONAL_OPTIONS+=('--jobs')
|
|
|
|
ADDITIONAL_OPTIONS+=('4')
|
2020-10-23 10:18:06 +00:00
|
|
|
fi
|
|
|
|
|
2021-02-15 10:26:34 +00:00
|
|
|
if [[ -n "$USE_DATABASE_REPLICATED" ]] && [[ "$USE_DATABASE_REPLICATED" -eq 1 ]]; then
|
|
|
|
ADDITIONAL_OPTIONS+=('--replicated-database')
|
|
|
|
fi
|
|
|
|
|
2021-01-27 15:24:39 +00:00
|
|
|
clickhouse-test --testname --shard --zookeeper --hung-check --print-time \
|
2021-01-29 12:51:10 +00:00
|
|
|
--test-runs "$NUM_TRIES" \
|
2021-01-27 15:24:39 +00:00
|
|
|
"$SKIP_LIST_OPT" "${ADDITIONAL_OPTIONS[@]}" 2>&1 \
|
|
|
|
| ts '%Y-%m-%d %H:%M:%S' \
|
|
|
|
| tee -a test_output/test_result.txt
|
2020-09-29 09:44:28 +00:00
|
|
|
}
|
|
|
|
|
2021-03-13 01:25:13 +00:00
|
|
|
#clickhouse-client --port 9000 -q "SELECT * FROM system.macros"
|
|
|
|
#clickhouse-client --port 19000 -q "SELECT * FROM system.macros"
|
|
|
|
#clickhouse-client --port 19000 -q "SELECT 2"
|
|
|
|
|
2020-09-29 09:44:28 +00:00
|
|
|
export -f run_tests
|
|
|
|
|
2020-12-28 11:46:53 +00:00
|
|
|
timeout "$MAX_RUN_TIME" bash -c run_tests ||:
|
2021-01-14 10:42:51 +00:00
|
|
|
|
2021-02-22 13:53:43 +00:00
|
|
|
./process_functional_tests_result.py || echo -e "failure\tCannot parse results" > /test_output/check_status.tsv
|
2021-02-20 20:04:24 +00:00
|
|
|
|
2021-02-22 13:53:43 +00:00
|
|
|
pigz < /var/log/clickhouse-server/clickhouse-server.log > /test_output/clickhouse-server.log.gz ||:
|
|
|
|
mv /var/log/clickhouse-server/stderr.log /test_output/ ||:
|
|
|
|
if [[ -n "$WITH_COVERAGE" ]] && [[ "$WITH_COVERAGE" -eq 1 ]]; then
|
|
|
|
tar -chf /test_output/clickhouse_coverage.tar.gz /profraw ||:
|
|
|
|
fi
|
2021-01-14 21:18:50 +00:00
|
|
|
tar -chf /test_output/text_log_dump.tar /var/lib/clickhouse/data/system/text_log ||:
|
2021-01-15 07:53:37 +00:00
|
|
|
tar -chf /test_output/query_log_dump.tar /var/lib/clickhouse/data/system/query_log ||:
|
2021-03-13 01:25:13 +00:00
|
|
|
|
|
|
|
if [[ -n "$USE_DATABASE_REPLICATED" ]] && [[ "$USE_DATABASE_REPLICATED" -eq 1 ]]; then
|
|
|
|
pigz < /var/log/clickhouse-server/clickhouse-server2.log > /test_output/clickhouse-server2.log.gz ||:
|
|
|
|
mv /var/log/clickhouse-server/stderr2.log /test_output/ ||:
|
|
|
|
fi
|