From cfc6aa8f720ad63dccf15e23e45cb3f62a2c99b8 Mon Sep 17 00:00:00 2001 From: fbarbu15 Date: Wed, 17 Jul 2024 13:27:09 +0300 Subject: [PATCH] rate limit changes (#59) --- tests/filter/test_subscribe_create.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/filter/test_subscribe_create.py b/tests/filter/test_subscribe_create.py index bc2e1e5bcf..5c1d4ae911 100644 --- a/tests/filter/test_subscribe_create.py +++ b/tests/filter/test_subscribe_create.py @@ -61,12 +61,12 @@ class TestFilterSubscribeCreate(StepsFilter): failed_content_topics.append(content_topic) assert not failed_content_topics, f"ContentTopics failed: {failed_content_topics}" - 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: + def test_filter_subscribe_to_29_content_topics_in_separate_calls(self, subscribe_main_nodes): + _29_content_topics = [str(i) for i in range(29)] + for content_topic in _29_content_topics: self.create_filter_subscription({"requestId": "1", "contentFilters": [content_topic], "pubsubTopic": self.test_pubsub_topic}) failed_content_topics = [] - for content_topic in _100_content_topics: + for content_topic in _29_content_topics: logger.debug(f"Running test with content topic {content_topic}") message = self.create_message(contentTopic=content_topic) try: @@ -75,6 +75,11 @@ class TestFilterSubscribeCreate(StepsFilter): 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}" + try: + self.create_filter_subscription({"requestId": "1", "contentFilters": ["rate limited"], "pubsubTopic": self.test_pubsub_topic}) + raise AssertionError("The 30th subscribe call was not rate limited!!!") + except Exception as ex: + assert "subscription failed" in str(ex) or "rate limit exceeded" in str(ex) def test_filter_subscribe_to_101_content_topics(self, subscribe_main_nodes): try: