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>
(cherry picked from commit 47711c8)
  • Loading branch information
mmaslankaprv authored and ztlpn committed Nov 24, 2022
1 parent 307b4de commit e3dbb70
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 @@ -11,7 +11,7 @@
from collections import defaultdict
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 @@ -349,9 +349,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)

Expand Down

0 comments on commit e3dbb70

Please sign in to comment.