ClickHouse/tests/integration/helpers/wait_for_helpers.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

31 lines
997 B
Python
Raw Normal View History

import time
2022-09-22 22:51:13 +00:00
from helpers.test_tools import assert_eq_with_retry
def _parse_table_database(table, database):
if database is not None:
return table, database
if "." in table:
return reversed(table.split(".", 1))
return table, "default"
2022-10-04 16:15:50 +00:00
def wait_for_delete_inactive_parts(node, table, database=None, **kwargs):
table, database = _parse_table_database(table, database)
inactive_parts_query = (
f"SELECT count() FROM system.parts "
f"WHERE not active AND table = '{table}' AND database = '{database}';"
)
2022-10-04 16:15:50 +00:00
assert_eq_with_retry(node, inactive_parts_query, "0\n", **kwargs)
2022-10-04 16:15:50 +00:00
def wait_for_delete_empty_parts(node, table, database=None, **kwargs):
table, database = _parse_table_database(table, database)
empty_parts_query = (
f"SELECT count() FROM system.parts "
f"WHERE active AND rows = 0 AND table = '{table}' AND database = '{database}'"
)
2022-10-04 16:15:50 +00:00
assert_eq_with_retry(node, empty_parts_query, "0\n", **kwargs)