mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
use keeper-client in integration tests
This commit is contained in:
parent
bfdc2b58b4
commit
7dc6ff02c3
@ -113,6 +113,11 @@ void KeeperClient::defineOptions(Poco::Util::OptionSet & options)
|
||||
Poco::Util::Option("history-file", "", "set path of history file. default `~/.keeper-client-history`")
|
||||
.argument("history-file")
|
||||
.binding("history-file"));
|
||||
|
||||
options.addOption(
|
||||
Poco::Util::Option("log-level", "", "set log level")
|
||||
.argument("log-level")
|
||||
.binding("log-level"));
|
||||
}
|
||||
|
||||
void KeeperClient::initialize(Poco::Util::Application & /* self */)
|
||||
@ -198,6 +203,8 @@ void KeeperClient::initialize(Poco::Util::Application & /* self */)
|
||||
}
|
||||
}
|
||||
|
||||
Poco::Logger::root().setLevel(config().getString("log-level", "error"));
|
||||
|
||||
EventNotifier::init();
|
||||
}
|
||||
|
||||
|
@ -1,26 +1,12 @@
|
||||
import socket
|
||||
import time
|
||||
|
||||
|
||||
def get_keeper_socket(cluster, node, port=9181):
|
||||
hosts = cluster.get_instance_ip(node.name)
|
||||
client = socket.socket()
|
||||
client.settimeout(10)
|
||||
client.connect((hosts, port))
|
||||
return client
|
||||
from helper.client import CommandRequest
|
||||
|
||||
|
||||
def send_4lw_cmd(cluster, node, cmd="ruok", port=9181):
|
||||
client = None
|
||||
try:
|
||||
client = get_keeper_socket(cluster, node, port)
|
||||
client.send(cmd.encode())
|
||||
data = client.recv(100_000)
|
||||
data = data.decode()
|
||||
return data
|
||||
finally:
|
||||
if client is not None:
|
||||
client.close()
|
||||
return CommandRequest(
|
||||
["cluster.server_bin_path", "keeper-client", f"{cluster.get_instance_ip(node.name)}:{port}", "-q", cmd]
|
||||
).get_answer()
|
||||
|
||||
|
||||
NOT_SERVING_REQUESTS_ERROR_MSG = "This instance is not currently serving requests"
|
||||
|
Loading…
Reference in New Issue
Block a user