2022-11-17 13:41:36 +00:00
|
|
|
import os
|
|
|
|
|
|
|
|
import pytest
|
2024-09-27 10:19:39 +00:00
|
|
|
|
2022-11-17 13:41:36 +00:00
|
|
|
from helpers.cluster import ClickHouseCluster
|
2024-09-27 10:19:39 +00:00
|
|
|
from helpers.test_tools import TSV
|
2022-11-17 13:41:36 +00:00
|
|
|
|
|
|
|
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
|
|
|
|
CONFIG_DIR = os.path.join(SCRIPT_DIR, "configs")
|
|
|
|
|
|
|
|
cluster = ClickHouseCluster(__file__)
|
2022-11-17 14:46:25 +00:00
|
|
|
node = cluster.add_instance("node", main_configs=["configs/disks.xml"], stay_alive=True)
|
2022-11-17 13:41:36 +00:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
|
|
def started_cluster():
|
|
|
|
try:
|
|
|
|
cluster.start()
|
|
|
|
yield cluster
|
|
|
|
finally:
|
|
|
|
cluster.shutdown()
|
|
|
|
|
|
|
|
|
|
|
|
def test_storage_policy_configuration_change(started_cluster):
|
2022-11-17 14:46:25 +00:00
|
|
|
node.query(
|
|
|
|
"CREATE TABLE a (x UInt64) ENGINE = MergeTree ORDER BY x SETTINGS storage_policy = 'test_policy'"
|
|
|
|
)
|
2022-11-17 13:41:36 +00:00
|
|
|
|
|
|
|
node.stop_clickhouse()
|
2022-11-17 14:46:25 +00:00
|
|
|
node.copy_file_to_container(
|
|
|
|
os.path.join(CONFIG_DIR, "disk2_only.xml"),
|
|
|
|
"/etc/clickhouse-server/config.d/disks.xml",
|
|
|
|
)
|
2022-11-17 13:41:36 +00:00
|
|
|
node.start_clickhouse()
|
|
|
|
|
|
|
|
node.stop_clickhouse()
|
2022-11-17 14:46:25 +00:00
|
|
|
node.copy_file_to_container(
|
|
|
|
os.path.join(CONFIG_DIR, "disks.xml"),
|
|
|
|
"/etc/clickhouse-server/config.d/disks.xml",
|
|
|
|
)
|
2022-11-17 13:41:36 +00:00
|
|
|
node.start_clickhouse()
|