adjsutmens for go-waku

This commit is contained in:
Florin Barbu 2024-05-28 14:04:38 +03:00
parent e8a165c71e
commit 931f9cf664
No known key found for this signature in database
GPG Key ID: 593D6DBC6D9E5095
4 changed files with 25 additions and 14 deletions

View File

@ -150,8 +150,13 @@ class StepsStore(StepsCommon):
):
if pubsub_topic is None:
pubsub_topic = self.test_pubsub_topic
if node.is_gowaku() and content_topics is None:
content_topics = self.test_content_topic
if node.is_gowaku():
if content_topics is None:
content_topics = self.test_content_topic
if hashes is not None:
content_topics = None
pubsub_topic = None
peer_addr = self.multiaddr_list[0]
store_response = node.get_store_messages(
peer_addr=peer_addr,
include_data=include_data,

View File

@ -5,7 +5,7 @@ from src.node.store_response import StoreResponse
from src.steps.store import StepsStore
@pytest.mark.xfail("go_waku" in NODE_2, reason="Bug reported: https://github.com/waku-org/go-waku/issues/1109")
@pytest.mark.xfail("go-waku" in NODE_2, reason="Bug reported: https://github.com/waku-org/go-waku/issues/1109")
@pytest.mark.usefixtures("node_setup")
class TestCursor(StepsStore):
# we implicitly test the reusabilty of the cursor for multiple nodes
@ -67,7 +67,7 @@ class TestCursor(StepsStore):
cursor = store_response.message_hash(9)
for node in self.store_nodes:
store_response = self.get_messages_from_store(node, page_size=100, cursor=cursor)
assert len(store_response.messages) == 0, "Message count mismatch"
assert not store_response.messages, "Messages found"
@pytest.mark.xfail("go-waku" in NODE_2, reason="Bug reported: https://github.com/waku-org/go-waku/issues/1110")
@pytest.mark.xfail("nwaku" in (NODE_1 + NODE_2), reason="Bug reported: https://github.com/waku-org/nwaku/issues/2716")
@ -79,7 +79,7 @@ class TestCursor(StepsStore):
cursor = self.compute_message_hash(self.test_pubsub_topic, wrong_message)
for node in self.store_nodes:
store_response = self.get_messages_from_store(node, page_size=100, cursor=cursor)
assert len(store_response.messages) == 0, "Message count mismatch"
assert not store_response.messages, "Messages found"
@pytest.mark.xfail("go-waku" in NODE_2, reason="Bug reported: https://github.com/waku-org/go-waku/issues/1110")
@pytest.mark.xfail("nwaku" in (NODE_1 + NODE_2), reason="Bug reported: https://github.com/waku-org/nwaku/issues/2716")
@ -90,7 +90,7 @@ class TestCursor(StepsStore):
cursor = to_base64("test")
for node in self.store_nodes:
store_response = self.get_messages_from_store(node, page_size=100, cursor=cursor)
assert len(store_response.messages) == 0, "Message count mismatch"
assert not store_response.messages, "Messages found"
@pytest.mark.xfail("go-waku" in NODE_2, reason="Bug reported: https://github.com/waku-org/go-waku/issues/1110")
@pytest.mark.xfail("nwaku" in (NODE_1 + NODE_2), reason="Bug reported: https://github.com/waku-org/nwaku/issues/2716")
@ -101,4 +101,4 @@ class TestCursor(StepsStore):
cursor = "test"
for node in self.store_nodes:
store_response = self.get_messages_from_store(node, page_size=100, cursor=cursor)
assert len(store_response.messages) == 0, "Message count mismatch"
assert not store_response.messages, "Messages found"

View File

@ -8,7 +8,7 @@ from src.test_data import SAMPLE_INPUTS
logger = get_custom_logger(__name__)
@pytest.mark.xfail("go_waku" in NODE_2, reason="Bug reported: https://github.com/waku-org/go-waku/issues/1109")
@pytest.mark.xfail("go-waku" in NODE_2, reason="Bug reported: https://github.com/waku-org/go-waku/issues/1109")
@pytest.mark.usefixtures("node_setup")
class TestHashes(StepsStore):
def test_store_with_hashes(self):
@ -41,20 +41,26 @@ class TestHashes(StepsStore):
wrong_hash = self.compute_message_hash(self.test_pubsub_topic, self.create_message(payload=to_base64("test")))
for node in self.store_nodes:
store_response = self.get_messages_from_store(node, hashes=wrong_hash, page_size=50)
assert len(store_response.messages) == 0
assert not store_response.messages, "Messages found"
def test_store_with_invalid_hash(self):
for i in range(4):
self.publish_message(message=self.create_message(payload=to_base64(f"Message_{i}")))
invalid_hash = to_base64("test")
for node in self.store_nodes:
store_response = self.get_messages_from_store(node, hashes=invalid_hash, page_size=50)
assert len(store_response.messages) == 0
try:
store_response = self.get_messages_from_store(node, hashes=invalid_hash, page_size=50)
assert not store_response.messages
except Exception as ex:
assert "waku message hash parsing error: invalid hash length" in str(ex)
def test_store_with_non_base64_hash(self):
for i in range(4):
self.publish_message(message=self.create_message(payload=to_base64(f"Message_{i}")))
non_base64_hash = "test"
for node in self.store_nodes:
store_response = self.get_messages_from_store(node, hashes=non_base64_hash, page_size=50)
assert len(store_response.messages) == 0
try:
store_response = self.get_messages_from_store(node, hashes=non_base64_hash, page_size=50)
assert not store_response.messages
except Exception as ex:
assert "waku message hash parsing error: invalid hash length" in str(ex)

View File

@ -4,7 +4,7 @@ from src.steps.store import StepsStore
from src.test_data import CONTENT_TOPICS_DIFFERENT_SHARDS
@pytest.mark.xfail("go_waku" in NODE_2, reason="Bug reported: https://github.com/waku-org/go-waku/issues/1108")
@pytest.mark.xfail("go-waku" in NODE_2, reason="Bug reported: https://github.com/waku-org/go-waku/issues/1108")
class TestTopics(StepsStore):
@pytest.fixture(scope="function", autouse=True)
def topics_setup(self, node_setup):