parent
03973b8897
commit
aab71a92a7
|
@ -0,0 +1,63 @@
|
|||
from src.env_vars import NODE_1, NODE_2, NODEKEY
|
||||
from src.libs.custom_logger import get_custom_logger
|
||||
from src.node.waku_node import WakuNode
|
||||
from src.steps.filter import StepsFilter
|
||||
from src.steps.light_push import StepsLightPush
|
||||
from src.steps.relay import StepsRelay
|
||||
from src.steps.store import StepsStore
|
||||
from tenacity import retry, stop_after_delay, wait_fixed
|
||||
|
||||
logger = get_custom_logger(__name__)
|
||||
|
||||
|
||||
class TestDiscv5(StepsRelay, StepsFilter, StepsStore, StepsLightPush):
|
||||
def running_a_node(self, image, **kwargs):
|
||||
node = WakuNode(image, f"node{len(self.main_nodes) + 1}_{self.test_id}")
|
||||
node.start(**kwargs)
|
||||
return node
|
||||
|
||||
@retry(stop=stop_after_delay(70), wait=wait_fixed(1), reraise=True)
|
||||
def wait_for_published_message_to_be_stored(self):
|
||||
self.publish_message()
|
||||
self.check_published_message_is_stored([self.store_node1], page_size=5, ascending="true")
|
||||
|
||||
def test_relay(self):
|
||||
self.node1 = self.running_a_node(NODE_1, relay="true", nodekey=NODEKEY)
|
||||
self.node2 = self.running_a_node(NODE_2, relay="true", discv5_bootstrap_node=self.node1.get_enr_uri())
|
||||
self.main_nodes = [self.node1, self.node2]
|
||||
self.ensure_relay_subscriptions_on_nodes(self.main_nodes, [self.test_pubsub_topic])
|
||||
self.wait_for_published_message_to_reach_relay_peer()
|
||||
|
||||
def test_filter(self):
|
||||
self.node1 = self.running_a_node(NODE_1, relay="true", filter="true", nodekey=NODEKEY)
|
||||
self.node2 = self.running_a_node(
|
||||
NODE_2, relay="false", discv5_bootstrap_node=self.node1.get_enr_uri(), filternode=self.node1.get_multiaddr_with_id()
|
||||
)
|
||||
self.main_nodes = [self.node2]
|
||||
self.wait_for_subscriptions_on_main_nodes([self.test_content_topic])
|
||||
self.check_published_message_reaches_filter_peer()
|
||||
|
||||
def test_store(self):
|
||||
self.publishing_node1 = self.running_a_node(NODE_1, relay="true", store="true", nodekey=NODEKEY)
|
||||
self.store_node1 = self.running_a_node(
|
||||
NODE_2,
|
||||
relay="true",
|
||||
store="true",
|
||||
discv5_bootstrap_node=self.publishing_node1.get_enr_uri(),
|
||||
storenode=self.publishing_node1.get_multiaddr_with_id(),
|
||||
)
|
||||
self.main_nodes = [self.publishing_node1, self.store_node1]
|
||||
self.subscribe_to_pubsub_topics_via_relay(self.main_nodes)
|
||||
self.wait_for_published_message_to_be_stored()
|
||||
|
||||
def test_lightpush(self):
|
||||
self.receiving_node1 = self.running_a_node(NODE_1, lightpush="true", relay="true", nodekey=NODEKEY)
|
||||
self.light_push_node1 = self.running_a_node(
|
||||
NODE_2,
|
||||
lightpush="true",
|
||||
relay="false",
|
||||
discv5_bootstrap_node=self.receiving_node1.get_enr_uri(),
|
||||
lightpushnode=self.receiving_node1.get_multiaddr_with_id(),
|
||||
)
|
||||
self.subscribe_to_pubsub_topics_via_relay(self.receiving_node1)
|
||||
self.check_light_pushed_message_reaches_receiving_peer(peer_list=[self.receiving_node1])
|
|
@ -32,7 +32,7 @@ class TestRunningNodes(StepsStore):
|
|||
self.publish_message()
|
||||
self.check_published_message_is_stored(page_size=5, ascending="true")
|
||||
|
||||
@pytest.mark.xfail("go-waku" in NODE_2, reason="Bug reported: https://github.com/waku-org/go-waku/issues/1106")
|
||||
@pytest.mark.skipif("go-waku" in NODE_2, reason="Not supported. See: https://github.com/waku-org/go-waku/issues/1106")
|
||||
def test_main_node_only_relay__peer_relay_and_store(self):
|
||||
self.setup_first_publishing_node(store="false", relay="true")
|
||||
self.setup_first_store_node(store="true", relay="true")
|
||||
|
@ -40,7 +40,7 @@ class TestRunningNodes(StepsStore):
|
|||
self.publish_message()
|
||||
self.check_published_message_is_stored(page_size=5, ascending="true")
|
||||
|
||||
@pytest.mark.xfail("go-waku" in NODE_2, reason="Bug reported: https://github.com/waku-org/go-waku/issues/1106")
|
||||
@pytest.mark.skipif("go-waku" in NODE_2, reason="Not supported. See: https://github.com/waku-org/go-waku/issues/1106")
|
||||
def test_main_node_only_relay__peer_only_store(self):
|
||||
self.setup_first_publishing_node(store="false", relay="true")
|
||||
self.setup_first_store_node(store="true", relay="false")
|
||||
|
@ -48,7 +48,7 @@ class TestRunningNodes(StepsStore):
|
|||
self.publish_message()
|
||||
self.check_store_returns_empty_response()
|
||||
|
||||
@pytest.mark.xfail("go-waku" in NODE_2, reason="Bug reported: https://github.com/waku-org/go-waku/issues/1106")
|
||||
@pytest.mark.skipif("go-waku" in NODE_2, reason="Not supported. See: https://github.com/waku-org/go-waku/issues/1106")
|
||||
def test_main_node_only_relay__peer_only_relay(self):
|
||||
self.setup_first_publishing_node(store="false", relay="true")
|
||||
self.setup_first_store_node(store="false", relay="true")
|
||||
|
|
Loading…
Reference in New Issue