Check current user from env in test_user_zero_database_access

This commit is contained in:
Vladimir C 2022-03-02 13:49:12 +01:00 committed by GitHub
parent 43ac214dc5
commit 9e81bd395a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -72,13 +72,15 @@ def test_user_zero_database_access(start_cluster):
assert False, "user with full access rights can't drop database test2" assert False, "user with full access rights can't drop database test2"
try: try:
node.exec_in_container( name = node.exec_in_container(
["bash", "-c", "export CLICKHOUSE_USER=env_user_not_with_password && /usr/bin/clickhouse client --query 'SELECT 1'"], user='root') ["bash", "-c", "export CLICKHOUSE_USER=env_user_not_with_password && /usr/bin/clickhouse client --query 'SELECT currentUser()'"], user='root')
assert name.strip() == "env_user_not_with_password"
except Exception as ex: except Exception as ex:
assert False, "set env CLICKHOUSE_USER can not connect server" assert False, "set env CLICKHOUSE_USER can not connect server"
try: try:
node.exec_in_container( name = node.exec_in_container(
["bash", "-c", "export CLICKHOUSE_USER=env_user_with_password && export CLICKHOUSE_PASSWORD=clickhouse && /usr/bin/clickhouse client --query 'SELECT 1'"], user='root') ["bash", "-c", "export CLICKHOUSE_USER=env_user_with_password && export CLICKHOUSE_PASSWORD=clickhouse && /usr/bin/clickhouse client --query 'SELECT currentUser()'"], user='root')
assert name.strip() == "env_user_with_password"
except Exception as ex: except Exception as ex:
assert False, "set env CLICKHOUSE_USER CLICKHOUSE_PASSWORD can not connect server" assert False, "set env CLICKHOUSE_USER CLICKHOUSE_PASSWORD can not connect server"