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>
  • Loading branch information
mmaslankaprv committed Jan 31, 2024
1 parent 8d0b584 commit a18fdcd
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 @@ -94,6 +94,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 @@ -106,7 +109,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 a18fdcd

Please sign in to comment.