From: Anton Yuzhaninov Date: Thu, 20 Jun 2019 17:27:12 +0000 (+0100) Subject: [Minor] Fix ClickHouse test after upgrade X-Git-Tag: 2.0~756^2~2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=bf20478dd5e5dfd80cdcbe0bed7242b008fa518b;p=rspamd.git [Minor] Fix ClickHouse test after upgrade Current ClickHouse version refuses to run from root if data directory is not owned by root. Run it from user clickhouse as it supposed to be run. Also cleanup ClickHouse config (some options prevented it to start, others just unnecessary). --- diff --git a/test/functional/cases/210_clickhouse/001_migration.robot b/test/functional/cases/210_clickhouse/001_migration.robot index d1b357415..9ee526c6c 100644 --- a/test/functional/cases/210_clickhouse/001_migration.robot +++ b/test/functional/cases/210_clickhouse/001_migration.robot @@ -63,10 +63,10 @@ Clickhouse Setup ${config} = Replace Variables ${template} Create File ${TMPDIR}/clickhouse-config.xml ${config} Copy File ${TESTDIR}/configs/clickhouse-users.xml ${TMPDIR}/users.xml - Create Directory ${TMPDIR}/metadata - Create Directory ${TMPDIR}/metadata/default - Create Directory ${TMPDIR}/data/default - ${result} = Run Process clickhouse-server --daemon --config-file\=${TMPDIR}/clickhouse-config.xml --pid-file\=${TMPDIR}/clickhouse.pid + Create Directory ${TMPDIR}/clickhouse + Set Directory Ownership ${TMPDIR}/clickhouse clickhouse clickhouse + ${result} = Run Process + ... su -s /bin/sh clickhouse -c clickhouse-server --daemon --config-file\=${TMPDIR}/clickhouse-config.xml --pid-file\=${TMPDIR}/clickhouse/clickhouse.pid Run Keyword If ${result.rc} != 0 Log ${result.stderr} Should Be Equal As Integers ${result.rc} 0 Wait Until Keyword Succeeds 5 sec 50 ms TCP Connect localhost ${CLICKHOUSE_PORT} @@ -76,7 +76,7 @@ Clickhouse Setup Clickhosue Teardown # Sleep 30 - ${clickhouse_pid} = Get File ${TMPDIR}/clickhouse.pid + ${clickhouse_pid} = Get File ${TMPDIR}/clickhouse/clickhouse.pid Shutdown Process With Children ${clickhouse_pid} Simple Teardown diff --git a/test/functional/configs/clickhouse-config.xml b/test/functional/configs/clickhouse-config.xml index b210748ba..30f556f0c 100644 --- a/test/functional/configs/clickhouse-config.xml +++ b/test/functional/configs/clickhouse-config.xml @@ -2,53 +2,20 @@ - trace - ${TMPDIR}/clickhouse-server.log - ${TMPDIR}/clickhouse-server.err.log + debug + ${TMPDIR}/clickhouse/clickhouse-server.log + ${TMPDIR}/clickhouse/clickhouse-server.err.log 1000M 10 - - ${CLICKHOUSE_PORT} - 19000 - - - - - - - - - 19009 - - - - - - - - - - - - + ${CLICKHOUSE_PORT} + + + ${TMPDIR}/users.xml - @@ -63,31 +30,14 @@ correct maximum value. --> 256 - - 8589934592 - 5368709120 - - ${TMPDIR}/ - - - ${TMPDIR} - - - ${TMPDIR} - - - ${TMPDIR}/users.xml + ${TMPDIR}/clickhouse/ default @@ -117,226 +67,4 @@ --> - - - - - - - - - - - - - - - 3600 - - - - 3600 - - - 60 - - - - - - - - - - system - query_log
- - toYYYYMM(event_date) - - 7500 -
- - - - - - - - - - - - - - - - *_dictionary.xml - - - - - - - - - - /clickhouse/task_queue/ddl - - - - - - - - - - - - - - - click_cost - any - - 0 - 3600 - - - 86400 - 60 - - - - max - - 0 - 60 - - - 3600 - 300 - - - 86400 - 3600 - - - - - - /var/lib/clickhouse/format_schemas/ - - -
diff --git a/test/functional/lib/rspamd.py b/test/functional/lib/rspamd.py index ee76a9b45..9f7176ca9 100644 --- a/test/functional/lib/rspamd.py +++ b/test/functional/lib/rspamd.py @@ -102,7 +102,14 @@ def HTTP(method, host, port, path, data=None, headers={}): return [s, t] def make_temporary_directory(): - return tempfile.mkdtemp() + """Creates and returns a unique temporary directory + + Example: + | ${TMPDIR} = | Make Temporary Directory | + """ + dirname = tempfile.mkdtemp() + os.chmod(dirname, 0755) + return dirname def make_temporary_file(): return tempfile.mktemp() diff --git a/test/functional/lib/rspamd.robot b/test/functional/lib/rspamd.robot index 7572e78a4..1e18a61a8 100644 --- a/test/functional/lib/rspamd.robot +++ b/test/functional/lib/rspamd.robot @@ -71,7 +71,7 @@ Generic Teardown Run Keyword If '${CONTROLLER_ERRORS}' == 'True' Check Controller Errors Shutdown Process With Children ${RSPAMD_PID} Log does not contain segfault record - Save Run Results ${TMPDIR} rspamd.log redis.log rspamd.conf clickhouse-server.log clickhouse-server.err.log clickhouse-config.xml + Save Run Results ${TMPDIR} rspamd.log redis.log rspamd.conf clickhouse-config.xml Collect Lua Coverage Cleanup Temporary Directory ${TMPDIR}