From 814aae40b4b367ec65dfc7201ad5df3aa55704a0 Mon Sep 17 00:00:00 2001 From: Michal Maslanka Date: Fri, 29 Jul 2022 13:16:10 +0200 Subject: [PATCH] tests: fixed waiting for new controller to be elected 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: #5695 Signed-off-by: Michal Maslanka --- tests/rptest/tests/partition_movement_test.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/rptest/tests/partition_movement_test.py b/tests/rptest/tests/partition_movement_test.py index 6725ab2ddb9e..4a3b8359bb17 100644 --- a/tests/rptest/tests/partition_movement_test.py +++ b/tests/rptest/tests/partition_movement_test.py @@ -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)