Skip to content

Commit

Permalink
tests: retry on rpk exception when describing group
Browse files Browse the repository at this point in the history
When describing a group in a `test_dead_group` recovery test we must
allow for RPK to return an error and then retry.

Fixes: redpanda-data#5079

Signed-off-by: Michal Maslanka <michal@redpanda.com>
  • Loading branch information
mmaslankaprv authored and ballard26 committed Sep 27, 2022
1 parent f7be218 commit b5cc4df
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions tests/rptest/tests/consumer_group_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

from rptest.services.cluster import cluster

from rptest.clients.rpk import RpkTool
from rptest.clients.rpk import RpkException, RpkTool
from rptest.clients.types import TopicSpec
from rptest.services.kafka_cli_consumer import KafkaCliConsumer
from rptest.services.redpanda import RESTART_LOG_ALLOW_LIST
Expand Down Expand Up @@ -377,9 +377,13 @@ def group_is_empty():
rpk.delete_topic(self.topic_spec.name)

def group_is_dead():
rpk_group = rpk.group_describe(group)

return rpk_group.members == 0 and rpk_group.state == "Dead"
try:
rpk_group = rpk.group_describe(group)
return rpk_group.members == 0 and rpk_group.state == "Dead"
except RpkException as e:
# allow RPK to throw an exception as redpanda nodes were
# restarted and the request may require a retry
return False

wait_until(group_is_dead, 30, 2)
self.producer.wait()
Expand Down

0 comments on commit b5cc4df

Please sign in to comment.