kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ewe...@apache.org
Subject kafka git commit: HOTFIX: Fix unsafe dependence on class name in VerifiableClientJava
Date Sat, 25 Mar 2017 02:41:56 GMT
Repository: kafka
Updated Branches:
  refs/heads/trunk 5bd06f1d5 -> 462767660


HOTFIX: Fix unsafe dependence on class name in VerifiableClientJava

Author: Jason Gustafson <jason@confluent.io>

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

Closes #2736 from hachikuji/hotfix-verifiable-clients


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

Branch: refs/heads/trunk
Commit: 462767660baf49fb63550e60cd9a418705831715
Parents: 5bd06f1
Author: Jason Gustafson <jason@confluent.io>
Authored: Fri Mar 24 19:42:55 2017 -0700
Committer: Ewen Cheslack-Postava <me@ewencp.org>
Committed: Fri Mar 24 19:42:55 2017 -0700

----------------------------------------------------------------------
 tests/kafkatest/services/verifiable_client.py   |  2 +-
 tests/kafkatest/services/verifiable_consumer.py | 12 +++++++++++-
 tests/kafkatest/services/verifiable_producer.py | 11 ++++++++++-
 3 files changed, 22 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/46276766/tests/kafkatest/services/verifiable_client.py
----------------------------------------------------------------------
diff --git a/tests/kafkatest/services/verifiable_client.py b/tests/kafkatest/services/verifiable_client.py
index d8ffa35..d249de6 100644
--- a/tests/kafkatest/services/verifiable_client.py
+++ b/tests/kafkatest/services/verifiable_client.py
@@ -228,7 +228,7 @@ class VerifiableClientJava (VerifiableClientMixin):
         """
         super(VerifiableClientJava, self).__init__()
         self.parent = parent
-        self.java_class_name = self.parent.__class__.__name__
+        self.java_class_name = parent.java_class_name()
         self.conf = conf
 
     def exec_cmd (self, node):

http://git-wip-us.apache.org/repos/asf/kafka/blob/46276766/tests/kafkatest/services/verifiable_consumer.py
----------------------------------------------------------------------
diff --git a/tests/kafkatest/services/verifiable_consumer.py b/tests/kafkatest/services/verifiable_consumer.py
index 735a7bf..0d60dd1 100644
--- a/tests/kafkatest/services/verifiable_consumer.py
+++ b/tests/kafkatest/services/verifiable_consumer.py
@@ -129,8 +129,15 @@ class ConsumerEventHandler(object):
             return None
 
 
-
 class VerifiableConsumer(KafkaPathResolverMixin, VerifiableClientMixin, BackgroundThreadService):
+    """This service wraps org.apache.kafka.tools.VerifiableConsumer for use in
+    system testing. 
+    
+    NOTE: this class should be treated as a PUBLIC API. Downstream users use
+    this service both directly and through class extension, so care must be 
+    taken to ensure compatibility.
+    """
+
     PERSISTENT_ROOT = "/mnt/verifiable_consumer"
     STDOUT_CAPTURE = os.path.join(PERSISTENT_ROOT, "verifiable_consumer.stdout")
     STDERR_CAPTURE = os.path.join(PERSISTENT_ROOT, "verifiable_consumer.stderr")
@@ -175,6 +182,9 @@ class VerifiableConsumer(KafkaPathResolverMixin, VerifiableClientMixin,
Backgrou
         for node in self.nodes:
             node.version = version
 
+    def java_class_name(self):
+        return "VerifiableConsumer"
+
     def _worker(self, idx, node):
         with self.lock:
             if node not in self.event_handlers:

http://git-wip-us.apache.org/repos/asf/kafka/blob/46276766/tests/kafkatest/services/verifiable_producer.py
----------------------------------------------------------------------
diff --git a/tests/kafkatest/services/verifiable_producer.py b/tests/kafkatest/services/verifiable_producer.py
index e32a3de..859e3c4 100644
--- a/tests/kafkatest/services/verifiable_producer.py
+++ b/tests/kafkatest/services/verifiable_producer.py
@@ -28,9 +28,15 @@ from kafkatest.utils import is_int, is_int_with_prefix
 from kafkatest.version import DEV_BRANCH
 from kafkatest.utils.remote_account import line_count
 
+class VerifiableProducer(KafkaPathResolverMixin, VerifiableClientMixin, BackgroundThreadService):
+    """This service wraps org.apache.kafka.tools.VerifiableProducer for use in
+    system testing. 
 
+    NOTE: this class should be treated as a PUBLIC API. Downstream users use
+    this service both directly and through class extension, so care must be 
+    taken to ensure compatibility.
+    """
 
-class VerifiableProducer(KafkaPathResolverMixin, VerifiableClientMixin, BackgroundThreadService):
     PERSISTENT_ROOT = "/mnt/verifiable_producer"
     STDOUT_CAPTURE = os.path.join(PERSISTENT_ROOT, "verifiable_producer.stdout")
     STDERR_CAPTURE = os.path.join(PERSISTENT_ROOT, "verifiable_producer.stderr")
@@ -87,6 +93,9 @@ class VerifiableProducer(KafkaPathResolverMixin, VerifiableClientMixin,
Backgrou
         self.stop_timeout_sec = stop_timeout_sec
         self.request_timeout_sec = request_timeout_sec
 
+    def java_class_name(self):
+        return "VerifiableProducer"
+
     def prop_file(self, node):
         idx = self.idx(node)
         prop_file = str(self.security_config)


Mime
View raw message