mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 08:32:02 +00:00
try fix test
This commit is contained in:
parent
4f8266c7a1
commit
7486539862
33
tests/integration/test_text_log_level/test.py
Normal file
33
tests/integration/test_text_log_level/test.py
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
# pylint: disable=unused-argument
|
||||||
|
# pylint: disable=redefined-outer-name
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
from helpers.client import QueryRuntimeException
|
||||||
|
from helpers.cluster import ClickHouseCluster
|
||||||
|
|
||||||
|
cluster = ClickHouseCluster(__file__)
|
||||||
|
|
||||||
|
node = cluster.add_instance('node', main_configs=["configs/config.d/text_log.xml"])
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(scope='module')
|
||||||
|
def start_cluster():
|
||||||
|
try:
|
||||||
|
cluster.start()
|
||||||
|
|
||||||
|
yield cluster
|
||||||
|
finally:
|
||||||
|
cluster.shutdown()
|
||||||
|
|
||||||
|
|
||||||
|
def test_basic(start_cluster):
|
||||||
|
with pytest.raises(QueryRuntimeException):
|
||||||
|
# generates log with "Error" level
|
||||||
|
node.query('SELECT * FROM no_such_table')
|
||||||
|
|
||||||
|
node.query('SYSTEM FLUSH LOGS')
|
||||||
|
|
||||||
|
assert int(node.query("SELECT count() FROM system.text_log WHERE level = 'Trace'")) == 0
|
||||||
|
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
|
@ -1,57 +0,0 @@
|
|||||||
# pylint: disable=unused-argument
|
|
||||||
# pylint: disable=redefined-outer-name
|
|
||||||
|
|
||||||
import pytest
|
|
||||||
from helpers.client import QueryRuntimeException
|
|
||||||
from helpers.cluster import ClickHouseCluster
|
|
||||||
|
|
||||||
cluster = ClickHouseCluster(__file__)
|
|
||||||
|
|
||||||
node = cluster.add_instance('node', main_configs=["configs/config.d/text_log.xml"])
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope='module')
|
|
||||||
def start_cluster():
|
|
||||||
try:
|
|
||||||
cluster.start()
|
|
||||||
|
|
||||||
yield cluster
|
|
||||||
finally:
|
|
||||||
cluster.shutdown()
|
|
||||||
|
|
||||||
|
|
||||||
def test_basic(start_cluster):
|
|
||||||
with pytest.raises(QueryRuntimeException):
|
|
||||||
# generate log with "Error" level
|
|
||||||
node.query('SELECT * FROM no_such_table')
|
|
||||||
|
|
||||||
node.query('SYSTEM FLUSH LOGS')
|
|
||||||
|
|
||||||
assert int(node.query("SELECT count() FROM system.text_log WHERE level = 'Trace'")) == 0
|
|
||||||
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)
|
|
@ -6,3 +6,5 @@ ok
|
|||||||
ok
|
ok
|
||||||
01473_query_thread_log_table_event_start_time_microseconds_test
|
01473_query_thread_log_table_event_start_time_microseconds_test
|
||||||
ok
|
ok
|
||||||
|
01473_text_log_table_event_start_time_microseconds_test
|
||||||
|
ok
|
||||||
|
@ -4,79 +4,54 @@
|
|||||||
-- Refer: tests/integration/test_asynchronous_metric_log_table.
|
-- Refer: tests/integration/test_asynchronous_metric_log_table.
|
||||||
|
|
||||||
SET log_queries = 1;
|
SET log_queries = 1;
|
||||||
|
SET query_profiler_real_time_period_ns = 100000000;
|
||||||
|
-- a long enough query to trigger the query profiler and to record trace log
|
||||||
|
SELECT sleep(2) FORMAT Null;
|
||||||
|
SET query_profiler_real_time_period_ns = 1000000000;
|
||||||
|
SYSTEM FLUSH LOGS;
|
||||||
|
|
||||||
SELECT '01473_metric_log_table_event_start_time_microseconds_test';
|
SELECT '01473_metric_log_table_event_start_time_microseconds_test';
|
||||||
SYSTEM FLUSH LOGS;
|
|
||||||
-- query assumes that the event_time field is accurate.
|
-- query assumes that the event_time field is accurate.
|
||||||
WITH (
|
WITH (
|
||||||
(
|
SELECT event_time_microseconds, event_time
|
||||||
SELECT event_time_microseconds
|
|
||||||
FROM system.metric_log
|
FROM system.metric_log
|
||||||
ORDER BY event_time DESC
|
ORDER BY event_time DESC
|
||||||
LIMIT 1
|
LIMIT 1
|
||||||
) AS time_with_microseconds,
|
) AS time
|
||||||
(
|
SELECT if(dateDiff('second', toDateTime(time.1), toDateTime(time.2)) = 0, 'ok', toString(time));
|
||||||
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');
|
|
||||||
|
|
||||||
SELECT '01473_trace_log_table_event_start_time_microseconds_test';
|
SELECT '01473_trace_log_table_event_start_time_microseconds_test';
|
||||||
SET log_queries = 1;
|
|
||||||
SET query_profiler_real_time_period_ns = 10000000;
|
|
||||||
SET query_profiler_cpu_time_period_ns = 10000000;
|
|
||||||
-- a long enough query to trigger the query profiler and to record trace log
|
|
||||||
SELECT count() FROM numbers(1000000000) FORMAT Null;
|
|
||||||
SELECT sleep(2) FORMAT Null;
|
|
||||||
SYSTEM FLUSH LOGS;
|
|
||||||
SELECT sleep(2) FORMAT Null;
|
|
||||||
WITH (
|
WITH (
|
||||||
(
|
SELECT event_time_microseconds, event_time
|
||||||
SELECT event_time_microseconds
|
|
||||||
FROM system.trace_log
|
FROM system.trace_log
|
||||||
ORDER BY event_time DESC
|
ORDER BY event_time DESC
|
||||||
LIMIT 1
|
LIMIT 1
|
||||||
) AS time_with_microseconds,
|
) AS time
|
||||||
(
|
SELECT if(dateDiff('second', toDateTime(time.1), toDateTime(time.2)) = 0, 'ok', toString(time));
|
||||||
SELECT event_time
|
|
||||||
FROM system.trace_log
|
|
||||||
ORDER BY event_time DESC
|
|
||||||
LIMIT 1
|
|
||||||
) AS t)
|
|
||||||
SELECT if(dateDiff('second', toDateTime(time_with_microseconds), toDateTime(t)) = 0, 'ok', 'fail'); -- success
|
|
||||||
|
|
||||||
SELECT '01473_query_log_table_event_start_time_microseconds_test';
|
SELECT '01473_query_log_table_event_start_time_microseconds_test';
|
||||||
SYSTEM FLUSH LOGS;
|
|
||||||
WITH (
|
WITH (
|
||||||
(
|
SELECT event_time_microseconds, event_time
|
||||||
SELECT event_time_microseconds
|
|
||||||
FROM system.query_log
|
FROM system.query_log
|
||||||
ORDER BY event_time DESC
|
ORDER BY event_time DESC
|
||||||
LIMIT 1
|
LIMIT 1
|
||||||
) AS time_with_microseconds,
|
) AS time
|
||||||
(
|
SELECT if(dateDiff('second', toDateTime(time.1), toDateTime(time.2)) = 0, 'ok', toString(time));
|
||||||
SELECT event_time
|
|
||||||
FROM system.query_log
|
|
||||||
ORDER BY event_time DESC
|
|
||||||
LIMIT 1
|
|
||||||
) AS time)
|
|
||||||
SELECT if(dateDiff('second', toDateTime(time_with_microseconds), toDateTime(time)) = 0, 'ok', 'fail'); -- success
|
|
||||||
|
|
||||||
SELECT '01473_query_thread_log_table_event_start_time_microseconds_test';
|
SELECT '01473_query_thread_log_table_event_start_time_microseconds_test';
|
||||||
SYSTEM FLUSH LOGS;
|
|
||||||
WITH (
|
WITH (
|
||||||
(
|
SELECT event_time_microseconds, event_time
|
||||||
SELECT event_time_microseconds
|
|
||||||
FROM system.query_thread_log
|
FROM system.query_thread_log
|
||||||
ORDER BY event_time DESC
|
ORDER BY event_time DESC
|
||||||
LIMIT 1
|
LIMIT 1
|
||||||
) AS time_with_microseconds,
|
) AS time
|
||||||
(
|
SELECT if(dateDiff('second', toDateTime(time.1), toDateTime(time.2)) = 0, 'ok', toString(time));
|
||||||
SELECT event_time
|
|
||||||
FROM system.query_thread_log
|
SELECT '01473_text_log_table_event_start_time_microseconds_test';
|
||||||
ORDER BY event_time DESC
|
WITH (
|
||||||
LIMIT 1
|
SELECT event_time_microseconds, event_time
|
||||||
) AS time)
|
FROM system.query_thread_log
|
||||||
SELECT if(dateDiff('second', toDateTime(time_with_microseconds), toDateTime(time)) = 0, 'ok', 'fail'); -- success
|
ORDER BY event_time DESC
|
||||||
|
LIMIT 1
|
||||||
|
) AS time
|
||||||
|
SELECT if(dateDiff('second', toDateTime(time.1), toDateTime(time.2)) = 0, 'ok', toString(time));
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
"00151_replace_partition_with_different_granularity",
|
"00151_replace_partition_with_different_granularity",
|
||||||
"00157_cache_dictionary",
|
"00157_cache_dictionary",
|
||||||
"01193_metadata_loading",
|
"01193_metadata_loading",
|
||||||
|
"01473_event_time_microseconds",
|
||||||
"01474_executable_dictionary" /// informational stderr from sanitizer at start
|
"01474_executable_dictionary" /// informational stderr from sanitizer at start
|
||||||
],
|
],
|
||||||
"address-sanitizer": [
|
"address-sanitizer": [
|
||||||
@ -25,6 +26,7 @@
|
|||||||
"memory_profiler",
|
"memory_profiler",
|
||||||
"odbc_roundtrip",
|
"odbc_roundtrip",
|
||||||
"01103_check_cpu_instructions_at_startup",
|
"01103_check_cpu_instructions_at_startup",
|
||||||
|
"01473_event_time_microseconds",
|
||||||
"01193_metadata_loading"
|
"01193_metadata_loading"
|
||||||
],
|
],
|
||||||
"ub-sanitizer": [
|
"ub-sanitizer": [
|
||||||
@ -33,6 +35,7 @@
|
|||||||
"memory_profiler",
|
"memory_profiler",
|
||||||
"01103_check_cpu_instructions_at_startup",
|
"01103_check_cpu_instructions_at_startup",
|
||||||
"00900_orc_load",
|
"00900_orc_load",
|
||||||
|
"01473_event_time_microseconds",
|
||||||
"01193_metadata_loading"
|
"01193_metadata_loading"
|
||||||
],
|
],
|
||||||
"memory-sanitizer": [
|
"memory-sanitizer": [
|
||||||
@ -43,6 +46,7 @@
|
|||||||
"01086_odbc_roundtrip", /// can't pass because odbc libraries are not instrumented
|
"01086_odbc_roundtrip", /// can't pass because odbc libraries are not instrumented
|
||||||
"00877_memory_limit_for_new_delete", /// memory limits don't work correctly under msan because it replaces malloc/free
|
"00877_memory_limit_for_new_delete", /// memory limits don't work correctly under msan because it replaces malloc/free
|
||||||
"01114_mysql_database_engine_segfault", /// it fails in _nss_files_parse_servent while using NSS from GLibc to authenticate (need to get rid of it)
|
"01114_mysql_database_engine_segfault", /// it fails in _nss_files_parse_servent while using NSS from GLibc to authenticate (need to get rid of it)
|
||||||
|
"01473_event_time_microseconds",
|
||||||
"01193_metadata_loading"
|
"01193_metadata_loading"
|
||||||
],
|
],
|
||||||
"debug-build": [
|
"debug-build": [
|
||||||
@ -57,6 +61,7 @@
|
|||||||
"01037_polygon_dicts_",
|
"01037_polygon_dicts_",
|
||||||
"hyperscan",
|
"hyperscan",
|
||||||
"01193_metadata_loading",
|
"01193_metadata_loading",
|
||||||
|
"01473_event_time_microseconds",
|
||||||
"01396_inactive_replica_cleanup_nodes"
|
"01396_inactive_replica_cleanup_nodes"
|
||||||
],
|
],
|
||||||
"unbundled-build": [
|
"unbundled-build": [
|
||||||
|
Loading…
Reference in New Issue
Block a user