Skip to content

Commit

Permalink
KAFKA-3080: Fix ConsoleConsumerTest by checking version when service …
Browse files Browse the repository at this point in the history
…is started

The MessageFormatter being used was only introduced as of 0.9.0.0. The Kafka
version in some tests is changed dynamically, sometimes from trunk back to an
earlier version, so this option must be set based on the version used when the
service is started, not when it is created.

Author: Ewen Cheslack-Postava <[email protected]>

Reviewers: Geoff Anderson, Ismael Juma, Grant Henke

Closes apache#770 from ewencp/kafka-3080-system-test-console-consumer-version-failure
  • Loading branch information
ewencp authored and gwenshap committed Jan 21, 2016
1 parent 79cda04 commit 9577dc2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/kafkatest/services/console_consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ def __init__(self, context, num_nodes, kafka, topic, group_id="test-consumer-gro
self.messages_consumed = {idx: [] for idx in range(1, num_nodes + 1)}
self.client_id = client_id
self.print_key = print_key
self.log_values = True if version == TRUNK else False
self.log_level = "TRACE"

def prop_file(self, node):
Expand Down Expand Up @@ -192,7 +191,8 @@ def start_cmd(self, node):
if self.print_key:
cmd += " --property print.key=true"

if self.log_values:
# LoggingMessageFormatter was introduced in 0.9.0.0
if node.version > LATEST_0_8_2:
cmd+=" --formatter kafka.tools.LoggingMessageFormatter"

cmd += " 2>> %(stderr)s | tee -a %(stdout)s &" % args
Expand Down

0 comments on commit 9577dc2

Please sign in to comment.