mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-11 18:14:03 +00:00
b75963d370
This PR formats all the `*.py` files found under the `tests/integration` folder. It also reorders the imports and cleans up a bunch of unused imports. The formatting also takes care of other things like wrapping lines and fixing spaces and indents such that the tests look more readable.
51 lines
2.3 KiB
Python
51 lines
2.3 KiB
Python
import pytest
|
|
|
|
from helpers.cluster import ClickHouseCluster
|
|
|
|
cluster = ClickHouseCluster(__file__)
|
|
|
|
node1 = cluster.add_instance('node1', main_configs=['configs/remote_servers.xml'],
|
|
user_configs=['configs/users_config.xml'], with_zookeeper=True)
|
|
node2 = cluster.add_instance('node2', main_configs=['configs/remote_servers.xml'],
|
|
user_configs=['configs/users_config.xml'], with_zookeeper=True)
|
|
node3 = cluster.add_instance('node3', main_configs=['configs/remote_servers.xml'],
|
|
user_configs=['configs/users_config.xml'], with_zookeeper=True)
|
|
node4 = cluster.add_instance('node4', main_configs=['configs/remote_servers.xml'],
|
|
user_configs=['configs/users_config.xml'], with_zookeeper=True)
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
def started_cluster():
|
|
try:
|
|
cluster.start()
|
|
|
|
yield cluster
|
|
finally:
|
|
cluster.shutdown()
|
|
|
|
|
|
def test_long_query(started_cluster):
|
|
node1.query(
|
|
"CREATE TABLE cluster_table (key UInt64, value String) ENGINE = ReplicatedMergeTree('/test/1/cluster_table', '1') ORDER BY tuple()")
|
|
node2.query(
|
|
"CREATE TABLE cluster_table (key UInt64, value String) ENGINE = ReplicatedMergeTree('/test/1/cluster_table', '2') ORDER BY tuple()")
|
|
|
|
node1.query("INSERT INTO cluster_table SELECT number, toString(number) FROM numbers(20)")
|
|
node2.query("SYSTEM SYNC REPLICA cluster_table")
|
|
|
|
node3.query(
|
|
"CREATE TABLE cluster_table (key UInt64, value String) ENGINE = ReplicatedMergeTree('/test/2/cluster_table', '1') ORDER BY tuple()")
|
|
|
|
node4.query(
|
|
"CREATE TABLE cluster_table (key UInt64, value String) ENGINE = ReplicatedMergeTree('/test/2/cluster_table', '2') ORDER BY tuple()")
|
|
node3.query("INSERT INTO cluster_table SELECT number, toString(number) FROM numbers(20)")
|
|
node4.query("SYSTEM SYNC REPLICA cluster_table")
|
|
|
|
node1.query("ALTER TABLE cluster_table ON CLUSTER 'test_cluster' UPDATE key = 1 WHERE sleepEachRow(1) == 0",
|
|
settings={"mutations_sync": "2"})
|
|
|
|
assert node1.query("SELECT SUM(key) FROM cluster_table") == "20\n"
|
|
assert node2.query("SELECT SUM(key) FROM cluster_table") == "20\n"
|
|
assert node3.query("SELECT SUM(key) FROM cluster_table") == "20\n"
|
|
assert node4.query("SELECT SUM(key) FROM cluster_table") == "20\n"
|