mirror of
https://github.com/logos-messaging/logos-messaging-interop-tests.git
synced 2026-01-10 18:03:07 +00:00
filter push tests
This commit is contained in:
parent
d7be7e9504
commit
2881b1b209
26
.github/pull_request_template.md
vendored
26
.github/pull_request_template.md
vendored
@ -1,27 +1,9 @@
|
||||
## Problem
|
||||
## PR Details
|
||||
|
||||
<!--
|
||||
Describe in details the problem or scenario that this PR is fixing.
|
||||
|
||||
If this is a feature addition or change, then focus on the WHY you are making the change.
|
||||
|
||||
If this is a bug fix, please describe why the old behavior was problematic.
|
||||
Describe in details the feature or scenario that this PR is automating tests for.
|
||||
-->
|
||||
|
||||
## Solution
|
||||
## Issues reported:
|
||||
|
||||
<!-- describe the new behavior -->
|
||||
|
||||
## Diffs
|
||||
|
||||
<!--
|
||||
Are there any diffs between implementations (nwaku vs gowaku)?
|
||||
If yes they should be documented here: https://www.notion.so/Nwaku-vs-Gowaku-vs-Jswaku-diffs-b3e0e8f1e6cd4c6d9855b0c3c4634bc5
|
||||
-->
|
||||
|
||||
## Notes
|
||||
|
||||
<!-- Remove items that are not relevant -->
|
||||
|
||||
- Resolves <issue number>
|
||||
- Related to <link to specs>
|
||||
<!-- Issues found while working for this PR -->
|
||||
|
||||
@ -67,6 +67,7 @@ class WakuNode:
|
||||
"min-relay-peers-to-publish": "1",
|
||||
"legacy-filter": "false",
|
||||
"log-level": "DEBUG",
|
||||
"rest-filter-cache-capacity": "50",
|
||||
}
|
||||
default_args.update(go_waku_args)
|
||||
elif self.is_nwaku():
|
||||
|
||||
@ -92,7 +92,7 @@ class StepsFilter:
|
||||
delay(message_propagation_delay)
|
||||
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_topics=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 len(get_messages_response) == 1, f"Expected 1 message but got {len(get_messages_response)}"
|
||||
waku_message = WakuMessage(get_messages_response)
|
||||
@ -175,8 +175,16 @@ class StepsFilter:
|
||||
node = self.node2
|
||||
ping_sub_response = node.ping_filter_subscriptions(request_id)
|
||||
assert ping_sub_response["requestId"] == request_id
|
||||
assert ping_sub_response["statusCode"] == 0
|
||||
assert ping_sub_response["statusDesc"] in ["OK", ""] # until https://github.com/waku-org/nwaku/issues/2286 is fixed
|
||||
|
||||
def ping_without_filter_subscription(self, node=None):
|
||||
try:
|
||||
self.ping_filter_subscriptions(str(uuid4()), node=node)
|
||||
raise AssertionError("Ping without any subscription worked")
|
||||
except Exception as ex:
|
||||
assert "peer has no subscriptions" in str(ex)
|
||||
|
||||
@allure.step
|
||||
def add_new_relay_subscription(self, pubsub_topics, node=None):
|
||||
if node is None:
|
||||
@ -184,11 +192,11 @@ class StepsFilter:
|
||||
self.node1.set_relay_subscriptions(pubsub_topics)
|
||||
|
||||
@allure.step
|
||||
def get_filter_messages(self, content_topic, pubsub_topics=None, node=None):
|
||||
def get_filter_messages(self, content_topic, pubsub_topic=None, node=None):
|
||||
if node is None:
|
||||
node = self.node2
|
||||
if node.is_gowaku():
|
||||
return node.get_filter_messages(content_topic, pubsub_topics)
|
||||
return node.get_filter_messages(content_topic, pubsub_topic)
|
||||
elif node.is_nwaku():
|
||||
return node.get_filter_messages(content_topic)
|
||||
else:
|
||||
|
||||
@ -19,3 +19,32 @@ class TestFilterMultipleNodes(StepsFilter):
|
||||
self.subscribe_optional_filter_nodes([self.second_content_topic])
|
||||
self.check_published_message_reaches_filter_peer(peer_list=self.main_nodes)
|
||||
self.check_publish_without_filter_subscription(peer_list=self.optional_nodes)
|
||||
|
||||
def test_filter_get_message_while_one_peer_is_paused(self):
|
||||
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()
|
||||
relay_message1 = self.create_message(contentTopic=self.test_content_topic)
|
||||
relay_message2 = self.create_message(contentTopic=self.test_content_topic)
|
||||
self.node2.pause()
|
||||
self.node1.send_relay_message(relay_message1, self.test_pubsub_topic)
|
||||
self.node2.unpause()
|
||||
self.node1.send_relay_message(relay_message2, self.test_pubsub_topic)
|
||||
filter_messages = self.get_filter_messages(content_topic=self.test_content_topic, pubsub_topic=self.test_pubsub_topic, node=self.node2)
|
||||
assert len(filter_messages) == 2, "Both messages should've been returned"
|
||||
|
||||
def test_filter_get_message_after_one_peer_was_stopped(self):
|
||||
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(peer_list=self.main_nodes + self.optional_nodes)
|
||||
self.node2.stop()
|
||||
self.check_published_message_reaches_filter_peer(peer_list=self.optional_nodes)
|
||||
|
||||
def test_ping_some_nodes_have_and_so_not_subscribed_to_same_topic(self):
|
||||
self.setup_optional_filter_nodes()
|
||||
self.wait_for_subscriptions_on_main_nodes([self.test_content_topic])
|
||||
self.ping_filter_subscriptions("1", node=self.node2)
|
||||
for node in self.optional_nodes:
|
||||
self.ping_without_filter_subscription(node=node)
|
||||
|
||||
@ -17,3 +17,19 @@ class TestRelayMultipleNodes(StepsRelay):
|
||||
raise AssertionError("Non subscribed nodes received the message!!")
|
||||
except Exception as ex:
|
||||
assert "Not Found" in str(ex), "Expected 404 Not Found when the message is not found"
|
||||
|
||||
def test_relay_get_message_while_one_peer_is_paused(self, subscribe_optional_relay_nodes, relay_warm_up):
|
||||
self.check_published_message_reaches_relay_peer()
|
||||
relay_message1 = self.create_message(contentTopic=self.test_content_topic)
|
||||
relay_message2 = self.create_message(contentTopic=self.test_content_topic)
|
||||
self.node2.pause()
|
||||
self.node1.send_relay_message(relay_message1, self.test_pubsub_topic)
|
||||
self.node2.unpause()
|
||||
self.node1.send_relay_message(relay_message2, self.test_pubsub_topic)
|
||||
messages = self.node2.get_relay_messages(self.test_pubsub_topic)
|
||||
assert len(messages) == 2, "Both messages should've been returned"
|
||||
|
||||
def test_relay_get_message_after_one_peer_was_stopped(self, subscribe_optional_relay_nodes, relay_warm_up):
|
||||
self.check_published_message_reaches_relay_peer(peer_list=self.main_nodes + self.optional_nodes)
|
||||
self.node2.stop()
|
||||
self.check_published_message_reaches_relay_peer(peer_list=self.optional_nodes)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user