lightpush and store bugfixes (#32)
* bugfixes * store bugfixes * fix 2567
This commit is contained in:
parent
8d956b3d9c
commit
c1d4c0cc6b
|
@ -1,19 +1,17 @@
|
|||
import inspect
|
||||
import os
|
||||
from src.libs.custom_logger import get_custom_logger
|
||||
from time import time
|
||||
import pytest
|
||||
import allure
|
||||
from src.libs.common import to_base64, delay, gen_step_id
|
||||
from src.libs.common import to_base64, delay
|
||||
from src.node.waku_message import WakuMessage
|
||||
from src.env_vars import (
|
||||
ADDITIONAL_NODES,
|
||||
NODE_1,
|
||||
NODE_2,
|
||||
NODEKEY,
|
||||
)
|
||||
from src.node.waku_node import WakuNode, rln_credential_store_ready
|
||||
from tenacity import retry, stop_after_delay, wait_fixed
|
||||
from src.test_data import VALID_PUBSUB_TOPICS
|
||||
from src.node.waku_node import WakuNode
|
||||
|
||||
logger = get_custom_logger(__name__)
|
||||
|
||||
|
@ -57,7 +55,7 @@ class StepsLightPush:
|
|||
|
||||
@allure.step
|
||||
def setup_first_receiving_node(self, lightpush="true", relay="true", **kwargs):
|
||||
self.receiving_node1 = self.start_receiving_node(NODE_1, node_index=1, lightpush=lightpush, relay=relay, **kwargs)
|
||||
self.receiving_node1 = self.start_receiving_node(NODE_1, node_index=1, lightpush=lightpush, relay=relay, nodekey=NODEKEY, **kwargs)
|
||||
self.enr_uri = self.receiving_node1.get_enr_uri()
|
||||
|
||||
@allure.step
|
||||
|
|
|
@ -28,7 +28,6 @@ class TestLightPushPublish(StepsLightPush):
|
|||
failed_payloads.append(payload["description"])
|
||||
assert not failed_payloads, f"Payloads failed: {failed_payloads}"
|
||||
|
||||
@pytest.mark.xfail("go-waku" in NODE_2, reason="https://github.com/waku-org/go-waku/issues/1079")
|
||||
def test_light_push_with_invalid_payloads(self):
|
||||
success_payloads = []
|
||||
for payload in INVALID_PAYLOADS:
|
||||
|
@ -38,17 +37,16 @@ class TestLightPushPublish(StepsLightPush):
|
|||
self.light_push_node1.send_light_push_message(payload)
|
||||
success_payloads.append(payload)
|
||||
except Exception as ex:
|
||||
assert "Bad Request" in str(ex)
|
||||
assert "Bad Request" in str(ex) or "missing Payload field" in str(ex)
|
||||
assert not success_payloads, f"Invalid Payloads that didn't failed: {success_payloads}"
|
||||
|
||||
@pytest.mark.xfail("go-waku" in NODE_2, reason="https://github.com/waku-org/go-waku/issues/1079")
|
||||
def test_light_push_with_missing_payload(self):
|
||||
message = {"contentTopic": self.test_content_topic, "timestamp": int(time() * 1e9)}
|
||||
try:
|
||||
self.light_push_node1.send_light_push_message(self.create_payload(message=message))
|
||||
raise AssertionError("Light push with missing payload worked!!!")
|
||||
except Exception as ex:
|
||||
assert "Bad Request" in str(ex)
|
||||
assert "Bad Request" in str(ex) or "missing Payload field" in str(ex)
|
||||
|
||||
def test_light_push_with_payload_less_than_300_kb(self):
|
||||
payload_length = 1024 * 200 # after encoding to base64 this will be close to 260KB
|
||||
|
@ -92,7 +90,6 @@ class TestLightPushPublish(StepsLightPush):
|
|||
failed_content_topics.append(content_topic)
|
||||
assert not failed_content_topics, f"ContentTopics failed: {failed_content_topics}"
|
||||
|
||||
@pytest.mark.xfail("go-waku" in NODE_2, reason="https://github.com/waku-org/go-waku/issues/1079")
|
||||
def test_light_push_with_invalid_content_topics(self):
|
||||
success_content_topics = []
|
||||
for content_topic in INVALID_CONTENT_TOPICS:
|
||||
|
@ -102,17 +99,16 @@ class TestLightPushPublish(StepsLightPush):
|
|||
self.check_light_pushed_message_reaches_receiving_peer(message=message)
|
||||
success_content_topics.append(content_topic)
|
||||
except Exception as ex:
|
||||
assert "Bad Request" in str(ex)
|
||||
assert "Bad Request" in str(ex) or "missing ContentTopic field" in str(ex)
|
||||
assert not success_content_topics, f"Invalid Content topics that didn't failed: {success_content_topics}"
|
||||
|
||||
@pytest.mark.xfail("go-waku" in NODE_2, reason="https://github.com/waku-org/go-waku/issues/1079")
|
||||
def test_light_push_with_missing_content_topic(self):
|
||||
message = {"payload": to_base64(self.test_payload), "timestamp": int(time() * 1e9)}
|
||||
try:
|
||||
self.light_push_node1.send_light_push_message(self.create_payload(message=message))
|
||||
raise AssertionError("Light push with missing content_topic worked!!!")
|
||||
except Exception as ex:
|
||||
assert "Bad Request" in str(ex)
|
||||
assert "Bad Request" in str(ex) or "missing ContentTopic field" in str(ex)
|
||||
|
||||
def test_light_push_on_multiple_pubsub_topics(self):
|
||||
self.subscribe_to_pubsub_topics_via_relay(pubsub_topics=VALID_PUBSUB_TOPICS)
|
||||
|
@ -210,13 +206,12 @@ class TestLightPushPublish(StepsLightPush):
|
|||
except Exception as ex:
|
||||
assert "Bad Request" in str(ex)
|
||||
|
||||
@pytest.mark.xfail("go-waku" in NODE_2, reason="https://github.com/waku-org/go-waku/issues/1079")
|
||||
def test_light_push_with_with_large_meta(self):
|
||||
meta_l = 1024 * 1
|
||||
try:
|
||||
self.check_light_pushed_message_reaches_receiving_peer(message=self.create_message(meta=to_base64("a" * (meta_l))))
|
||||
except Exception as ex:
|
||||
assert '(kind: InvalidLengthField, field: "meta")' in str(ex)
|
||||
assert '(kind: InvalidLengthField, field: "meta")' in str(ex) or "invalid length for Meta field" in str(ex)
|
||||
|
||||
def test_light_push_with_ephemeral(self):
|
||||
failed_ephemeral = []
|
||||
|
@ -270,7 +265,6 @@ class TestLightPushPublish(StepsLightPush):
|
|||
self.light_push_node1.ensure_ready()
|
||||
self.check_light_pushed_message_reaches_receiving_peer()
|
||||
|
||||
@pytest.mark.xfail(reason="https://github.com/waku-org/nwaku/issues/2567")
|
||||
def test_light_push_after_receiving_node_restarts(self):
|
||||
self.check_light_pushed_message_reaches_receiving_peer()
|
||||
self.receiving_node1.restart()
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
import pytest
|
||||
from src.env_vars import NODE_2
|
||||
from src.steps.store import StepsStore
|
||||
|
||||
|
||||
|
@ -16,10 +14,7 @@ class TestRunningNodes(StepsStore):
|
|||
self.setup_first_store_node(store="true", relay="false")
|
||||
self.subscribe_to_pubsub_topics_via_relay()
|
||||
self.publish_message_via("relay")
|
||||
if self.store_node1.is_gowaku():
|
||||
self.check_published_message_is_stored(pubsubTopic=self.test_pubsub_topic, pageSize=5, ascending="true")
|
||||
elif self.store_node1.is_nwaku():
|
||||
self.check_store_returns_empty_response()
|
||||
self.check_store_returns_empty_response()
|
||||
|
||||
def test_main_node_relay_and_store__peer_only_relay(self):
|
||||
self.setup_first_publishing_node(store="true", relay="true")
|
||||
|
@ -35,7 +30,6 @@ class TestRunningNodes(StepsStore):
|
|||
self.publish_message_via("relay")
|
||||
self.check_published_message_is_stored(pubsubTopic=self.test_pubsub_topic, pageSize=5, ascending="true")
|
||||
|
||||
@pytest.mark.xfail("go-waku" in NODE_2, reason="Bug reported: https://github.com/waku-org/go-waku/issues/1087")
|
||||
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")
|
||||
|
@ -48,13 +42,7 @@ class TestRunningNodes(StepsStore):
|
|||
self.setup_first_store_node(store="true", relay="false")
|
||||
self.subscribe_to_pubsub_topics_via_relay()
|
||||
self.publish_message_via("relay")
|
||||
if self.store_node1.is_gowaku():
|
||||
try:
|
||||
self.check_published_message_is_stored(pubsubTopic=self.test_pubsub_topic, pageSize=5, ascending="true")
|
||||
except Exception as ex:
|
||||
assert "failed to negotiate protocol: protocols not supported" in str(ex)
|
||||
elif self.store_node1.is_nwaku():
|
||||
self.check_store_returns_empty_response()
|
||||
self.check_store_returns_empty_response()
|
||||
|
||||
def test_main_node_only_relay__peer_only_relay(self):
|
||||
self.setup_first_publishing_node(store="false", relay="true")
|
||||
|
|
Loading…
Reference in New Issue