Update test_system_tables_lazy_load to cover both cases and make it run

This commit is contained in:
Azat Khuzhin 2020-05-19 02:25:08 +03:00
parent e1fbf82d0c
commit 04aa6dd7e3
4 changed files with 36 additions and 28 deletions

View File

@ -0,0 +1,4 @@
<?xml version="1.0"?>
<yandex>
<system_tables_lazy_load>true</system_tables_lazy_load>
</yandex>

View File

@ -0,0 +1,32 @@
import pytest
from helpers.cluster import ClickHouseCluster
cluster = ClickHouseCluster(__file__)
node_default = cluster.add_instance('node_default')
# main_configs is mandatory ,since system_tables_lazy_load will be read earlier then parsing of config_lazy.xml
node_lazy = cluster.add_instance('node_lazy', config_dir='configs', main_configs=['configs/config_lazy.xml'])
system_logs = [
# disabled by default
# ('system.part_log'),
# ('system.text_log'),
# enabled by default
('system.query_log'),
('system.query_thread_log'),
('system.trace_log'),
('system.metric_log'),
]
@pytest.fixture(scope='module')
def start_cluster():
try:
cluster.start()
yield cluster
finally:
cluster.shutdown()
@pytest.mark.parametrize('table', system_logs)
def test_system_table(start_cluster, table):
node_default.query('SELECT * FROM {}'.format(table))
assert "Table {} doesn't exist".format(table) in node_lazy.query_and_get_error('SELECT * FROM {}'.format(table))

View File

@ -1,4 +0,0 @@
<?xml version="1.0"?>
<yandex>
<system_tables_lazy_load>false</system_tables_lazy_load>
</yandex>

View File

@ -1,24 +0,0 @@
import time
import pytest
import os
from helpers.cluster import ClickHouseCluster
cluster = ClickHouseCluster(__file__)
node1 = cluster.add_instance('node1', config_dir="configs")
@pytest.fixture(scope="module")
def start_cluster():
try:
cluster.start()
yield cluster
finally:
cluster.shutdown()
def test_system_tables_non_lazy_load(start_cluster):
assert node1.query_and_get_error("SELECT * FROM system.part_log") == ""
assert node1.query_and_get_error("SELECT * FROM system.query_log") == ""
assert node1.query_and_get_error("SELECT * FROM system.query_thread_log") == ""
assert node1.query_and_get_error("SELECT * FROM system.text_log") == ""
assert node1.query_and_get_error("SELECT * FROM system.trace_log") == ""
assert node1.query_and_get_error("SELECT * FROM system.metric_log") == ""