提交 b4e1116b 编写于 作者: B bharatnc 提交者: alesapin

TextLog - add tests for field event_time_microsec

上级 e51dfc13
......@@ -22,7 +22,7 @@ def start_cluster():
def test_basic(start_cluster):
with pytest.raises(QueryRuntimeException):
# generates log with "Error" level
# generate log with "Error" level
node.query('SELECT * FROM no_such_table')
node.query('SYSTEM FLUSH LOGS')
......@@ -31,3 +31,27 @@ def test_basic(start_cluster):
assert int(node.query("SELECT count() FROM system.text_log WHERE level = 'Debug'")) == 0
assert int(node.query("SELECT count() FROM system.text_log WHERE level = 'Information'")) >= 1
assert int(node.query("SELECT count() FROM system.text_log WHERE level = 'Error'")) >= 1
# compare the event_time and event_time_microseconds and test
# that they are exactly equal upto their seconds parts.
def test_field_event_time_microseconds(start_cluster):
with pytest.raises(QueryRuntimeException):
# generate log with "Error" level
node.query('SELECT * FROM no_such_table')
node.query('SYSTEM FLUSH LOGS')
equals_query = '''WITH (
(
SELECT event_time_microseconds
FROM system.text_log
ORDER BY event_time DESC
LIMIT 1
) AS time_with_microseconds,
(
SELECT event_time
FROM system.text_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 node.query(equals_query)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册