diff --git a/src/steps/relay.py b/src/steps/relay.py index b59684a3..e5d238bd 100644 --- a/src/steps/relay.py +++ b/src/steps/relay.py @@ -122,3 +122,9 @@ class StepsRelay: message = {"payload": to_base64(self.test_payload), "contentTopic": self.test_content_topic, "timestamp": int(time() * 1e9)} message.update(kwargs) return message + + @allure.step + @retry(stop=stop_after_delay(30), wait=wait_fixed(1), reraise=True) + def subscribe_and_publish_with_retry(self, node_list, pubsub_topic_list): + self.ensure_relay_subscriptions_on_nodes(node_list, pubsub_topic_list) + self.check_published_message_reaches_relay_peer() diff --git a/tests/filter/test_get_messages.py b/tests/filter/test_get_messages.py index 2b926550..f0741a8b 100644 --- a/tests/filter/test_get_messages.py +++ b/tests/filter/test_get_messages.py @@ -1,5 +1,5 @@ import pytest -from src.env_vars import NODE_1 +from src.env_vars import NODE_1, NODE_2 from src.libs.common import delay, to_base64 from src.libs.custom_logger import get_custom_logger from src.test_data import SAMPLE_INPUTS, SAMPLE_TIMESTAMPS @@ -39,7 +39,7 @@ class TestFilterGetMessages(StepsFilter): def test_filter_get_message_with_version(self): self.check_published_message_reaches_filter_peer(self.create_message(version=10)) - @pytest.mark.xfail("nwaku" in NODE_1, reason="Bug reported: https://github.com/waku-org/nwaku/issues/2214") + @pytest.mark.xfail("nwaku" in NODE_1 or "nwaku" in NODE_2, reason="Bug reported: https://github.com/waku-org/nwaku/issues/2214") def test_filter_get_message_with_meta(self): self.check_published_message_reaches_filter_peer(self.create_message(meta=to_base64(self.test_payload))) diff --git a/tests/relay/test_publish.py b/tests/relay/test_publish.py index add9261f..e1c2b2c5 100644 --- a/tests/relay/test_publish.py +++ b/tests/relay/test_publish.py @@ -1,5 +1,5 @@ import pytest -from src.env_vars import NODE_1 +from src.env_vars import NODE_1, NODE_2 from src.libs.custom_logger import get_custom_logger from time import time from src.libs.common import delay, to_base64 @@ -158,7 +158,7 @@ class TestRelayPublish(StepsRelay): except Exception as ex: assert "Bad Request" in str(ex) - @pytest.mark.xfail("nwaku" in NODE_1, reason="Bug reported: https://github.com/waku-org/nwaku/issues/2214") + @pytest.mark.xfail("nwaku" in NODE_1 or "nwaku" in NODE_2, reason="Bug reported: https://github.com/waku-org/nwaku/issues/2214") def test_publish_with_valid_meta(self): self.check_published_message_reaches_relay_peer(self.create_message(meta=to_base64(self.test_payload))) @@ -235,9 +235,7 @@ class TestRelayPublish(StepsRelay): self.check_published_message_reaches_relay_peer() self.node1.restart() self.node1.ensure_ready() - delay(2) - self.ensure_relay_subscriptions_on_nodes(self.main_nodes, [self.test_pubsub_topic]) - self.check_published_message_reaches_relay_peer() + self.subscribe_and_publish_with_retry(self.main_nodes, [self.test_pubsub_topic]) def test_publish_after_node2_restarts(self): self.check_published_message_reaches_relay_peer()