diff --git a/requirements.txt b/requirements.txt index bab8931349..c7e692cb23 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,15 +1,40 @@ -allure-pytest -black -docker -marshmallow-dataclass -pre-commit -pyright -pytest -pytest-instafail -pytest-timeout -pytest-xdist -pytest-rerunfailures -python-dotenv -requests -tenacity -typeguard \ No newline at end of file +allure-pytest==2.13.2 +allure-python-commons==2.13.2 +attrs==23.1.0 +black==24.2.0 +certifi==2023.11.17 +cfgv==3.4.0 +charset-normalizer==3.3.2 +click==8.1.7 +distlib==0.3.8 +docker==7.0.0 +execnet==2.0.2 +filelock==3.13.1 +identify==2.5.33 +idna==3.6 +iniconfig==2.0.0 +marshmallow==3.20.1 +marshmallow-dataclass==8.6.0 +mypy-extensions==1.0.0 +nodeenv==1.8.0 +packaging==23.2 +pathspec==0.12.1 +platformdirs==4.1.0 +pluggy==1.3.0 +pre-commit==3.6.2 +pyright==1.1.352 +pytest==8.0.2 +pytest-instafail==0.5.0 +pytest-rerunfailures==13.0 +pytest-timeout==2.2.0 +pytest-xdist==3.5.0 +python-dotenv==1.0.1 +PyYAML==6.0.1 +requests==2.31.0 +setuptools==69.0.3 +tenacity==8.2.3 +typeguard==4.1.5 +typing-inspect==0.9.0 +typing_extensions==4.9.0 +urllib3==2.1.0 +virtualenv==20.25.0 diff --git a/src/steps/filter.py b/src/steps/filter.py index 8f0b34d526..3683dfee9f 100644 --- a/src/steps/filter.py +++ b/src/steps/filter.py @@ -93,7 +93,7 @@ class StepsFilter: for index, peer in enumerate(peer_list): logger.debug(f"Checking that peer NODE_{index + 1}:{peer.image} can find the published message") get_messages_response = self.get_filter_messages(message["contentTopic"], pubsub_topic=pubsub_topic, node=peer) - assert get_messages_response, f"Peer NODE_{index}:{peer.image} couldn't find any messages" + assert get_messages_response, f"Peer NODE_{index + 1}:{peer.image} couldn't find any messages" assert len(get_messages_response) == 1, f"Expected 1 message but got {len(get_messages_response)}" waku_message = WakuMessage(get_messages_response) waku_message.assert_received_message(message) @@ -106,6 +106,15 @@ class StepsFilter: except Exception as ex: assert "Bad Request" in str(ex) or "Not Found" in str(ex) or "couldn't find any messages" in str(ex) + @allure.step + def wait_for_published_message_to_reach_filter_peer(self, timeout_duration=120, time_between_retries=1, pubsub_topic=None, peer_list=None): + @retry(stop=stop_after_delay(timeout_duration), wait=wait_fixed(time_between_retries), reraise=True) + def publish_and_check_filter_peer(): + message = {"payload": to_base64(self.test_payload), "contentTopic": self.test_content_topic, "timestamp": int(time() * 1e9)} + self.check_publish_without_filter_subscription(message, pubsub_topic=pubsub_topic, peer_list=peer_list) + + publish_and_check_filter_peer() + @allure.step def wait_for_subscriptions_on_main_nodes(self, content_topic_list, pubsub_topic=None): if pubsub_topic is None: diff --git a/src/steps/relay.py b/src/steps/relay.py index 8ed7b55ed3..753bd5343e 100644 --- a/src/steps/relay.py +++ b/src/steps/relay.py @@ -111,7 +111,7 @@ class StepsRelay: for index, peer in enumerate(peer_list): logger.debug(f"Checking that peer NODE_{index + 1}:{peer.image} can find the published message") get_messages_response = peer.get_relay_messages(pubsub_topic) - assert get_messages_response, f"Peer NODE_{index}:{peer.image} couldn't find any messages" + assert get_messages_response, f"Peer NODE_{index + 1}:{peer.image} couldn't find any messages" assert len(get_messages_response) == 1, f"Expected 1 message but got {len(get_messages_response)}" waku_message = WakuMessage(get_messages_response) waku_message.assert_received_message(message) @@ -130,11 +130,11 @@ class StepsRelay: self, timeout_duration=120, time_between_retries=1, pubsub_topic=None, sender=None, peer_list=None ): @retry(stop=stop_after_delay(timeout_duration), wait=wait_fixed(time_between_retries), reraise=True) - def check_peer_connection(): + def publish_and_check_relay_peer(): message = {"payload": to_base64(self.test_payload), "contentTopic": self.test_content_topic, "timestamp": int(time() * 1e9)} self.check_published_message_reaches_relay_peer(message, pubsub_topic=pubsub_topic, sender=sender, peer_list=peer_list) - check_peer_connection() + publish_and_check_relay_peer() @allure.step def ensure_relay_subscriptions_on_nodes(self, node_list, pubsub_topic_list): diff --git a/tests/filter/test_multiple_nodes.py b/tests/filter/test_multiple_nodes.py index f35e81bdc1..2bd0288a85 100644 --- a/tests/filter/test_multiple_nodes.py +++ b/tests/filter/test_multiple_nodes.py @@ -13,7 +13,7 @@ class TestFilterMultipleNodes(StepsFilter): self.setup_optional_filter_nodes() self.wait_for_subscriptions_on_main_nodes([self.test_content_topic]) self.subscribe_optional_filter_nodes([self.test_content_topic]) - self.check_published_message_reaches_filter_peer() + self.wait_for_published_message_to_reach_filter_peer() def test_optional_nodes_not_subscribed_to_same_topic(self): self.setup_optional_filter_nodes()