mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-14 10:22:10 +00:00
better test
This commit is contained in:
parent
997171a00e
commit
b512997e50
@ -0,0 +1,10 @@
|
||||
<clickhouse>
|
||||
<startup_scripts>
|
||||
<scripts>
|
||||
<query>SELECT 42;</query>
|
||||
</scripts>
|
||||
<scripts>
|
||||
<query>SELECT * FROM non_existent_table;</query>
|
||||
</scripts>
|
||||
</startup_scripts>
|
||||
</clickhouse>
|
@ -0,0 +1,11 @@
|
||||
<clickhouse>
|
||||
<startup_scripts>
|
||||
<scripts>
|
||||
<condition>SELECT 0;</condition>
|
||||
<query>SELECT * FROM non_existent_table;</query>
|
||||
</scripts>
|
||||
<scripts>
|
||||
<query>SELECT 42;</query>
|
||||
</scripts>
|
||||
</startup_scripts>
|
||||
</clickhouse>
|
@ -0,0 +1,8 @@
|
||||
<clickhouse>
|
||||
<users>
|
||||
<default>
|
||||
<profile>default</profile>
|
||||
<no_password></no_password>
|
||||
</default>
|
||||
</users>
|
||||
</clickhouse>
|
@ -0,0 +1,56 @@
|
||||
from enum import Enum
|
||||
import random
|
||||
import string
|
||||
import time
|
||||
|
||||
import pytest
|
||||
|
||||
from helpers.cluster import ClickHouseCluster
|
||||
|
||||
cluster = ClickHouseCluster(__file__)
|
||||
good = cluster.add_instance(
|
||||
"good",
|
||||
main_configs=[
|
||||
"config/users.xml",
|
||||
"config/good_script.xml"
|
||||
],
|
||||
stay_alive=True,
|
||||
)
|
||||
bad = cluster.add_instance(
|
||||
"bad",
|
||||
main_configs=[
|
||||
"config/users.xml",
|
||||
"config/bad_script.xml"
|
||||
],
|
||||
stay_alive=True,
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def start_cluster():
|
||||
try:
|
||||
cluster.start()
|
||||
yield cluster
|
||||
finally:
|
||||
cluster.shutdown()
|
||||
|
||||
|
||||
def test_startup_execution_state(start_cluster):
|
||||
"""
|
||||
Making sure that the StartupScriptsExecutionState metric is set correctly.
|
||||
"""
|
||||
|
||||
STATE_SUCCESS = 1
|
||||
STATE_FAILURE = 2
|
||||
|
||||
assert int(
|
||||
good.query(
|
||||
"SELECT value FROM system.metrics WHERE metric = 'StartupScriptsExecutionState'"
|
||||
).strip()
|
||||
) == STATE_SUCCESS
|
||||
|
||||
assert int(
|
||||
bad.query(
|
||||
"SELECT value FROM system.metrics WHERE metric = 'StartupScriptsExecutionState'"
|
||||
).strip()
|
||||
) == STATE_FAILURE
|
@ -1 +0,0 @@
|
||||
SELECT value FROM system.metrics WHERE metric = 'StartupScriptsExecutionState'
|
Loading…
Reference in New Issue
Block a user