Skip to content

Commit

Permalink
tests: restart producer swarm if needed
Browse files Browse the repository at this point in the history
Sometimes it may happen that producer swarm is stopped after topic is
recreated leading to a test failure. Added check restarting the producer
if necessary

Signed-off-by: Michal Maslanka <michal@redpanda.com>
(cherry picked from commit a18fdcd)
  • Loading branch information
mmaslankaprv authored and Michal Maslanka committed Feb 6, 2024
1 parent df6a492 commit febbfa5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tests/rptest/tests/topic_creation_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ def test_topic_recreation_while_producing(self, workload, cleanup_policy):
rpk = RpkTool(self.redpanda)

def topic_is_healthy():
if not swarm.is_alive(swarm.nodes[0]):
swarm.stop()
swarm.start()
partitions = rpk.describe_topic(spec.name)
hw_offsets = [p.high_watermark for p in partitions]
offsets_present = [hw > 0 for hw in hw_offsets]
Expand All @@ -107,7 +110,10 @@ def topic_is_healthy():
self.client().delete_topic(spec.name)
spec.replication_factor = rf
self.client().create_topic(spec)
wait_until(topic_is_healthy, 30, 2)
wait_until(topic_is_healthy,
30,
2,
err_msg=f"Topic {spec.name} health")
sleep(5)

swarm.stop()
Expand Down

0 comments on commit febbfa5

Please sign in to comment.