From c3f7ecdceb537e58d067a6e919d380349fd81f9e Mon Sep 17 00:00:00 2001 From: strtgbb <146047128+strtgbb@users.noreply.github.com> Date: Tue, 20 Jan 2026 14:01:48 -0500 Subject: [PATCH] revert erroneously included tests --- .../test_distributed_format/test.py | 69 ------------------- .../integration/test_dot_in_user_name/test.py | 35 ---------- .../test_sql_user_impersonate/test.py | 46 ------------- 3 files changed, 150 deletions(-) delete mode 100644 tests/integration/test_dot_in_user_name/test.py delete mode 100644 tests/integration/test_sql_user_impersonate/test.py diff --git a/tests/integration/test_distributed_format/test.py b/tests/integration/test_distributed_format/test.py index 5c819a6eba23..a7cf21c4d2e3 100644 --- a/tests/integration/test_distributed_format/test.py +++ b/tests/integration/test_distributed_format/test.py @@ -213,72 +213,3 @@ def test_remove_replica(started_cluster): "/etc/clickhouse-server/config.d/another_remote_servers.xml", ] ) - -def test_invalid_shard_directory_format(started_cluster): - """ - Test that ClickHouse doesn't crash when it encounters - a malformed directory name like 'shard1_all_replicas_bkp' - during distributed table initialization. - """ - node.query("drop table if exists test.dist_invalid sync") - node.query("drop table if exists test.local_invalid sync") - node.query( - "create table test.local_invalid (x UInt64, s String) engine = MergeTree order by x" - ) - node.query( - "create table test.dist_invalid (x UInt64, s String) " - "engine = Distributed('test_cluster_internal_replication', test, local_invalid)" - ) - - node.query( - "insert into test.dist_invalid values (1, 'a'), (2, 'bb')", - settings={"use_compact_format_in_distributed_parts_names": "1"}, - ) - - data_path = node.query( - "SELECT arrayElement(data_paths, 1) FROM system.tables " - "WHERE database='test' AND name='dist_invalid'" - ).strip() - - # Create a malformed directory that would cause the bug - malformed_dir = f"{data_path}/shard1_all_replicas_bkp" - node.exec_in_container(["mkdir", "-p", malformed_dir]) - - # Create a dummy file so the directory isn't considered empty - node.exec_in_container(["touch", f"{malformed_dir}/dummy.txt"]) - - invalid_formats = [ - "shard1_all_replicas_backup", - "shard1_all_replicas_old", - "shard2_all_replicas_tmp", - ] - for invalid_dir in invalid_formats: - invalid_path = f"{data_path}/{invalid_dir}" - node.exec_in_container(["mkdir", "-p", invalid_path]) - # just dummy file to have something in the directory - node.exec_in_container(["touch", f"{invalid_path}/dummy.txt"]) - - # Reproduce server restart with detach and attach - node.query("detach table test.dist_invalid") - node.query("attach table test.dist_invalid") - - node.query("SYSTEM FLUSH LOGS system.text_log") - - error_logs = node.query( - """ - SELECT count() - FROM system.text_log - WHERE level = 'Error' - AND message LIKE '%Invalid replica_index%' - AND message LIKE '%shard1_all_replicas%' - """ - ).strip() - - # We should have at least one error log for each malformed directory - # But we don't strictly require this in case logging is disabled - # The important thing is that the server didn't crash - print(f"Found {error_logs} error log entries for invalid directories") - - # Clean up - node.query("drop table test.dist_invalid sync") - node.query("drop table test.local_invalid sync") diff --git a/tests/integration/test_dot_in_user_name/test.py b/tests/integration/test_dot_in_user_name/test.py deleted file mode 100644 index 1719c38d1092..000000000000 --- a/tests/integration/test_dot_in_user_name/test.py +++ /dev/null @@ -1,35 +0,0 @@ -import pytest - -from helpers.cluster import ClickHouseCluster - -cluster = ClickHouseCluster(__file__) -node = cluster.add_instance( - "node", - user_configs=[ - "configs/users.xml", - ], -) - - -@pytest.fixture(scope="module", autouse=True) -def started_cluster(): - try: - cluster.start() - yield cluster - finally: - cluster.shutdown() - - -def test_user_with_dot_in_name(): - assert node.query("SELECT count()>0 FROM system.users where name = 'user.name'") == "1\n" - assert node.query("SELECT count()>0 FROM system.users where name = 'user\\.name'") == "0\n" - - node.query("DROP USER IF EXISTS 'foo.bar'") - node.query("CREATE USER 'foo.bar'") - assert node.query("SELECT count()>0 FROM system.users where name = 'foo.bar'") == "1\n" - assert node.query("SELECT count()>0 FROM system.users where name = 'foo\\.bar'") == "0\n" - - node.query("ALTER USER 'foo.bar' RENAME TO 'foo\\.bar'") - assert node.query("SELECT count()>0 FROM system.users where name = 'foo.bar'") == "0\n" - assert node.query("SELECT count()>0 FROM system.users where name = 'foo\\.bar'") == "1\n" - node.query("DROP USER 'foo\\.bar'") diff --git a/tests/integration/test_sql_user_impersonate/test.py b/tests/integration/test_sql_user_impersonate/test.py deleted file mode 100644 index 917826ce25e1..000000000000 --- a/tests/integration/test_sql_user_impersonate/test.py +++ /dev/null @@ -1,46 +0,0 @@ -import pytest - -from helpers.cluster import ClickHouseCluster, ClickHouseInstance - -cluster = ClickHouseCluster(__file__) - -node = cluster.add_instance( - "node" -) - -@pytest.fixture(scope="module", autouse=True) -def started_cluster(): - try: - cluster.start() - yield cluster - - finally: - cluster.shutdown() - - -def test_sql_impersonate(): - - node.query( - "CREATE USER user1 IDENTIFIED WITH plaintext_password BY 'password1';" - "CREATE USER user2 IDENTIFIED WITH plaintext_password BY 'password2';" - ) - - queries = [ - "EXECUTE AS user2 SELECT * from system.tables;", - "EXECUTE AS default SELECT * from system.tables;", - "EXECUTE AS default", - "GRANT IMPERSONATE ON default TO user2; EXECUTE AS user2;", - "GRANT IMPERSONATE ON default TO user2; EXECUTE AS default;", - "GRANT IMPERSONATE ON user2 TO user1; EXECUTE AS user1;" - ] - - errors = [] - for q in queries: - err = node.query_and_get_error(q) - errors.append((q, err)) - - node.query("DROP USER IF EXISTS user1;") - node.query("DROP USER IF EXISTS user2;") - - for q, err in errors: - assert "IMPERSONATE feature is disabled" in err, f"Unexpected error for query:\n{q}\nError: {err}" \ No newline at end of file