redpanda icon indicating copy to clipboard operation
redpanda copied to clipboard

tests: use node_id() instead of idx()

Open andrwng opened this issue 3 years ago • 0 comments

We currently configure Redpanda test nodes such that they get assigned node IDs based on their idx() values. Moving forward, as we consider weaning off of manually assigning node ID, it'll be critical that we never conflate node_id() and idx(). This commit takes a stab at removing most usages of idx(), leaving only a couple where they seem appropriate.

A counterpart to idx() is get_node() which returns a node by its index; this commit adds a get_node_by_id() and starts using it where appropriate.

Note that we have a mapping of node IDs to idx that gets updated when nodes start up, so the node ID lookups shouldn't be expensive.

Backports Required

  • [x] none - not a bug fix
  • [ ] none - issue does not exist in previous branches
  • [ ] none - papercut/not impactful enough to backport
  • [ ] v22.3.x
  • [ ] v22.2.x
  • [ ] v22.1.x

UX Changes

Release Notes

andrwng avatar Nov 18 '22 02:11 andrwng