fixes for latest failures (#19)

This commit is contained in:
Florin Barbu 2024-03-05 08:55:35 +02:00 committed by GitHub
parent 9d769c47d7
commit 7df4741a36
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 54 additions and 20 deletions

View File

@ -1,15 +1,40 @@
allure-pytest allure-pytest==2.13.2
black allure-python-commons==2.13.2
docker attrs==23.1.0
marshmallow-dataclass black==24.2.0
pre-commit certifi==2023.11.17
pyright cfgv==3.4.0
pytest charset-normalizer==3.3.2
pytest-instafail click==8.1.7
pytest-timeout distlib==0.3.8
pytest-xdist docker==7.0.0
pytest-rerunfailures execnet==2.0.2
python-dotenv filelock==3.13.1
requests identify==2.5.33
tenacity idna==3.6
typeguard 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

View File

@ -93,7 +93,7 @@ class StepsFilter:
for index, peer in enumerate(peer_list): for index, peer in enumerate(peer_list):
logger.debug(f"Checking that peer NODE_{index + 1}:{peer.image} can find the published message") 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) 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)}" assert len(get_messages_response) == 1, f"Expected 1 message but got {len(get_messages_response)}"
waku_message = WakuMessage(get_messages_response) waku_message = WakuMessage(get_messages_response)
waku_message.assert_received_message(message) waku_message.assert_received_message(message)
@ -106,6 +106,15 @@ class StepsFilter:
except Exception as ex: 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) 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 @allure.step
def wait_for_subscriptions_on_main_nodes(self, content_topic_list, pubsub_topic=None): def wait_for_subscriptions_on_main_nodes(self, content_topic_list, pubsub_topic=None):
if pubsub_topic is None: if pubsub_topic is None:

View File

@ -111,7 +111,7 @@ class StepsRelay:
for index, peer in enumerate(peer_list): for index, peer in enumerate(peer_list):
logger.debug(f"Checking that peer NODE_{index + 1}:{peer.image} can find the published message") 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) 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)}" assert len(get_messages_response) == 1, f"Expected 1 message but got {len(get_messages_response)}"
waku_message = WakuMessage(get_messages_response) waku_message = WakuMessage(get_messages_response)
waku_message.assert_received_message(message) 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 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) @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)} 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) 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 @allure.step
def ensure_relay_subscriptions_on_nodes(self, node_list, pubsub_topic_list): def ensure_relay_subscriptions_on_nodes(self, node_list, pubsub_topic_list):

View File

@ -13,7 +13,7 @@ class TestFilterMultipleNodes(StepsFilter):
self.setup_optional_filter_nodes() self.setup_optional_filter_nodes()
self.wait_for_subscriptions_on_main_nodes([self.test_content_topic]) self.wait_for_subscriptions_on_main_nodes([self.test_content_topic])
self.subscribe_optional_filter_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): def test_optional_nodes_not_subscribed_to_same_topic(self):
self.setup_optional_filter_nodes() self.setup_optional_filter_nodes()