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

fix for 150 kb max messages adjustments #10

Merged
merged 3 commits into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion src/steps/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def ping_without_filter_subscription(self, node=None):
self.ping_filter_subscriptions(str(uuid4()), node=node)
raise AssertionError("Ping without any subscription worked")
except Exception as ex:
assert "peer has no subscriptions" in str(ex)
assert "peer has no subscription" in str(ex)

@allure.step
def add_new_relay_subscription(self, pubsub_topics, node=None):
Expand Down
4 changes: 2 additions & 2 deletions tests/filter/test_get_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def test_filter_get_50_messages(self):
f"M_{index}"
), f'Incorrect payload at index: {index}. Published {to_base64(f"M_{index}")} Received {message["payload"]}'

def test_filter_get_message_with_1MB_payload(self):
payload_length = 1024 * 1023
def test_filter_get_message_with_150_kb_payload(self):
payload_length = 1024 * 100 # after encoding to base64 this will be close to 150KB
message = self.create_message(payload=to_base64("a" * (payload_length)))
self.check_published_message_reaches_filter_peer(message, message_propagation_delay=2)
2 changes: 2 additions & 0 deletions tests/filter/test_multiple_nodes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pytest
from src.libs.common import delay
from src.libs.custom_logger import get_custom_logger
from src.steps.filter import StepsFilter

Expand Down Expand Up @@ -31,6 +32,7 @@ def test_filter_get_message_while_one_peer_is_paused(self):
self.node1.send_relay_message(relay_message1, self.test_pubsub_topic)
self.node2.unpause()
self.node1.send_relay_message(relay_message2, self.test_pubsub_topic)
delay(0.5)
filter_messages = self.get_filter_messages(content_topic=self.test_content_topic, pubsub_topic=self.test_pubsub_topic, node=self.node2)
assert len(filter_messages) == 2, "Both messages should've been returned"

Expand Down
9 changes: 5 additions & 4 deletions tests/relay/test_publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ def test_publish_with_missing_payload(self):
except Exception as ex:
assert "Bad Request" in str(ex) or "Internal Server Error" in str(ex)

def test_publish_with_payload_less_than_one_mb(self):
payload_length = 1024 * 700 # after encoding to base64 this be close to 1MB
def test_publish_with_payload_less_than_one_150_kb(self):
payload_length = 1024 * 100 # after encoding to base64 this will be close to 150KB
logger.debug(f"Running test with payload length of {payload_length} bytes")
message = self.create_message(payload=to_base64("a" * (payload_length)))
self.check_published_message_reaches_relay_peer(message, message_propagation_delay=2)

def test_publish_with_payload_equal_or_more_than_one_mb(self):
for payload_length in [1024 * 1024, 1024 * 1024 * 10]:
def test_publish_with_payload_equal_or_more_150_kb(self):
for payload_length in [1024 * 200, 1024 * 1024, 1024 * 1024 * 10]:
logger.debug(f"Running test with payload length of {payload_length} bytes")
message = self.create_message(payload=to_base64("a" * (payload_length)))
try:
Expand Down Expand Up @@ -226,6 +226,7 @@ def test_publish_after_node_pauses_and_pauses(self):
self.node2.unpause()
self.check_published_message_reaches_relay_peer(self.create_message(payload=to_base64("M2")))

@pytest.mark.flaky(reruns=5)
def test_publish_after_node1_restarts(self):
self.check_published_message_reaches_relay_peer()
self.node1.restart()
Expand Down
Loading