Do not require the server to fail to start in the test.

This commit is contained in:
Sergey V. Galtsev 2018-12-20 01:47:42 +03:00
parent a2042d60bf
commit fb5dbb7959
2 changed files with 8 additions and 5 deletions

View File

@ -7,6 +7,9 @@
<stdout>/var/log/clickhouse-server/stdout.log</stdout>
</logger>
<tcp_port>9000</tcp_port>
<listen_host>127.0.0.1</listen_host>
<path>/var/lib/clickhouse/</path>
<mark_cache_size>5368709120</mark_cache_size>

View File

@ -13,16 +13,16 @@ def test_different_user():
if current_user_id != 0:
return
other_user_id = pwd.getpwnam('nobody').pw_uid
cluster = ClickHouseCluster(__file__)
node = cluster.add_instance('node')
with pytest.raises(Exception):
cluster.start()
other_user_id = pwd.getpwnam('nobody').pw_uid
cluster.start()
docker_api = docker.from_env().api
container = node.get_docker_handle()
container.stop()
container.start()
container.exec_run('chown {} /var/lib/clickhouse'.format(other_user_id), privileged=True)
container.exec_run(CLICKHOUSE_START_COMMAND)
@ -30,8 +30,8 @@ def test_different_user():
cluster.shutdown() # cleanup
with open(os.path.join(node.path, 'logs/clickhouse-server.err.log')) as log:
expected_message = "Effective user of the process \(.*\) does not match the owner of the data \(.*\)\. Run under 'sudo -u .*'\."
last_message = log.readlines()[-1].strip()
expected_message = 'Effective user of the process \(.*\) does not match the owner of the data \(.*\)'
if re.search(expected_message, last_message) is None:
pytest.fail('Expected the server to fail with a message "{}", but the last message is "{}"'.format(expected_message, last_message))