mirror of https://github.com/apache/kafka.git
MINOR: wait for broker startup for system tests (#4363)
ensure that brokers are registered at ZK before start() returns Author: Matthias J. Sax <matthias@confluent.io> Reviewers: Ewen Cheslack-Postava <ewen@confluent.io>, Damian Guy <damian@confluent.io>, Guozhang Wang <guozhang@confluent.io>
This commit is contained in:
parent
4a0d940191
commit
d98319b48e
|
|
@ -158,6 +158,15 @@ class KafkaService(KafkaPathResolverMixin, JmxMixin, Service):
|
|||
self.start_minikdc(add_principals)
|
||||
Service.start(self)
|
||||
|
||||
self.logger.info("Waiting for brokers to register at ZK")
|
||||
|
||||
retries = 30
|
||||
expected_broker_ids = set(self.nodes)
|
||||
wait_until(lambda: {node for node in self.nodes if self.is_registered(node)} == expected_broker_ids, 30, 1)
|
||||
|
||||
if retries == 0:
|
||||
raise RuntimeError("Kafka servers didn't register at ZK within 30 seconds")
|
||||
|
||||
# Create topics if necessary
|
||||
if self.topics is not None:
|
||||
for topic, topic_cfg in self.topics.items():
|
||||
|
|
|
|||
Loading…
Reference in New Issue