Skip to content

Commit

Permalink
tests/maintenance_mode: added test for maintenance mode with rf=1
Browse files Browse the repository at this point in the history
Signed-off-by: Michal Maslanka <[email protected]>
  • Loading branch information
mmaslankaprv committed May 25, 2023
1 parent 9fde115 commit 2d3474e
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tests/rptest/tests/maintenance_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# by the Apache License, Version 2.0

import random
from rptest.clients.default import DefaultClient

from rptest.services.admin import Admin
from rptest.tests.redpanda_test import RedpandaTest
Expand Down Expand Up @@ -251,3 +252,31 @@ def test_exclusive_maintenance(self, use_rpk):
raise
else:
raise Exception("Expected maintenance enable to fail")

@cluster(num_nodes=3)
@matrix(use_rpk=[True, False])
def test_maintenance_with_single_replicas(self, use_rpk):
self._use_rpk = use_rpk
single_replica_topic = TopicSpec(partition_count=18,
replication_factor=1)
DefaultClient(self.redpanda).create_topic(single_replica_topic)

target = random.choice(self.redpanda.nodes)

self._enable_maintenance(target)
self.redpanda.restart_nodes(target)
rpk = RpkTool(self.redpanda)

def all_partitions_have_leaders():
partitions = list(
rpk.describe_topic(single_replica_topic.name, tolerant=True))
for p in partitions:
self.logger.info(f"DBG: {p.high_watermark}")
return len(
partitions) == single_replica_topic.partition_count and all(
[p.high_watermark is not None for p in partitions])

wait_until(all_partitions_have_leaders,
30,
backoff_sec=1,
err_msg="Error waiting for all partitions to have leaders")

0 comments on commit 2d3474e

Please sign in to comment.