提交 31b0bd48 编写于 作者: B bharatnc

Integration tests - more accurate tests

上级 05a80518
......@@ -39,9 +39,21 @@ def test_event_time_microseconds_field(started_cluster):
node1.query(query_create)
node1.query('''INSERT INTO replica.test VALUES (1, now())''')
node1.query("SYSTEM FLUSH LOGS;")
node1.query("SELECT * FROM system.asynchronous_metrics LIMIT 10")
assert "1\n" in node1.query('''SELECT count() from replica.test FORMAT TSV''')
assert "ok\n" in node1.query(
"SELECT If((select count(event_time_microseconds) from system.asynchronous_metric_log) > 0, 'ok', 'fail');")
#query assumes that the event_time field is accurate
equals_query = '''WITH (
(
SELECT event_time_microseconds
FROM system.asynchronous_metric_log
ORDER BY event_time DESC
LIMIT 1
) AS time_with_microseconds,
(
SELECT event_time
FROM system.asynchronous_metric_log
ORDER BY event_time DESC
LIMIT 1
) AS time)
SELECT if(dateDiff('second', toDateTime(time_with_microseconds), toDateTime(time)) = 0, 'ok', 'fail')'''
assert "ok\n" in node1.query(equals_query)
finally:
cluster.shutdown()
......@@ -8,4 +8,18 @@ set log_queries = 1;
select '01473_metric_log_table_event_start_time_microseconds_test';
system flush logs;
SELECT sleep(3) Format Null;
SELECT If((select count(event_time_microseconds) from system.metric_log) > 0, 'ok', 'fail'); -- success
-- query assumes that the event_time field is accurate.
WITH (
(
SELECT event_time_microseconds
FROM system.metric_log
ORDER BY event_time DESC
LIMIT 1
) AS time_with_microseconds,
(
SELECT event_time
FROM system.metric_log
ORDER BY event_time DESC
LIMIT 1
) AS time)
SELECT if(dateDiff('second', toDateTime(time_with_microseconds), toDateTime(time)) = 0, 'ok', 'fail')
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册