Skip to content

Commit

Permalink
tests: fixed waiting for new controller to be elected
Browse files Browse the repository at this point in the history
We need to wait for the new controller to be elected if the stopped node
was the one before. Retry policy in admin client would fail as all the
requested nodes would redirect request to old controller which is
unavailable.

Fixes: redpanda-data#5695

Signed-off-by: Michal Maslanka <michal@redpanda.com>
  • Loading branch information
mmaslankaprv committed Jul 29, 2022
1 parent b1f224c commit 814aae4
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion tests/rptest/tests/partition_movement_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,16 @@ def test_availability_when_one_node_down(self):
self.logger.info(f"stopping node: {to_stop}")
self.redpanda.stop_node(self.redpanda.get_node(to_stop))

wait_until(lambda: self.redpanda.controller() != to_stop, 30, 1)
def new_controller_available():
controller_id = admin.get_partition_leader(namespace="redpanda",
topic="controller",
partition=0)
self.logger.debug(
f"current controller: {controller_id}, stopped node: {to_stop}"
)
return controller_id != -1 and controller_id != to_stop

wait_until(new_controller_available, 30, 1)
# ask partition to move
admin.set_partition_replicas(self.topic, partition_id, assignments)

Expand Down

0 comments on commit 814aae4

Please sign in to comment.