Repository: kafka Updated Branches: refs/heads/0.10.1 4cb726fde -> cd39f071c
HOTFIX: Avoid mutable default arguments in system test services Author: Jason Gustafson <[email protected]> Reviewers: Apurva Mehta <[email protected]>, Ewen Cheslack-Postava <[email protected]> Closes #1947 from hachikuji/hotfix-producer-perf-service (cherry picked from commit 33c7b88ffe3fc0de9f0154c5667b20ea34c94849) Signed-off-by: Jason Gustafson <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/kafka/repo Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/cd39f071 Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/cd39f071 Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/cd39f071 Branch: refs/heads/0.10.1 Commit: cd39f071c0117e6518c232d36a443345bc6bb8e9 Parents: 4cb726f Author: Jason Gustafson <[email protected]> Authored: Sat Oct 1 17:21:19 2016 -0700 Committer: Jason Gustafson <[email protected]> Committed: Sat Oct 1 17:21:44 2016 -0700 ---------------------------------------------------------------------- tests/kafkatest/services/console_consumer.py | 4 ++-- tests/kafkatest/services/kafka/kafka.py | 4 ++-- tests/kafkatest/services/monitor/jmx.py | 6 +++--- tests/kafkatest/services/performance/producer_performance.py | 8 ++++---- 4 files changed, 11 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kafka/blob/cd39f071/tests/kafkatest/services/console_consumer.py ---------------------------------------------------------------------- diff --git a/tests/kafkatest/services/console_consumer.py b/tests/kafkatest/services/console_consumer.py index 7978963..dae6095 100644 --- a/tests/kafkatest/services/console_consumer.py +++ b/tests/kafkatest/services/console_consumer.py @@ -89,7 +89,7 @@ class ConsoleConsumer(KafkaPathResolverMixin, JmxMixin, BackgroundThreadService) def __init__(self, context, num_nodes, kafka, topic, group_id="test-consumer-group", new_consumer=False, message_validator=None, from_beginning=True, consumer_timeout_ms=None, version=TRUNK, - client_id="console-consumer", print_key=False, jmx_object_names=None, jmx_attributes=[], + client_id="console-consumer", print_key=False, jmx_object_names=None, jmx_attributes=None, enable_systest_events=False, stop_timeout_sec=15): """ Args: @@ -110,7 +110,7 @@ class ConsoleConsumer(KafkaPathResolverMixin, JmxMixin, BackgroundThreadService) stop_timeout_sec After stopping a node, wait up to stop_timeout_sec for the node to stop, and the corresponding background thread to finish successfully. """ - JmxMixin.__init__(self, num_nodes, jmx_object_names, jmx_attributes) + JmxMixin.__init__(self, num_nodes, jmx_object_names, jmx_attributes or []) BackgroundThreadService.__init__(self, context, num_nodes) self.kafka = kafka self.new_consumer = new_consumer http://git-wip-us.apache.org/repos/asf/kafka/blob/cd39f071/tests/kafkatest/services/kafka/kafka.py ---------------------------------------------------------------------- diff --git a/tests/kafkatest/services/kafka/kafka.py b/tests/kafkatest/services/kafka/kafka.py index a2c044f..0bec779 100644 --- a/tests/kafkatest/services/kafka/kafka.py +++ b/tests/kafkatest/services/kafka/kafka.py @@ -68,14 +68,14 @@ 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=[], zk_connect_timeout=5000, zk_session_timeout=6000): + jmx_attributes=None, zk_connect_timeout=5000, zk_session_timeout=6000): """ :type context :type zk: ZookeeperService :type topics: dict """ Service.__init__(self, context, num_nodes) - JmxMixin.__init__(self, num_nodes, jmx_object_names, jmx_attributes) + JmxMixin.__init__(self, num_nodes, jmx_object_names, jmx_attributes or []) self.zk = zk http://git-wip-us.apache.org/repos/asf/kafka/blob/cd39f071/tests/kafkatest/services/monitor/jmx.py ---------------------------------------------------------------------- diff --git a/tests/kafkatest/services/monitor/jmx.py b/tests/kafkatest/services/monitor/jmx.py index ea407b0..19ca5fd 100644 --- a/tests/kafkatest/services/monitor/jmx.py +++ b/tests/kafkatest/services/monitor/jmx.py @@ -21,9 +21,9 @@ class JmxMixin(object): - this is not a service in its own right. - we assume the service using JmxMixin also uses KafkaPathResolverMixin """ - def __init__(self, num_nodes, jmx_object_names=None, jmx_attributes=[]): + def __init__(self, num_nodes, jmx_object_names=None, jmx_attributes=None): self.jmx_object_names = jmx_object_names - self.jmx_attributes = jmx_attributes + self.jmx_attributes = jmx_attributes or [] self.jmx_port = 9192 self.started = [False] * num_nodes @@ -88,4 +88,4 @@ class JmxMixin(object): def read_jmx_output_all_nodes(self): for node in self.nodes: - self.read_jmx_output(self.idx(node), node) \ No newline at end of file + self.read_jmx_output(self.idx(node), node) http://git-wip-us.apache.org/repos/asf/kafka/blob/cd39f071/tests/kafkatest/services/performance/producer_performance.py ---------------------------------------------------------------------- diff --git a/tests/kafkatest/services/performance/producer_performance.py b/tests/kafkatest/services/performance/producer_performance.py index d66efec..7a0ccdd 100644 --- a/tests/kafkatest/services/performance/producer_performance.py +++ b/tests/kafkatest/services/performance/producer_performance.py @@ -34,10 +34,10 @@ class ProducerPerformanceService(JmxMixin, PerformanceService): LOG_FILE = os.path.join(LOG_DIR, "producer_performance.log") LOG4J_CONFIG = os.path.join(PERSISTENT_ROOT, "tools-log4j.properties") - def __init__(self, context, num_nodes, kafka, topic, num_records, record_size, throughput, version=TRUNK, settings={}, - intermediate_stats=False, client_id="producer-performance", jmx_object_names=None, jmx_attributes=[]): + def __init__(self, context, num_nodes, kafka, topic, num_records, record_size, throughput, version=TRUNK, settings=None, + intermediate_stats=False, client_id="producer-performance", jmx_object_names=None, jmx_attributes=None): - JmxMixin.__init__(self, num_nodes, jmx_object_names, jmx_attributes) + JmxMixin.__init__(self, num_nodes, jmx_object_names, jmx_attributes or []) PerformanceService.__init__(self, context, num_nodes) self.logs = { @@ -71,7 +71,7 @@ class ProducerPerformanceService(JmxMixin, PerformanceService): 'record_size': record_size, 'throughput': throughput } - self.settings = settings + self.settings = settings or {} self.intermediate_stats = intermediate_stats self.client_id = client_id
