Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

E2E_Tests_CI_FIX #85

Merged
merged 25 commits into from
Nov 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
63348d6
add draft test case
AYAHASSAN287 Oct 30, 2024
a406586
Adding test test_filter_3_senders_1_receiver
AYAHASSAN287 Oct 31, 2024
40fa4a3
Adding test test_filter_3_senders_45_msg_1_receiver
AYAHASSAN287 Oct 31, 2024
810cd6c
add test test_filter_50_subscribe_node
AYAHASSAN287 Oct 31, 2024
39b8a2b
Remove comments and enhance tests
AYAHASSAN287 Nov 3, 2024
e9386bf
Increase node limit to 1000 connection
AYAHASSAN287 Nov 4, 2024
88a3882
making PR ready with 3 tests
AYAHASSAN287 Nov 6, 2024
64a2315
Making changes for go-waku to pass
AYAHASSAN287 Nov 6, 2024
d3c59f3
Merge branch 'master' into E2E_tests_part2
AYAHASSAN287 Nov 6, 2024
048e617
Adding changes to make go-waku tests pass
AYAHASSAN287 Nov 6, 2024
fe2bd97
Change max nodes to 20 when node_2 = go-waku
AYAHASSAN287 Nov 6, 2024
e50150a
Fix CI failure because of nwaku
AYAHASSAN287 Nov 6, 2024
9ae09a3
Increase wait time for filter request
AYAHASSAN287 Nov 6, 2024
254c160
Decrease number of nodes to pass the CI
AYAHASSAN287 Nov 6, 2024
a002fa5
Add more wait to pass CI
AYAHASSAN287 Nov 6, 2024
9c045a7
time_limit increase to 120 to pass CI
AYAHASSAN287 Nov 6, 2024
3c33fc2
add flag filter-subscription-timeout to 600 instead of default value 300
AYAHASSAN287 Nov 7, 2024
ccc6721
Additional changes for CI failure
AYAHASSAN287 Nov 7, 2024
4afa5aa
remove filter = true from subscribed filter node
AYAHASSAN287 Nov 7, 2024
d2348c8
increase nodes to 15 in test_filter_many_subscribed_nodes
AYAHASSAN287 Nov 7, 2024
5a0feec
test_filter_3_senders_multiple_msg_1_receiver
AYAHASSAN287 Nov 7, 2024
27a5d6f
change max-connections to 50 instead of 1000
AYAHASSAN287 Nov 7, 2024
c3a635a
commenting max-connection and filter timeout for CI failure
AYAHASSAN287 Nov 7, 2024
33bd712
Revert timeout back to 20
AYAHASSAN287 Nov 7, 2024
83f0c3d
Merge branch 'master' into E2E_CI_FIX
AYAHASSAN287 Nov 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/env_vars.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def get_env_var(var_name, default=None):
# Configuration constants. Need to be upercase to appear in reports
DEFAULT_NWAKU = "wakuorg/nwaku:latest"
DEFAULT_GOWAKU = "wakuorg/go-waku:latest"
STRESS_ENABLED = False
NODE_1 = get_env_var("NODE_1", DEFAULT_NWAKU)
NODE_2 = get_env_var("NODE_2", DEFAULT_NWAKU)
ADDITIONAL_NODES = get_env_var("ADDITIONAL_NODES", f"{DEFAULT_NWAKU},{DEFAULT_GOWAKU},{DEFAULT_NWAKU}")
Expand Down
2 changes: 2 additions & 0 deletions src/node/waku_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ def start(self, wait_for_node_sec=20, **kwargs):
"rln-creds-id": None,
"rln-creds-source": None,
"nodekey": self.generate_random_nodekey(),
# "max-connections": "50",
# "filter-subscription-timeout": "600",
}

if self.is_gowaku():
Expand Down
127 changes: 126 additions & 1 deletion tests/e2e/test_e2e.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from src.env_vars import NODE_1, NODE_2
from src.env_vars import NODE_1, NODE_2, STRESS_ENABLED
from src.libs.common import delay
from src.libs.custom_logger import get_custom_logger
from src.node.waku_node import WakuNode
Expand Down Expand Up @@ -178,6 +178,131 @@ def test_chain_of_relay_nodes(self):
# self.node1 relays and we check that self.node10 receives the message
self.check_published_message_reaches_relay_peer(sender=self.node1, peer_list=[self.node10], message_propagation_delay=1)

@pytest.mark.timeout(60 * 7)
def test_filter_20_senders_1_receiver(self):
total_senders = 20
if "go-waku" in NODE_2:
total_senders = 10
node_list = []

logger.debug(f"Start {total_senders} nodes to publish messages ")
self.node1.start(relay="true")
node_list.append(self.node1)
for i in range(total_senders - 1):
node_list.append(WakuNode(NODE_2, f"node{i + 1}_{self.test_id}"))
delay(0.1)
node_list[i + 1].start(relay="true", discv5_bootstrap_node=node_list[i].get_enr_uri())
delay(3)

logger.debug(f"Start filter node and subscribed filter node ")
self.node21 = WakuNode(NODE_1, f"node21_{self.test_id}")
self.node22 = WakuNode(NODE_1, f"node22_{self.test_id}")
self.node21.start(relay="true", filter="true", store="false", discv5_bootstrap_node=node_list[total_senders - 1].get_enr_uri())
self.node22.start(
relay="false", filter="true", filternode=self.node21.get_multiaddr_with_id(), store="false", discv5_bootstrap_node=self.node21
)

node_list.append(self.node21)

logger.debug(f"Subscribe nodes to relay pubsub topic {self.test_pubsub_topic}")
for node in node_list:
node.set_relay_subscriptions([self.test_pubsub_topic])
logger.debug(f"Node22 make filter request to pubsubtopic {self.test_pubsub_topic} and content topic {self.test_content_topic}")
self.node22.set_filter_subscriptions({"requestId": "1", "contentFilters": [self.test_content_topic], "pubsubTopic": self.test_pubsub_topic})
self.wait_for_autoconnection(node_list, hard_wait=80)

logger.debug(f"{total_senders} Nodes publish {total_senders} messages")
for node in node_list[:-1]:
self.publish_message(sender=node, pubsub_topic=self.test_pubsub_topic, message=self.create_message())
delay(1)

logger.debug("Node 22 requests messages of subscribed filter topic")
messages_response = self.get_filter_messages(self.test_content_topic, pubsub_topic=self.test_pubsub_topic, node=self.node22)

logger.debug(f"Total number received messages for node 22 is {len(messages_response)}")
assert len(messages_response) == total_senders, f"Received messages != published which is {total_senders} !!"

@pytest.mark.timeout(60 * 7)
def test_filter_3_senders_multiple_msg_1_receiver(self):
messages_num = 12
total_senders = 3
self.node4 = WakuNode(NODE_1, f"node4_{self.test_id}")
self.node5 = WakuNode(NODE_1, f"node5_{self.test_id}")
node_list = []

logger.debug("Start 5 nodes")
self.node1.start(relay="true", store="false")
self.node2.start(relay="true", store="false", discv5_bootstrap_node=self.node1.get_enr_uri())
self.node3.start(relay="true", store="false", filter="true", discv5_bootstrap_node=self.node2.get_enr_uri())
self.node4.start(relay="true", filter="true", store="false", discv5_bootstrap_node=self.node3.get_enr_uri())
self.node5.start(relay="false", filternode=self.node4.get_multiaddr_with_id(), store="false", discv5_bootstrap_node=self.node3.get_enr_uri())

logger.debug(f"Subscribe nodes to relay pubsub topic {self.test_pubsub_topic}")
node_list = [self.node1, self.node2, self.node3, self.node4]
for node in node_list:
node.set_relay_subscriptions([self.test_pubsub_topic])

logger.debug(f"Node5 makes filter request pubsubtopic {self.test_pubsub_topic} and content topic {self.test_content_topic}")
self.node5.set_filter_subscriptions({"requestId": "1", "contentFilters": [self.test_content_topic], "pubsubTopic": self.test_pubsub_topic})
node_list.append(self.node5)
self.wait_for_autoconnection(node_list, hard_wait=60)

logger.debug(f" {total_senders} Nodes publish {messages_num} message")
for node in node_list[:-2]:
for i in range(messages_num // total_senders):
self.publish_message(sender=node, pubsub_topic=self.test_pubsub_topic, message=self.create_message())
delay(2)

logger.debug(f"Node5 requests messages of subscribed filter topic {self.test_pubsub_topic}")
messages_response = self.get_filter_messages(self.test_content_topic, pubsub_topic=self.test_pubsub_topic, node=self.node5)
logger.debug(f"Response for node 5 is {messages_response}")
assert len(messages_response) == messages_num, f"Received messages != published which is{messages_num} !!"

@pytest.mark.timeout(60 * 5)
def test_filter_many_subscribed_nodes(self):
max_subscribed_nodes = 15
if STRESS_ENABLED:
max_subscribed_nodes = 50
node_list = []
response_list = []
logger.debug("Start 2 nodes")
self.node1.start(relay="true", store="false")
self.node2.start(relay="true", filter="true", store="false", discv5_bootstrap_node=self.node1.get_enr_uri())

logger.debug(f"Subscribe nodes to relay pubsub topic {self.test_pubsub_topic}")
node_list_relay = [self.node1, self.node2]
for node in node_list_relay:
node.set_relay_subscriptions([self.test_pubsub_topic])

node_list.append(self.node2)
logger.debug(f"{max_subscribed_nodes} Node start and making filter requests to node2")
for i in range(max_subscribed_nodes):
node_list.append(WakuNode(NODE_2, f"node{i+2}_{self.test_id}"))
delay(0.1)
node_list[i + 1].start(
relay="false",
filternode=self.node2.get_multiaddr_with_id(),
discv5_bootstrap_node=node_list[i].get_enr_uri(),
store="false",
)
delay(1)
node_list[i + 1].set_filter_subscriptions(
{"requestId": "1", "contentFilters": [self.test_content_topic], "pubsubTopic": self.test_pubsub_topic}
)
self.wait_for_autoconnection(node_list_relay, hard_wait=100)

logger.debug("Node1 publish message")
self.publish_message(sender=self.node1, pubsub_topic=self.test_pubsub_topic, message=self.create_message())
delay(4)

logger.debug(f"{max_subscribed_nodes} Node requests the published message of subscribed filter topic")
for i in range(max_subscribed_nodes):
messages_response = self.get_filter_messages(self.test_content_topic, pubsub_topic=self.test_pubsub_topic, node=node_list[i + 1])
logger.debug(f"Response for node {i+1} is {messages_response}")
response_list.append(messages_response)

assert len(response_list) == max_subscribed_nodes, "Received message count doesn't match sent "

@pytest.mark.skipif("go-waku" in NODE_2, reason="Test works only with nwaku")
def test_store_filter_interaction_with_six_nodes(self):
logger.debug("Create 6 nodes")
Expand Down
Loading