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.

49 lines
1.6 KiB
Python
Raw Normal View History

2022-12-07 20:16:10 +00:00
import pytest
import asyncio
import re
import random
import os.path
from helpers.cluster import ClickHouseCluster
from helpers.test_tools import assert_eq_with_retry, TSV
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"
)