Skip to content

Commit

Permalink
KAFKA-16269: Update reassign_partitions_test.py to support KIP-848’s …
Browse files Browse the repository at this point in the history
…group protocol config (apache#15540)

Added a new optional `group_protocol` parameter to the test methods, then passed that down to the `setup_consumer` method.

Unfortunately, because the new consumer can only be used with the new coordinator, this required a new `@matrix` block instead of adding the `group_protocol=["classic", "consumer"]` to the existing blocks 😢

Reviewers: Lucas Brutschy <lbrutschy@confluent.io>
  • Loading branch information
kirktrue authored and clolov committed Apr 5, 2024
1 parent ed431a5 commit f17702e
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions tests/kafkatest/tests/core/reassign_partitions_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

from kafkatest.services.kafka import config_property
from kafkatest.services.zookeeper import ZookeeperService
from kafkatest.services.kafka import KafkaService, quorum
from kafkatest.services.kafka import KafkaService, quorum, consumer_group
from kafkatest.services.verifiable_producer import VerifiableProducer
from kafkatest.services.console_consumer import ConsoleConsumer
from kafkatest.tests.produce_consume_validate import ProduceConsumeValidateTest
Expand Down Expand Up @@ -135,16 +135,17 @@ def move_start_offset(self):
@matrix(
bounce_brokers=[True, False],
reassign_from_offset_zero=[True, False],
metadata_quorum=[quorum.zk],
metadata_quorum=[quorum.zk, quorum.isolated_kraft],
use_new_coordinator=[False]
)
@matrix(
bounce_brokers=[True, False],
reassign_from_offset_zero=[True, False],
metadata_quorum=[quorum.isolated_kraft],
use_new_coordinator=[True, False]
use_new_coordinator=[True],
group_protocol=consumer_group.all_group_protocols
)
def test_reassign_partitions(self, bounce_brokers, reassign_from_offset_zero, metadata_quorum, use_new_coordinator=False):
def test_reassign_partitions(self, bounce_brokers, reassign_from_offset_zero, metadata_quorum, use_new_coordinator=False, group_protocol=None):
"""Reassign partitions tests.
Setup: 1 zk, 4 kafka nodes, 1 topic with partitions=20, replication-factor=3,
and min.insync.replicas=3
Expand All @@ -167,7 +168,8 @@ def test_reassign_partitions(self, bounce_brokers, reassign_from_offset_zero, me
self.consumer = ConsoleConsumer(self.test_context, self.num_consumers,
self.kafka, self.topic,
consumer_timeout_ms=60000,
message_validator=is_int)
message_validator=is_int,
consumer_properties=consumer_group.maybe_set_group_protocol(group_protocol))

self.enable_idempotence=True
self.run_produce_consume_validate(core_test_action=lambda: self.reassign_partitions(bounce_brokers))

0 comments on commit f17702e

Please sign in to comment.