From ca73a7c669f2407ec53a73bf8be66f8bb3f89401 Mon Sep 17 00:00:00 2001 From: Michal Maslanka Date: Mon, 29 Jan 2024 09:51:47 +0100 Subject: [PATCH] tests: restart producer swarm if needed 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 (cherry picked from commit a18fdcd6c621b972d6b858cf10cce266c18c9038) --- tests/rptest/tests/topic_creation_test.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/rptest/tests/topic_creation_test.py b/tests/rptest/tests/topic_creation_test.py index dc5f8098ea6dc..c3869790c1436 100644 --- a/tests/rptest/tests/topic_creation_test.py +++ b/tests/rptest/tests/topic_creation_test.py @@ -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] @@ -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()