Skip to content

Commit

Permalink
tests/clients: summary mode for describe group
Browse files Browse the repository at this point in the history
The default mode is rather expensive for high partition counts,
and complicates handling systems in transient states when one
or more of the partitions is likely to be underoing leadership
movement and therefore have NOT_LEADER errors etc in the
default per-partition output.

When all we want to know is the group's state, this lets
us get that.
  • Loading branch information
jcsp committed Aug 8, 2022
1 parent b92846b commit 0c687f9
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions tests/rptest/clients/rpk.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ def group_seek_to(self, group, to):
cmd = ["seek", group, "--to", to]
self._run_group(cmd)

def group_describe(self, group):
def group_describe(self, group, summary=False):
def parse_field(field_name, string):
pattern = re.compile(f" *{field_name} +(?P<value>.+)")
m = pattern.match(string)
Expand All @@ -365,6 +365,11 @@ def check_lines(lines):
# Leadership movements are underway
if 'NOT_LEADER_FOR_PARTITION' in line:
return False

# Cluster not ready yet
if 'unknown broker' in line:
return False

return True

def parse_partition(string):
Expand Down Expand Up @@ -399,7 +404,11 @@ def parse_partition(string):
host=m['host'])

def try_describe_group(group):
cmd = ["describe", group]
if summary:
cmd = ["describe", "-s", group]
else:
cmd = ["describe", group]

try:
out = self._run_group(cmd)
except RpkException as e:
Expand Down

0 comments on commit 0c687f9

Please sign in to comment.