Skip to content

Commit

Permalink
MINOR: Verify startup of zookeeper service in system tests
Browse files Browse the repository at this point in the history
Author: Konstantine Karantasis <konstantine@confluent.io>

Reviewers: Ewen Cheslack-Postava <ewen@confluent.io>

Closes #3707 from kkonstantine/MINOR-Verify-startup-of-zookeeper-service-in-system-tests-by-connecting-to-port
  • Loading branch information
kkonstantine authored and ewencp committed Aug 29, 2017
1 parent abc66c9 commit 0cffb62
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion tests/kafkatest/services/zookeeper.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,16 @@ def start_node(self, node):
start_cmd += "/mnt/zookeeper.properties 1>> %(path)s 2>> %(path)s &" % self.logs["zk_log"]
node.account.ssh(start_cmd)

time.sleep(5) # give it some time to start
wait_until(lambda: self.listening(node), timeout_sec=10, err_msg="Zookeeper node failed to start")

def listening(self, node):
try:
cmd = "nc -z %s %s" % (node.account.hostname, 2181)
node.account.ssh_output(cmd, allow_fail=False)
self.logger.debug("Zookeeper started accepting connections at: '%s:%s')", node.account.hostname, 2181)
return True
except (RemoteCommandError, ValueError) as e:
return False

def pids(self, node):
try:
Expand Down

0 comments on commit 0cffb62

Please sign in to comment.