ClickHouse/tests/integration/test_merge_tree_settings_constraints/test.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

50 lines
1.6 KiB
Python
Raw Normal View History

2022-12-07 20:16:10 +00:00
import asyncio
import os.path
2024-09-27 10:19:39 +00:00
import random
import re
import pytest
2022-12-07 20:16:10 +00:00
from helpers.cluster import ClickHouseCluster
2024-09-27 10:19:39 +00:00
from helpers.test_tools import TSV, assert_eq_with_retry
2022-12-07 20:16:10 +00:00
cluster = ClickHouseCluster(__file__)
instance = cluster.add_instance("instance", user_configs=["users.xml"])
@pytest.fixture(scope="module", autouse=True)
def start_cluster():
try:
cluster.start()
yield cluster
finally:
cluster.shutdown()
def test_merge_tree_settings_constraints():
2022-12-07 20:36:04 +00:00
assert "Setting storage_policy should not be changed" in instance.query_and_get_error(
f"CREATE TABLE wrong_table (number Int64) engine = MergeTree() ORDER BY number SETTINGS storage_policy = 'secret_policy'"
)
2022-12-07 20:16:10 +00:00
expected_error = "Setting min_bytes_for_wide_part should"
assert expected_error in instance.query_and_get_error(
f"CREATE TABLE wrong_table (number Int64) engine = MergeTree() ORDER BY number SETTINGS min_bytes_for_wide_part = 100"
)
assert expected_error in instance.query_and_get_error(
f"CREATE TABLE wrong_table (number Int64) engine = MergeTree() ORDER BY number SETTINGS min_bytes_for_wide_part = 1000000000"
)
instance.query(
f"CREATE TABLE good_table (number Int64) engine = MergeTree() ORDER BY number SETTINGS min_bytes_for_wide_part = 10000000"
)
assert expected_error in instance.query_and_get_error(
f"ALTER TABLE good_table MODIFY SETTING min_bytes_for_wide_part = 100"
)
assert expected_error in instance.query_and_get_error(
f"ALTER TABLE good_table MODIFY SETTING min_bytes_for_wide_part = 1000000000"
)