kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ij...@apache.org
Subject kafka git commit: KAFKA-4309; Allow "pluggable" properties in KafkaService in System Tests
Date Fri, 21 Oct 2016 09:12:30 GMT
Repository: kafka
Updated Branches:
  refs/heads/0.10.1 9c4f1d54f -> 3b0a8d6df


KAFKA-4309; Allow "pluggable" properties in KafkaService in System Tests

Author: Ben Stopford <benstopford@gmail.com>

Reviewers: Ismael Juma <ismael@juma.me.uk>

Closes #2034 from benstopford/throttling-system-test-kafka-changes

(cherry picked from commit 2ac70c0b744780c8a7af1f9c8be27a45059da6cc)
Signed-off-by: Ismael Juma <ismael@juma.me.uk>


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

Branch: refs/heads/0.10.1
Commit: 3b0a8d6dfc89d77310079969bbfeeeb532aa59fd
Parents: 9c4f1d5
Author: Ben Stopford <benstopford@gmail.com>
Authored: Fri Oct 21 10:12:08 2016 +0100
Committer: Ismael Juma <ismael@juma.me.uk>
Committed: Fri Oct 21 10:12:24 2016 +0100

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


http://git-wip-us.apache.org/repos/asf/kafka/blob/3b0a8d6d/tests/kafkatest/services/kafka/kafka.py
----------------------------------------------------------------------
diff --git a/tests/kafkatest/services/kafka/kafka.py b/tests/kafkatest/services/kafka/kafka.py
index 0bec779..0caee9a 100644
--- a/tests/kafkatest/services/kafka/kafka.py
+++ b/tests/kafkatest/services/kafka/kafka.py
@@ -68,7 +68,7 @@ class KafkaService(KafkaPathResolverMixin, JmxMixin, Service):
     def __init__(self, context, num_nodes, zk, security_protocol=SecurityConfig.PLAINTEXT,
interbroker_security_protocol=SecurityConfig.PLAINTEXT,
                  client_sasl_mechanism=SecurityConfig.SASL_MECHANISM_GSSAPI, interbroker_sasl_mechanism=SecurityConfig.SASL_MECHANISM_GSSAPI,
                  authorizer_class_name=None, topics=None, version=TRUNK, jmx_object_names=None,
-                 jmx_attributes=None, zk_connect_timeout=5000, zk_session_timeout=6000):
+                 jmx_attributes=None, zk_connect_timeout=5000, zk_session_timeout=6000, server_prop_overides=[]):
         """
         :type context
         :type zk: ZookeeperService
@@ -87,6 +87,7 @@ class KafkaService(KafkaPathResolverMixin, JmxMixin, Service):
         self.minikdc = None
         self.authorizer_class_name = authorizer_class_name
         self.zk_set_acl = False
+        self.server_prop_overides = server_prop_overides
 
         #
         # In a heavily loaded and not very fast machine, it is
@@ -171,6 +172,9 @@ class KafkaService(KafkaPathResolverMixin, JmxMixin, Service):
         cfg[config_property.ADVERTISED_HOSTNAME] = node.account.hostname
         cfg[config_property.ZOOKEEPER_CONNECT] = self.zk.connect_setting()
 
+        for prop in self.server_prop_overides:
+            cfg[prop[0]] = prop[1]
+
         self.set_protocol_and_port(node)
 
         # TODO - clean up duplicate configuration logic
@@ -510,7 +514,7 @@ class KafkaService(KafkaPathResolverMixin, JmxMixin, Service):
         self.logger.debug(output)
         return output
 
-    def bootstrap_servers(self, protocol='PLAINTEXT'):
+    def bootstrap_servers(self, protocol='PLAINTEXT', validate=True):
         """Return comma-delimited list of brokers in this cluster formatted as HOSTNAME1:PORT1,HOSTNAME:PORT2,...
 
         This is the format expected by many config files.
@@ -518,7 +522,7 @@ class KafkaService(KafkaPathResolverMixin, JmxMixin, Service):
         port_mapping = self.port_mappings[protocol]
         self.logger.info("Bootstrap client port is: " + str(port_mapping.number))
 
-        if not port_mapping.open:
+        if validate and not port_mapping.open:
             raise ValueError("We are retrieving bootstrap servers for the port: %s which
is not currently open. - " % str(port_mapping))
 
         return ','.join([node.account.hostname + ":" + str(port_mapping.number) for node
in self.nodes])


Mime
View raw message