ClickHouse/tests/integration/test_failed_async_inserts/test.py

55 lines
1.4 KiB
Python
Raw Normal View History

import logging
from time import sleep
import pytest
from helpers.cluster import ClickHouseCluster
from helpers.cluster import ClickHouseCluster
cluster = ClickHouseCluster(__file__)
node = cluster.add_instance(
"node", main_configs=["configs/config.xml"], with_zookeeper=True
)
@pytest.fixture(scope="module")
def started_cluster():
try:
cluster.start()
yield cluster
finally:
cluster.shutdown()
2022-11-01 07:55:24 +00:00
def test_failed_async_inserts(started_cluster):
node = started_cluster.instances["node"]
2022-11-01 07:55:24 +00:00
node.query(
2022-11-01 08:01:33 +00:00
"CREATE TABLE async_insert_30_10_2022 (id UInt32, s String) ENGINE = Memory"
)
node.query(
"INSERT INTO async_insert_30_10_2022 SETTINGS async_insert = 1 VALUES ()",
ignore_error=True,
)
node.query(
"INSERT INTO async_insert_30_10_2022 SETTINGS async_insert = 1 VALUES ([1,2,3], 1)",
ignore_error=True,
)
node.query(
'INSERT INTO async_insert_30_10_2022 SETTINGS async_insert = 1 FORMAT JSONEachRow {"id" : 1} {"x"}',
ignore_error=True,
)
node.query(
"INSERT INTO async_insert_30_10_2022 SETTINGS async_insert = 1 VALUES (throwIf(4),'')",
ignore_error=True,
)
select_query = (
"SELECT value FROM system.events WHERE event == 'FailedAsyncInsertQuery'"
)
2022-11-01 07:55:24 +00:00
assert node.query(select_query) == "4\n"
2022-11-01 07:55:24 +00:00
2023-05-03 18:06:46 +00:00
node.query("DROP TABLE IF EXISTS async_insert_30_10_2022 SYNC")