mirror of
https://github.com/hanzoai/datastore.git
synced 2026-09-26 13:55:07 +00:00
Resolve conflicts from the Ruff cleanup against master: - `test_move_ttl_broken_compatibility`, `test_session_settings_table`, `test_replicated_database/test_settings_recover_lost_replica`, and `test_storage_s3_queue/test_migration` were deleted on master; keep the deletions (the branch only applied import cleanups to them). - `test_storage_s3_queue/test_3` (`test_upgrade`, `test_upgrade_2`) and `test_storage_s3_queue/test_5` (`test_upgrade_3`) were removed on master after bumping `CLICKHOUSE_CI_MIN_TESTED_VERSION`; keep the removals and drop the now-unused `import uuid` in `test_3`. - `test_storage_delta`/`test_storage_s3`: keep master's imports that are now used (`CLICKHOUSE_CI_MIN_TESTED_VERSION`), drop the genuinely unused ones (`helpers.client` in delta, `ClickHouseInstance` in s3) to satisfy F401. - `test_const_node_optimization`: master switched to `tag=CLICKHOUSE_CI_MIN_TESTED_VERSION`, so restore that import that the branch had removed when the tag was hardcoded. `ruff check .` passes cleanly after the merge. Co-Authored-By: Claude Opus 4.8 <[email protected]>
50 lines
1.3 KiB
Python
50 lines
1.3 KiB
Python
import random
|
|
import string
|
|
|
|
import pytest
|
|
|
|
from helpers.cluster import ClickHouseCluster, QueryRuntimeException
|
|
|
|
DATABASE_NAME_LENGTH = 5
|
|
LARGE_TABLE_NAME_LENGTH = 211
|
|
|
|
|
|
cluster = ClickHouseCluster(__file__)
|
|
new_node = cluster.add_instance(
|
|
"new_node",
|
|
with_zookeeper=True,
|
|
)
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
def start_cluster():
|
|
try:
|
|
cluster.start()
|
|
yield cluster
|
|
finally:
|
|
cluster.shutdown()
|
|
|
|
|
|
def generate_random_name(length):
|
|
return ''.join(random.choice(string.ascii_letters) for _ in range(length))
|
|
|
|
|
|
def test_check_table_name_length(start_cluster):
|
|
"""
|
|
Verify that the new node gets error trying to create a table with name that is too long.
|
|
"""
|
|
|
|
db_name = generate_random_name(DATABASE_NAME_LENGTH)
|
|
table_name = generate_random_name(LARGE_TABLE_NAME_LENGTH)
|
|
|
|
# create database
|
|
new_node.query(f"DROP DATABASE IF EXISTS {db_name} SYNC")
|
|
new_node.query(
|
|
f"CREATE DATABASE {db_name} ENGINE = Replicated('/test/{db_name}', 'shard1', 'replica' || '1');"
|
|
)
|
|
|
|
# try to create table with long name
|
|
new_node.query(f"DROP TABLE IF EXISTS {db_name}.{table_name}")
|
|
with pytest.raises(QueryRuntimeException, match="ARGUMENT_OUT_OF_BOUND"):
|
|
new_node.query(f"CREATE TABLE {db_name}.{table_name} (col String) Engine=MergeTree ORDER BY tuple()")
|