Skip to content

Commit

Permalink
ducky: fix test_deletion_stops_move ci-failure
Browse files Browse the repository at this point in the history
  • Loading branch information
rystsov committed Jun 23, 2022
1 parent cb8dad2 commit 41e7d2f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
8 changes: 5 additions & 3 deletions tests/rptest/services/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def _get_stable_configuration(
self.redpanda.logger.debug(f"doesn't have leader")
return None
if last_leader < 0:
last_leader = meta["leader_id"]
last_leader = int(meta["leader_id"])
self.redpanda.logger.debug(f"get leader:{last_leader}")
if last_leader not in replicas:
self.redpanda.logger.debug(
Expand Down Expand Up @@ -255,9 +255,11 @@ def is_leader_stable():
info = self.wait_stable_configuration(topic, partition, namespace,
replication, timeout_s,
hosts)
return check(info.leader)
if check(info.leader):
return True, info.leader
return False

wait_until(
return wait_until_result(
is_leader_stable,
timeout_sec=timeout_s,
backoff_sec=1,
Expand Down
20 changes: 19 additions & 1 deletion tests/rptest/tests/partition_movement_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,25 @@ def test_deletion_stops_move(self):
# shutdown target node to make sure that move will never complete
node = self.redpanda.get_node(replacement['node_id'])
self.redpanda.stop_node(node)
admin.set_partition_replicas(topic, partition, target_assignment)

# checking that a controller has leader (just in case
# the stopped node happened to be previous leader)
alive_hosts = [
n.account.hostname for n in self.redpanda.nodes if n != node
]
controller_leader = admin.await_stable_leader(
topic="controller",
partition=0,
namespace="redpanda",
hosts=alive_hosts,
check=lambda node_id: node_id != self.redpanda.idx(node),
timeout_s=30)
controller_leader = self.redpanda.get_node(controller_leader)

admin.set_partition_replicas(topic,
partition,
target_assignment,
node=controller_leader)

# check that the status is in progress

Expand Down

0 comments on commit 41e7d2f

Please sign in to comment.