modify integration test

This commit is contained in:
iceFireser 2024-08-07 19:16:22 +08:00
parent 7d42101593
commit 3a89b7034f
2 changed files with 19 additions and 23 deletions

View File

@ -1,10 +1,6 @@
<clickhouse>
<profiles>
<default>
<allow_drop_detached>1</allow_drop_detached>
<allow_experimental_alter_materialized_view_structure>1</allow_experimental_alter_materialized_view_structure>
<allow_experimental_object_type>0</allow_experimental_object_type>
<allow_suspicious_codecs>0</allow_suspicious_codecs>
</default>
</profiles>
<users>

View File

@ -1,15 +1,14 @@
import re
import pytest
from helpers.cluster import ClickHouseCluster
from helpers.test_tools import assert_eq_with_retry, assert_logs_contain
from helpers.test_tools import assert_eq_with_retry
cluster = ClickHouseCluster(__file__)
main_node = cluster.add_instance(
"main_node",
shard1_node = cluster.add_instance(
"shard1_node",
main_configs=["configs/config.xml"],
user_configs=["configs/settings.xml"],
with_zookeeper=True,
@ -17,18 +16,19 @@ main_node = cluster.add_instance(
macros={"shard": 1, "replica": 1},
)
snapshotting_node = cluster.add_instance(
"snapshotting_node",
shard2_node = cluster.add_instance(
"shard2_node",
main_configs=["configs/config.xml"],
user_configs=["configs/settings.xml"],
with_zookeeper=True,
stay_alive=True,
macros={"shard": 2, "replica": 1},
)
all_nodes = [
main_node,
snapshotting_node,
shard1_node,
shard2_node,
]
@ -43,28 +43,28 @@ def started_cluster():
def test_alter_modify_order_by(started_cluster):
main_node.query("DROP DATABASE IF EXISTS alter_modify_order_by SYNC;")
snapshotting_node.query("DROP DATABASE IF EXISTS alter_modify_order_by SYNC;")
shard1_node.query("DROP DATABASE IF EXISTS alter_modify_order_by SYNC;")
shard2_node.query("DROP DATABASE IF EXISTS alter_modify_order_by SYNC;")
main_node.query(
shard1_node.query(
"CREATE DATABASE alter_modify_order_by ENGINE = Replicated('/test/database/alter_modify_order_by', '{shard}', '{replica}');"
)
main_node.query(
shard1_node.query(
"CREATE TABLE alter_modify_order_by.t1 (id Int64, score Int64) ENGINE = ReplicatedMergeTree('/test/tables/{uuid}/{shard}', '{replica}') ORDER BY (id);"
)
main_node.query("ALTER TABLE alter_modify_order_by.t1 modify order by (id);")
snapshotting_node.query(
shard1_node.query("ALTER TABLE alter_modify_order_by.t1 modify order by (id);")
shard2_node.query(
"CREATE DATABASE alter_modify_order_by ENGINE = Replicated('/test/database/alter_modify_order_by', '{shard}', '{replica}');"
)
query = (
"select count() from system.tables where database = 'alter_modify_order_by';"
)
expected = main_node.query(query)
assert_eq_with_retry(snapshotting_node, query, expected)
expected = shard1_node.query(query)
assert_eq_with_retry(shard2_node, query, expected)
query = "show create table alter_modify_order_by.t1;"
assert main_node.query(query) == snapshotting_node.query(query)
assert shard1_node.query(query) == shard2_node.query(query)
main_node.query("DROP DATABASE IF EXISTS alter_modify_order_by SYNC;")
snapshotting_node.query("DROP DATABASE IF EXISTS alter_modify_order_by SYNC;")
shard1_node.query("DROP DATABASE IF EXISTS alter_modify_order_by SYNC;")
shard2_node.query("DROP DATABASE IF EXISTS alter_modify_order_by SYNC;")