Skip to content

Commit

Permalink
tests: fixed querying new leader node in leadership transfer test
Browse files Browse the repository at this point in the history
The test was using an api expecting the node ordinal to query for the
node that was elected as a leader. The query was based on the node id.
This lead to the validation being invalid.

Fixes: redpanda-data#19953

Signed-off-by: Michał Maślanka <michal@redpanda.com>
  • Loading branch information
mmaslankaprv committed Jun 27, 2024
1 parent 65f6b39 commit b455334
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/rptest/tests/raft_availability_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,10 +387,12 @@ def test_leadership_transfer(self):
leader_id=initial_leader_id)
new_leader_id, _ = self._wait_for_leader(
lambda l: l is not None and l != initial_leader_id)
new_leader_node = self.redpanda.get_node_by_id(new_leader_id)
assert new_leader_node is not None
self.logger.info(
f"New leader is {new_leader_id} {self.redpanda.get_node(new_leader_id).account.hostname}"
f"New leader is {new_leader_id} {new_leader_node.account.hostname}"
)
time.sleep(ELECTION_TIMEOUT)

for [id, metric_check] in metric_checks.items():
# the metric should be updated only on the node that was elected as a leader
if id == new_leader_id:
Expand Down

0 comments on commit b455334

Please sign in to comment.