increase max content topic length to 100 (#12)

This commit is contained in:
Florin Barbu 2024-01-09 19:58:08 +02:00 committed by GitHub
parent 5b7045ace8
commit ca5853747b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 28 deletions

View File

@ -65,7 +65,7 @@ INVALID_CONTENT_TOPICS = [
{"description": "A bool", "value": True},
]
VALID_PUBSUB_TOPICS = ["/waku/2/rs/0/1", "/waku/2/rs/0/0", "/waku/2/rs/0/9", "/waku/2/rs/0/25", "/waku/2/rs/0/1000", DEFAULT_PUBSUB_TOPIC]
VALID_PUBSUB_TOPICS = ["/waku/2/rs/0/0", "/waku/2/rs/0/1", "/waku/2/rs/0/9", "/waku/2/rs/0/25", "/waku/2/rs/0/1000", DEFAULT_PUBSUB_TOPIC]
INVALID_PUBSUB_TOPICS = ["/test/2/rs/0/1", "/waku/3/rs/0/1", "/waku/2/test/0/1", "/waku/2/rs/0/b", "/waku/2/rs/0"]

View File

@ -45,38 +45,39 @@ class TestFilterSubscribeCreate(StepsFilter):
failed_pubsub_topics.append(pubsub_topic)
assert not failed_pubsub_topics, f"PubsubTopics failed: {failed_pubsub_topics}"
def test_filter_subscribe_to_30_content_topics_in_one_call(self):
def test_filter_subscribe_to_100_content_topics_in_one_call(self):
failed_content_topics = []
self.wait_for_subscriptions_on_main_nodes([input["value"] for input in SAMPLE_INPUTS[:30]])
for content_topic in SAMPLE_INPUTS[:30]:
logger.debug(f'Running test with content topic {content_topic["description"]}')
message = self.create_message(contentTopic=content_topic["value"])
_100_content_topics = [str(i) for i in range(100)]
self.wait_for_subscriptions_on_main_nodes(_100_content_topics)
for content_topic in _100_content_topics:
message = self.create_message(contentTopic=content_topic)
try:
self.check_published_message_reaches_filter_peer(message)
except Exception as ex:
logger.error(f'ContentTopic {content_topic["description"]} failed: {str(ex)}')
logger.error(f"ContentTopic {content_topic} failed: {str(ex)}")
failed_content_topics.append(content_topic)
assert not failed_content_topics, f"ContentTopics failed: {failed_content_topics}"
def test_filter_subscribe_to_30_content_topics_in_separate_calls(self, subscribe_main_nodes):
for content_topic in SAMPLE_INPUTS[:30]:
self.create_filter_subscription({"requestId": "1", "contentFilters": [content_topic["value"]], "pubsubTopic": self.test_pubsub_topic})
def test_filter_subscribe_to_100_content_topics_in_separate_calls(self, subscribe_main_nodes):
_100_content_topics = [str(i) for i in range(100)]
for content_topic in _100_content_topics:
self.create_filter_subscription({"requestId": "1", "contentFilters": [content_topic], "pubsubTopic": self.test_pubsub_topic})
failed_content_topics = []
for content_topic in SAMPLE_INPUTS[:30]:
logger.debug(f'Running test with content topic {content_topic["description"]}')
message = self.create_message(contentTopic=content_topic["value"])
for content_topic in _100_content_topics:
logger.debug(f"Running test with content topic {content_topic}")
message = self.create_message(contentTopic=content_topic)
try:
self.check_published_message_reaches_filter_peer(message)
except Exception as ex:
logger.error(f'ContentTopic {content_topic["description"]} failed: {str(ex)}')
logger.error(f"ContentTopic {content_topic} failed: {str(ex)}")
failed_content_topics.append(content_topic)
assert not failed_content_topics, f"ContentTopics failed: {failed_content_topics}"
def test_filter_subscribe_to_31_content_topics(self, subscribe_main_nodes):
def test_filter_subscribe_to_101_content_topics(self, subscribe_main_nodes):
try:
_31_content_topics = [input["value"] for input in SAMPLE_INPUTS[:31]]
self.create_filter_subscription({"requestId": "1", "contentFilters": _31_content_topics, "pubsubTopic": self.test_pubsub_topic})
raise AssertionError("Subscribe with more than 30 content topics worked!!!")
_101_content_topics = [str(i) for i in range(101)]
self.create_filter_subscription({"requestId": "1", "contentFilters": _101_content_topics, "pubsubTopic": self.test_pubsub_topic})
raise AssertionError("Subscribe with more than 100 content topics worked!!!")
except Exception as ex:
assert "Bad Request" in str(ex)

View File

@ -31,11 +31,11 @@ class TestFilterSubscribeUpdate(StepsFilter):
failed_content_topics.append(content_topic)
assert not failed_content_topics, f"ContentTopics failed: {failed_content_topics}"
def test_filter_update_subscription_add_31_new_content_topics(self, subscribe_main_nodes):
def test_filter_update_subscription_add_101_new_content_topics(self, subscribe_main_nodes):
try:
_31_content_topics = [input["value"] for input in SAMPLE_INPUTS[:31]]
self.update_filter_subscription({"requestId": "1", "contentFilters": _31_content_topics, "pubsubTopic": self.test_pubsub_topic})
raise AssertionError("Subscribe with more than 30 content topics worked!!!")
_101_content_topics = [str(i) for i in range(101)]
self.update_filter_subscription({"requestId": "1", "contentFilters": _101_content_topics, "pubsubTopic": self.test_pubsub_topic})
raise AssertionError("Subscribe with more than 100 content topics worked!!!")
except Exception as ex:
assert "Bad Request" in str(ex)

View File

@ -62,14 +62,13 @@ class TestFilterUnSubscribe(StepsFilter):
assert "Not Found" in str(ex) and "peer has no subscriptions" in str(ex)
self.check_published_message_reaches_filter_peer()
def test_filter_unsubscribe_from_31_content_topics(self):
def test_filter_unsubscribe_from_101_content_topics(self):
try:
self.delete_filter_subscription(
{"requestId": "1", "contentFilters": [input["value"] for input in SAMPLE_INPUTS[:31]], "pubsubTopic": self.test_pubsub_topic}
)
raise AssertionError("Unsubscribe from more than 30 content topics worked!!!")
_101_content_topics = [str(i) for i in range(101)]
self.delete_filter_subscription({"requestId": "1", "contentFilters": _101_content_topics, "pubsubTopic": self.test_pubsub_topic})
raise AssertionError("Unsubscribe from more than 100 content topics worked!!!")
except Exception as ex:
assert "exceeds maximum content topics: 30" in str(ex)
assert "exceeds maximum content topics: 100" in str(ex)
def test_filter_unsubscribe_with_no_content_topic(self):
try: