Skip to content

Commit

Permalink
Merge pull request #23158 from ztlpn/fix-CORE-6851
Browse files Browse the repository at this point in the history
tests/shard_placement_test: check total counts in rebalance_finished predicate
  • Loading branch information
ztlpn authored Sep 2, 2024
2 parents 89055f9 + ff4167b commit c8f4d7d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/rptest/tests/shard_placement_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -604,11 +604,23 @@ def shard_rebalance_finished():
node_id = self.redpanda.node_id(n)
shard_counts = self.get_shard_counts_by_topic(
shard_map, node_id)

total_counts = None
for topic in topics:
topic_counts = shard_counts[topic]

if total_counts is None:
total_counts = topic_counts
else:
for s, c in enumerate(topic_counts):
total_counts[s] += c

if max(topic_counts) - min(topic_counts) > 1:
return False

if max(total_counts) - min(total_counts) > 1:
return False

return (True, shard_map)

shard_map_after_balance = wait_until_result(shard_rebalance_finished,
Expand Down

0 comments on commit c8f4d7d

Please sign in to comment.