mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 08:32:02 +00:00
Add test for user directories.
This commit is contained in:
parent
29a6558d33
commit
e6c6f904bb
0
tests/integration/test_user_directories/__init__.py
Normal file
0
tests/integration/test_user_directories/__init__.py
Normal file
@ -0,0 +1,15 @@
|
||||
<yandex>
|
||||
<user_directories replace="replace">
|
||||
<users_xml>
|
||||
<path>/etc/clickhouse-server/users3.xml</path>
|
||||
</users_xml>
|
||||
<local_directory>
|
||||
<path>/var/lib/clickhouse/access3/</path>
|
||||
</local_directory>
|
||||
<local_directory>
|
||||
<name>local directory (ro)</name>
|
||||
<readonly>true</readonly>
|
||||
<path>/var/lib/clickhouse/access3-ro/</path>
|
||||
</local_directory>
|
||||
</user_directories>
|
||||
</yandex>
|
@ -0,0 +1,8 @@
|
||||
<yandex>
|
||||
<user_directories replace="replace">
|
||||
<users_xml>
|
||||
<path>/etc/clickhouse-server/users5.xml</path>
|
||||
</users_xml>
|
||||
<memory/>
|
||||
</user_directories>
|
||||
</yandex>
|
@ -0,0 +1,5 @@
|
||||
<yandex>
|
||||
<users_config>/etc/clickhouse-server/users2.xml</users_config>
|
||||
<access_control_path>/var/lib/clickhouse/access2/</access_control_path>
|
||||
<user_directories remove="remove"/>
|
||||
</yandex>
|
@ -0,0 +1,7 @@
|
||||
<yandex>
|
||||
<user_directories replace="replace">
|
||||
<users_xml>
|
||||
<path>users4.xml</path>
|
||||
</users_xml>
|
||||
</user_directories>
|
||||
</yandex>
|
51
tests/integration/test_user_directories/test.py
Normal file
51
tests/integration/test_user_directories/test.py
Normal file
@ -0,0 +1,51 @@
|
||||
import pytest
|
||||
import os
|
||||
from helpers.cluster import ClickHouseCluster
|
||||
from helpers.test_tools import TSV
|
||||
|
||||
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
|
||||
cluster = ClickHouseCluster(__file__)
|
||||
node = cluster.add_instance('node', stay_alive=True)
|
||||
|
||||
@pytest.fixture(scope="module", autouse=True)
|
||||
def started_cluster():
|
||||
try:
|
||||
cluster.start()
|
||||
|
||||
node.exec_in_container("cp /etc/clickhouse-server/users.xml /etc/clickhouse-server/users2.xml")
|
||||
node.exec_in_container("cp /etc/clickhouse-server/users.xml /etc/clickhouse-server/users3.xml")
|
||||
node.exec_in_container("cp /etc/clickhouse-server/users.xml /etc/clickhouse-server/users4.xml")
|
||||
node.exec_in_container("cp /etc/clickhouse-server/users.xml /etc/clickhouse-server/users5.xml")
|
||||
|
||||
yield cluster
|
||||
|
||||
finally:
|
||||
cluster.shutdown()
|
||||
|
||||
|
||||
def test_old_style():
|
||||
node.copy_file_to_container(os.path.join(SCRIPT_DIR, "configs/old_style.xml"), '/etc/clickhouse-server/config.d/z.xml')
|
||||
node.restart_clickhouse()
|
||||
assert node.query("SELECT * FROM system.user_directories") == TSV([["users.xml", "users.xml", "/etc/clickhouse-server/users2.xml", 1, 1],
|
||||
["local directory", "local directory", "/var/lib/clickhouse/access2/", 0, 2]])
|
||||
|
||||
|
||||
def test_local_directories():
|
||||
node.copy_file_to_container(os.path.join(SCRIPT_DIR, "configs/local_directories.xml"), '/etc/clickhouse-server/config.d/z.xml')
|
||||
node.restart_clickhouse()
|
||||
assert node.query("SELECT * FROM system.user_directories") == TSV([["users.xml", "users.xml", "/etc/clickhouse-server/users3.xml", 1, 1],
|
||||
["local directory", "local directory", "/var/lib/clickhouse/access3/", 0, 2],
|
||||
["local directory (ro)", "local directory", "/var/lib/clickhouse/access3-ro/", 1, 3]])
|
||||
|
||||
|
||||
def test_relative_path():
|
||||
node.copy_file_to_container(os.path.join(SCRIPT_DIR, "configs/relative_path.xml"), '/etc/clickhouse-server/config.d/z.xml')
|
||||
node.restart_clickhouse()
|
||||
assert node.query("SELECT * FROM system.user_directories") == TSV([["users.xml", "users.xml", "/etc/clickhouse-server/users4.xml", 1, 1]])
|
||||
|
||||
|
||||
def test_memory():
|
||||
node.copy_file_to_container(os.path.join(SCRIPT_DIR, "configs/memory.xml"), '/etc/clickhouse-server/config.d/z.xml')
|
||||
node.restart_clickhouse()
|
||||
assert node.query("SELECT * FROM system.user_directories") == TSV([["users.xml", "users.xml", "/etc/clickhouse-server/users5.xml", 1, 1],
|
||||
["memory", "memory", "", 0, 2]])
|
Loading…
Reference in New Issue
Block a user