Skip to content

Commit

Permalink
dt/admin_uuid: Integration test for CLI options
Browse files Browse the repository at this point in the history
Signed-off-by: Oren Leiman <oren.leiman@redpanda.com>
  • Loading branch information
oleiman committed Sep 8, 2024
1 parent 309e19e commit 9474132
Showing 1 changed file with 38 additions and 9 deletions.
47 changes: 38 additions & 9 deletions tests/rptest/tests/admin_uuid_operations_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ def scrape_uuid(self, node: ClusterNode) -> str | None:
def _restart_node(self,
node: ClusterNode,
overrides: dict | None = None,
extra_cli: list[str] = [],
drop_disk: bool = False):
self.redpanda.stop_node(node)
if drop_disk:
Expand All @@ -132,10 +133,12 @@ def _restart_node(self,
auto_assign_node_id=True,
omit_seeds_on_idx_one=False,
override_cfg_params=overrides,
extra_cli=extra_cli,
)

@cluster(num_nodes=3)
@parametrize(mode="cfg-override")
@parametrize(mode="cli-override")
@parametrize(mode="no-override")
def test_force_uuid_override(self, mode):
to_stop = self.redpanda.nodes[0]
Expand Down Expand Up @@ -188,6 +191,18 @@ def test_force_uuid_override(self, mode):
], ),
drop_disk=False,
)
elif mode == "cli-override":
self.logger.debug(
f"Override with known-good uuid/id via command line options: {THE_OVERRIDE}"
)
self._restart_node(
to_stop,
extra_cli=[
"--node-id-overrides",
f"{current_uuid}:{old_uuid}:{initial_to_stop_id}",
],
drop_disk=False,
)
elif mode == "no-override":
self.logger.debug(
"Omit the override to confirm that we're still stuck in that case"
Expand Down Expand Up @@ -241,7 +256,9 @@ def test_force_uuid_override(self, mode):
backoff_sec=1)

@cluster(num_nodes=3)
def test_force_uuid_override_multinode(self):
@parametrize(mode="cfg-override")
@parametrize(mode="cli-override")
def test_force_uuid_override_multinode(self, mode):
to_stop = self.redpanda.nodes[1:]
initial_to_stop_ids = [self.redpanda.node_id(n) for n in to_stop]

Expand Down Expand Up @@ -279,14 +296,26 @@ def test_force_uuid_override_multinode(self):
self.logger.debug(
"Restart both nodes again, with overrides. Keep both disks")

self.redpanda.restart_nodes(
to_stop,
override_cfg_params=dict(node_id_overrides=[
dict(current_uuid=current_uuids[n],
new_uuid=old_uuids[initial_to_stop_ids[n]],
new_id=initial_to_stop_ids[n])
for n in range(0, len(to_stop))
], ))
if mode == "cfg-override":
self.redpanda.restart_nodes(
to_stop,
override_cfg_params=dict(node_id_overrides=[
dict(current_uuid=current_uuids[n],
new_uuid=old_uuids[initial_to_stop_ids[n]],
new_id=initial_to_stop_ids[n])
for n in range(0, len(to_stop))
]),
)
elif mode == "cli-override":
self.redpanda.restart_nodes(
to_stop,
extra_cli=[
"--node-id-overrides",
] + [
f"{current_uuids[n]}:{old_uuids[initial_to_stop_ids[n]]}:{initial_to_stop_ids[n]}"
for n in range(0, len(to_stop))
],
)

self.logger.debug(f"Decommission ghost node [{ghost_node_id}]...")

Expand Down

0 comments on commit 9474132

Please sign in to comment.