kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mj...@apache.org
Subject [kafka] branch 0.11.0 updated: MINOR: wait for broker startup for system tests (#4363)
Date Sat, 24 Feb 2018 00:19:08 GMT
This is an automated email from the ASF dual-hosted git repository.

mjsax pushed a commit to branch 0.11.0
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/0.11.0 by this push:
     new d98319b  MINOR: wait for broker startup for system tests (#4363)
d98319b is described below

commit d98319b48e3120b86bcd14040508c56ee70b4bf3
Author: Matthias J. Sax <mjsax@apache.org>
AuthorDate: Fri Feb 23 16:13:57 2018 -0800

    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>
---
 tests/kafkatest/services/kafka/kafka.py | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/tests/kafkatest/services/kafka/kafka.py b/tests/kafkatest/services/kafka/kafka.py
index c841860..18d0099 100644
--- a/tests/kafkatest/services/kafka/kafka.py
+++ b/tests/kafkatest/services/kafka/kafka.py
@@ -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():

-- 
To stop receiving notification emails like this one, please contact
mjsax@apache.org.

Mime
View raw message