From ae43bd444820375c7d05d76ab3e120656b0dde40 Mon Sep 17 00:00:00 2001 From: fbarbu15 Date: Thu, 18 Jul 2024 11:41:20 +0300 Subject: [PATCH] add store retry method (#60) --- src/steps/store.py | 7 +++++++ tests/store/test_reliability.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/steps/store.py b/src/steps/store.py index 972799fdd8..f5d4bde039 100644 --- a/src/steps/store.py +++ b/src/steps/store.py @@ -14,6 +14,7 @@ from src.env_vars import ( from src.node.waku_node import WakuNode from src.steps.common import StepsCommon from src.test_data import VALID_PUBSUB_TOPICS +from tenacity import retry, stop_after_delay, wait_fixed logger = get_custom_logger(__name__) @@ -133,6 +134,12 @@ class StepsStore(StepsCommon): delay(message_propagation_delay) return self.message + @retry(stop=stop_after_delay(30), wait=wait_fixed(1), reraise=True) + @allure.step + def get_messages_from_store_with_retry(self, node): + return self.get_messages_from_store(node, page_size=5) + + @allure.step def get_messages_from_store( self, node=None, diff --git a/tests/store/test_reliability.py b/tests/store/test_reliability.py index 5c3318b9f5..ed1a4e5d37 100644 --- a/tests/store/test_reliability.py +++ b/tests/store/test_reliability.py @@ -94,7 +94,7 @@ class TestReliability(StepsStore): self.store_node1.container.start() self.store_node1.ensure_ready() for node in self.store_nodes: - store_response = self.get_messages_from_store(node, page_size=5) + store_response = self.get_messages_from_store_with_retry(node) assert len(store_response.messages) == 2 def test_message_relayed_while_store_node_is_stopped_and_removed(self, node_setup):