ClickHouse/tests/integration/test_keeper_client/test.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

64 lines
1.4 KiB
Python
Raw Normal View History

import pytest
from helpers.client import CommandRequest
from helpers.cluster import ClickHouseCluster
cluster = ClickHouseCluster(__file__)
node = cluster.add_instance(
"node",
main_configs=["configs/keeper_config.xml"],
with_zookeeper=True,
stay_alive=True,
)
@pytest.fixture(scope="module")
def started_cluster():
try:
cluster.start()
yield cluster
finally:
cluster.shutdown()
def test_base_commands(started_cluster):
_ = started_cluster
command = CommandRequest(
2023-07-28 06:09:57 +00:00
[
started_cluster.server_bin_path,
2023-07-28 06:09:57 +00:00
"keeper-client",
"--host",
str(cluster.get_instance_ip("zoo1")),
"--port",
str(cluster.zookeeper_port),
"-q",
"create test_create_zk_node1 testvalue1;create test_create_zk_node_2 testvalue2;get test_create_zk_node1;",
2023-07-28 06:09:57 +00:00
],
stdin="",
)
2023-07-26 15:13:53 +00:00
assert command.get_answer() == "testvalue1\n"
2023-07-26 05:57:16 +00:00
def test_four_letter_word_commands(started_cluster):
_ = started_cluster
2023-07-26 05:57:16 +00:00
command = CommandRequest(
2023-07-26 05:57:16 +00:00
[
started_cluster.server_bin_path,
"keeper-client",
"--host",
str(cluster.get_instance_ip("zoo1")),
"--port",
str(cluster.zookeeper_port),
"-q",
"ruok",
],
stdin="",
2023-07-26 05:57:16 +00:00
)
assert command.get_answer() == "imok\n"