mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 23:52:03 +00:00
TextLog - add tests for field event_time_microsec
This commit is contained in:
parent
e51dfc1314
commit
b4e1116b55
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user