2021-02-15 18:00:50 +00:00
|
|
|
# pylint: disable=unused-argument
|
|
|
|
# pylint: disable=redefined-outer-name
|
|
|
|
# pylint: disable=line-too-long
|
|
|
|
|
|
|
|
import pytest
|
|
|
|
|
|
|
|
from helpers.cluster import ClickHouseCluster
|
|
|
|
|
|
|
|
cluster = ClickHouseCluster(__file__)
|
|
|
|
|
2022-03-22 16:39:58 +00:00
|
|
|
node = cluster.add_instance(
|
|
|
|
"node", main_configs=["configs/remote_servers.xml"], stay_alive=True
|
|
|
|
)
|
2021-02-15 18:00:50 +00:00
|
|
|
|
2022-03-22 16:39:58 +00:00
|
|
|
|
|
|
|
@pytest.fixture(scope="module", autouse=True)
|
2021-02-15 18:00:50 +00:00
|
|
|
def start_cluster():
|
|
|
|
try:
|
|
|
|
cluster.start()
|
|
|
|
yield cluster
|
|
|
|
finally:
|
|
|
|
cluster.shutdown()
|
|
|
|
|
2022-03-22 16:39:58 +00:00
|
|
|
|
2021-02-15 18:00:50 +00:00
|
|
|
def test_insert_distributed_async_send_success():
|
2022-03-22 16:39:58 +00:00
|
|
|
node.query("CREATE TABLE data (key Int, value String) Engine=Null()")
|
|
|
|
node.query(
|
|
|
|
"""
|
2021-02-15 18:00:50 +00:00
|
|
|
CREATE TABLE dist AS data
|
|
|
|
Engine=Distributed(
|
|
|
|
test_cluster,
|
|
|
|
currentDatabase(),
|
|
|
|
data,
|
|
|
|
key
|
|
|
|
)
|
2022-03-22 16:39:58 +00:00
|
|
|
"""
|
|
|
|
)
|
2021-02-15 18:00:50 +00:00
|
|
|
|
2022-03-22 16:39:58 +00:00
|
|
|
node.exec_in_container(
|
|
|
|
[
|
|
|
|
"bash",
|
|
|
|
"-c",
|
|
|
|
"mkdir /var/lib/clickhouse/data/default/dist/shard10000_replica10000",
|
|
|
|
]
|
|
|
|
)
|
|
|
|
node.exec_in_container(
|
|
|
|
[
|
|
|
|
"bash",
|
|
|
|
"-c",
|
|
|
|
"touch /var/lib/clickhouse/data/default/dist/shard10000_replica10000/1.bin",
|
|
|
|
]
|
|
|
|
)
|
2021-02-15 18:00:50 +00:00
|
|
|
|
2022-03-22 16:39:58 +00:00
|
|
|
node.exec_in_container(
|
|
|
|
[
|
|
|
|
"bash",
|
|
|
|
"-c",
|
|
|
|
"mkdir /var/lib/clickhouse/data/default/dist/shard1_replica10000",
|
|
|
|
]
|
|
|
|
)
|
|
|
|
node.exec_in_container(
|
|
|
|
[
|
|
|
|
"bash",
|
|
|
|
"-c",
|
|
|
|
"touch /var/lib/clickhouse/data/default/dist/shard1_replica10000/1.bin",
|
|
|
|
]
|
|
|
|
)
|
2021-02-15 18:00:50 +00:00
|
|
|
|
2022-03-22 16:39:58 +00:00
|
|
|
node.exec_in_container(
|
|
|
|
[
|
|
|
|
"bash",
|
|
|
|
"-c",
|
|
|
|
"mkdir /var/lib/clickhouse/data/default/dist/shard10000_replica1",
|
|
|
|
]
|
|
|
|
)
|
|
|
|
node.exec_in_container(
|
|
|
|
[
|
|
|
|
"bash",
|
|
|
|
"-c",
|
|
|
|
"touch /var/lib/clickhouse/data/default/dist/shard10000_replica1/1.bin",
|
|
|
|
]
|
|
|
|
)
|
2021-02-15 18:00:50 +00:00
|
|
|
|
|
|
|
# will check that clickhouse-server is alive
|
|
|
|
node.restart_clickhouse()
|