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 vbotbuildovich committed Feb 1, 2024
1 parent 599d161 commit ca73a7c
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 @@ -93,6 +93,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 @@ -105,7 +108,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 ca73a7c

Please sign in to comment.