From ca5853747b2b8de4d25521fc731c647ce4c2aaeb Mon Sep 17 00:00:00 2001 From: Florin Barbu Date: Tue, 9 Jan 2024 19:58:08 +0200 Subject: [PATCH] increase max content topic length to 100 (#12) --- src/test_data.py | 2 +- tests/filter/test_subscribe_create.py | 35 ++++++++++++++------------- tests/filter/test_subscribe_update.py | 8 +++--- tests/filter/test_unsubscribe.py | 11 ++++----- 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/test_data.py b/src/test_data.py index f11669fce5..a1bf381c6b 100644 --- a/src/test_data.py +++ b/src/test_data.py @@ -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"] diff --git a/tests/filter/test_subscribe_create.py b/tests/filter/test_subscribe_create.py index de267b5160..d36596900a 100644 --- a/tests/filter/test_subscribe_create.py +++ b/tests/filter/test_subscribe_create.py @@ -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) diff --git a/tests/filter/test_subscribe_update.py b/tests/filter/test_subscribe_update.py index 259fba740b..fed6aef9b2 100644 --- a/tests/filter/test_subscribe_update.py +++ b/tests/filter/test_subscribe_update.py @@ -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) diff --git a/tests/filter/test_unsubscribe.py b/tests/filter/test_unsubscribe.py index 02375bf16b..ebedac1f0e 100644 --- a/tests/filter/test_unsubscribe.py +++ b/tests/filter/test_unsubscribe.py @@ -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: