Skip to content

Commit

Permalink
tests/cg-recovery: retry on empty list groups res
Browse files Browse the repository at this point in the history
Issues redpanda-data#10363 revealead that it is possible for a broker to service a
ListGroups request in a window where the leader-to-be is _becoming_ the
leader but the configuration has not replicated yet. This results in an
empty ListGroups response.

The fix is to retry the request.

Fixes redpanda-data#10363

Signed-off-by: NyaliaLui <[email protected]>
  • Loading branch information
NyaliaLui committed Aug 3, 2023
1 parent f435b4a commit 817678b
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions tests/rptest/tests/consumer_group_recovery_tool_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from rptest.services.rpk_producer import RpkProducer
from rptest.tests.prealloc_nodes import PreallocNodesTest
from rptest.tests.redpanda_test import RedpandaTest
from rptest.util import wait_until_result
from ducktape.utils.util import wait_until
from ducktape.mark import parametrize

Expand All @@ -31,7 +32,6 @@ def __init__(self, test_ctx, *args, **kwargs):
test_ctx,
num_brokers=3,
*args,
# disable leader balancer to make sure that group will not be realoaded because of leadership changes
extra_rp_conf={
# clear topics from the the kafka_nodelete_topics to allow for
# __consumer_offsets to be configured in this test.
Expand All @@ -44,7 +44,19 @@ def __init__(self, test_ctx, *args, **kwargs):
def describe_all_groups(self):
rpk = RpkTool(self.redpanda)
all_groups = {}
for g in rpk.group_list():

def do_list_groups():
res = rpk.group_list()
assert res is not None
return False if len(res) == 0 else (True, res)

group_list_res = wait_until_result(
do_list_groups,
timeout_sec=30,
backoff_sec=0.5,
err_msg="RPK failed to list consumer groups")

for g in group_list_res:
gd = rpk.group_describe(g)
all_groups[gd.name] = {}
for p in gd.partitions:
Expand Down

0 comments on commit 817678b

Please sign in to comment.