Remove comments and enhance tests

This commit is contained in:
aya 2024-11-03 13:38:50 +02:00
parent 810cd6cb4d
commit 39b8a2bd04
2 changed files with 12 additions and 48 deletions

View File

@ -123,7 +123,7 @@ class WakuNode:
go_waku_args = {
"min-relay-peers-to-publish": "1",
"log-level": "DEBUG",
"rest-filter-cache-capacity": "60",
"rest-filter-cache-capacity": "50",
"peer-store-capacity": "10",
}
default_args.update(go_waku_args)

View File

@ -178,40 +178,6 @@ class TestE2E(StepsFilter, StepsStore, StepsRelay, StepsLightPush):
# 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)
def test_filter_3_senders_3_msg_1_receiver(self):
messages_num = 3
self.node4 = WakuNode(NODE_2, f"node3_{self.test_id}")
self.node5 = WakuNode(NODE_2, f"node3_{self.test_id}")
logger.debug("Start 5 nodes")
self.node1.start(relay="true", store="true")
self.node2.start(relay="true", store="false", discv5_bootstrap_node=self.node1.get_enr_uri())
self.node3.start(relay="true", store="true", 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", filter="true", 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])
self.wait_for_autoconnection(node_list, hard_wait=30)
logger.debug(f"Node5 make filter request pubtopic {self.test_pubsub_topic} " f"{self.test_content_topic}and content topic ")
self.node5.set_filter_subscriptions({"requestId": "1", "contentFilters": [self.test_content_topic], "pubsubTopic": self.test_pubsub_topic})
delay(1)
logger.debug("3 Nodes publish 3 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("Node5 requests messages of subscribed filter 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 {len(messages_response)}")
assert len(messages_response) == messages_num, f"Received messages != published which is{messages_num} !!"
def test_filter_3_senders_1_receiver(self):
messages_num = 3
self.node4 = WakuNode(NODE_2, f"node3_{self.test_id}")
@ -257,8 +223,8 @@ class TestE2E(StepsFilter, StepsStore, StepsRelay, StepsLightPush):
node_list = []
logger.debug("Start 5 nodes")
self.node1.start(relay="true", store="true")
# self.node2.start(relay="true", store="false", discv5_bootstrap_node=self.node1.get_enr_uri())
# self.node3.start(relay="true", store="true", filter="true", discv5_bootstrap_node=self.node2.get_enr_uri())
self.node2.start(relay="true", store="false", discv5_bootstrap_node=self.node1.get_enr_uri())
self.node3.start(relay="true", store="true", filter="true", discv5_bootstrap_node=self.node2.get_enr_uri())
self.node4.start(relay="true", filter="true", store="false", discv5_bootstrap_node=self.node1.get_enr_uri())
self.node5.start(
relay="false", filter="true", filternode=self.node4.get_multiaddr_with_id(), store="false", discv5_bootstrap_node=self.node3.get_enr_uri()
@ -292,15 +258,13 @@ class TestE2E(StepsFilter, StepsStore, StepsRelay, StepsLightPush):
node_list = []
logger.debug("Start 5 nodes")
self.node1.start(relay="true", store="true")
# self.node2.start(relay="true", store="false", discv5_bootstrap_node=self.node1.get_enr_uri())
# self.node3.start(relay="true", store="true", filter="true", discv5_bootstrap_node=self.node2.get_enr_uri())
self.node4.start(relay="true", filter="true", store="false", discv5_bootstrap_node=self.node1.get_enr_uri())
# self.node5.start(
# relay="false", filter="true", filternode=self.node4.get_multiaddr_with_id(), store="false", discv5_bootstrap_node=self.node3.get_enr_uri()
# )
self.node2.start(relay="true", filter="true", store="false", discv5_bootstrap_node=self.node1.get_enr_uri())
self.node3.start(
relay="false", filter="true", filternode=self.node2.get_multiaddr_with_id(), store="false", discv5_bootstrap_node=self.node2.get_enr_uri()
)
logger.debug(f"Subscribe nodes to relay pubsub topic {self.test_pubsub_topic}")
node_list_relay = [self.node1, self.node4]
node_list_relay = [self.node1, self.node2]
for node in node_list_relay:
node.set_relay_subscriptions([self.test_pubsub_topic])
self.wait_for_autoconnection(node_list_relay, hard_wait=30)
@ -308,11 +272,11 @@ class TestE2E(StepsFilter, StepsStore, StepsRelay, StepsLightPush):
for i in range(50):
node_list.append(WakuNode(NODE_2, f"node{i}_{self.test_id}"))
delay(0.1)
node_list[i].start(relay="false", filter="true", filternode=self.node4.get_multiaddr_with_id(), store="false")
node_list[i].start(relay="false", filter="true", filternode=self.node2.get_multiaddr_with_id(), store="false")
delay(2)
# node_list[i].set_filter_subscriptions(
# {"requestId": "1", "contentFilters": [self.test_content_topic], "pubsubTopic": self.test_pubsub_topic}
# )
node_list[i].set_filter_subscriptions(
{"requestId": "1", "contentFilters": [self.test_content_topic], "pubsubTopic": self.test_pubsub_topic}
)
delay(2)
logger.debug(f"{i}$$$")