fix tests

This commit is contained in:
Bharat Nallan Chakravarthy 2023-12-19 08:26:54 -08:00
parent 73f71cc9fc
commit 6273c5920a
2 changed files with 24 additions and 29 deletions

View File

@ -1,3 +1,4 @@
<clickhouse>
<asynchronous_metrics_update_period_s>1</asynchronous_metrics_update_period_s>
<asynchronous_heavy_metrics_update_period_s>1</asynchronous_heavy_metrics_update_period_s>
</clickhouse>

View File

@ -22,36 +22,30 @@ def started_cluster():
def test_total_pk_bytes_in_memory_fields(started_cluster):
try:
cluster.start()
node1.query("SET log_queries = 1;")
node1.query("CREATE DATABASE replica;")
query_create = """CREATE TABLE replica.test
(
id Int64,
event_time DateTime
)
Engine=MergeTree()
PARTITION BY toYYYYMMDD(event_time)
ORDER BY id;"""
time.sleep(2)
node1.query(query_create)
node1.query("""INSERT INTO replica.test VALUES (1, now())""")
node1.query("SYSTEM FLUSH LOGS;")
cluster.start()
node1.query("SET log_queries = 1;")
query_create = """CREATE TABLE test
(
id Int64,
event_time DateTime
)
Engine=MergeTree()
PARTITION BY toYYYYMMDD(event_time)
ORDER BY id;"""
node1.query(query_create)
node1.query("""INSERT INTO test VALUES (1, now())""")
node1.query("SYSTEM FLUSH LOGS;")
# query system.asynchronous_metrics
test_query = "SELECT count() > 0 ? 'ok' : 'fail' FROM system.asynchronous_metrics WHERE metric='TotalPrimaryKeyBytesInMemory';"
assert "ok\n" in node1.query(test_query)
# query system.asynchronous_metrics
test_query = "SELECT count() > 0 ? 'ok' : 'fail' FROM system.asynchronous_metrics WHERE metric = 'TotalPrimaryKeyBytesInMemory';"
assert "ok\n" in node1.query(test_query)
test_query = "SELECT count() > 0 ? 'ok' : 'fail' FROM system.asynchronous_metrics WHERE metric='TotalPrimaryKeyBytesInMemoryAllocated';"
assert "ok\n" in node1.query(test_query)
test_query = "SELECT count() > 0 ? 'ok' : 'fail' FROM system.asynchronous_metrics WHERE metric = 'TotalPrimaryKeyBytesInMemoryAllocated';"
assert "ok\n" in node1.query(test_query)
# query system.asynchronous_metric_log
test_query = "SELECT count() > 0 ? 'ok' : 'fail' FROM system.asynchronous_metric_log WHERE metric='TotalPrimaryKeyBytesInMemory';"
assert "ok\n" in node1.query(test_query)
# query system.asynchronous_metric_log
test_query = "SELECT count() > 0 ? 'ok' : 'fail' FROM system.asynchronous_metric_log WHERE metric = 'TotalPrimaryKeyBytesInMemory';"
assert "ok\n" in node1.query(test_query)
test_query = "SELECT count() > 0 ? 'ok' : 'fail' FROM system.asynchronous_metric_log WHERE metric='TotalPrimaryKeyBytesInMemoryAllocated';"
assert "ok\n" in node1.query(test_query)
finally:
cluster.shutdown()
test_query = "SELECT count() > 0 ? 'ok' : 'fail' FROM system.asynchronous_metric_log WHERE metric = 'TotalPrimaryKeyBytesInMemoryAllocated';"
assert "ok\n" in node1.query(test_query)