kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ewe...@apache.org
Subject kafka git commit: MINOR: support retrieving cluster_id in system tests
Date Wed, 09 Aug 2017 02:59:02 GMT
Repository: kafka
Updated Branches:
  refs/heads/trunk fb8edbdc6 -> b8cf97686


MINOR: support retrieving cluster_id in system tests

ewencp would be great to cherry-pick this back into 0.11.x if possible

Author: Xavier Léauté <xavier@confluent.io>

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

Closes #3645 from xvrl/system-test-cluster-id


Project: http://git-wip-us.apache.org/repos/asf/kafka/repo
Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/b8cf9768
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/b8cf9768
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/b8cf9768

Branch: refs/heads/trunk
Commit: b8cf976865f3559b4e5c45eeb261444cd1d7383f
Parents: fb8edbd
Author: Xavier Léauté <xavier@confluent.io>
Authored: Tue Aug 8 19:58:47 2017 -0700
Committer: Ewen Cheslack-Postava <me@ewencp.org>
Committed: Tue Aug 8 19:58:47 2017 -0700

----------------------------------------------------------------------
 tests/kafkatest/services/kafka/kafka.py | 10 ++++++++++
 1 file changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/b8cf9768/tests/kafkatest/services/kafka/kafka.py
----------------------------------------------------------------------
diff --git a/tests/kafkatest/services/kafka/kafka.py b/tests/kafkatest/services/kafka/kafka.py
index e941a3d..ee60bab 100644
--- a/tests/kafkatest/services/kafka/kafka.py
+++ b/tests/kafkatest/services/kafka/kafka.py
@@ -531,6 +531,16 @@ class KafkaService(KafkaPathResolverMixin, JmxMixin, Service):
         self.logger.info("Leader for topic %s and partition %d is now: %d" % (topic, partition,
leader_idx))
         return self.get_node(leader_idx)
 
+    def cluster_id(self):
+        """ Get the current cluster id
+        """
+        self.logger.debug("Querying ZooKeeper to retrieve cluster id")
+        cluster = json.loads(self.zk.query("/cluster/id"))
+        if cluster is None:
+            raise Exception("Error querying ZK for cluster id.")
+
+        return cluster['id']
+
     def list_consumer_groups(self, node=None, new_consumer=True, command_config=None):
         """ Get list of consumer groups.
         """


Mime
View raw message