ClickHouse/tests/integration/test_storage_policies/test.py

42 lines
1.1 KiB
Python
Raw Normal View History

import os
import pytest
2024-09-27 10:19:39 +00:00
from helpers.cluster import ClickHouseCluster
2024-09-27 10:19:39 +00:00
from helpers.test_tools import TSV
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)
@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'"
)
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",
)
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",
)
node.start_clickhouse()