mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-18 05:32:52 +00:00
b75963d370
This PR formats all the `*.py` files found under the `tests/integration` folder. It also reorders the imports and cleans up a bunch of unused imports. The formatting also takes care of other things like wrapping lines and fixing spaces and indents such that the tests look more readable.
34 lines
1.0 KiB
Python
34 lines
1.0 KiB
Python
# 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
|