rate limit changes (#59)

This commit is contained in:
fbarbu15 2024-07-17 13:27:09 +03:00 committed by GitHub
parent a6e56885da
commit cfc6aa8f72
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 4 deletions

View File

@ -61,12 +61,12 @@ class TestFilterSubscribeCreate(StepsFilter):
failed_content_topics.append(content_topic) failed_content_topics.append(content_topic)
assert not failed_content_topics, f"ContentTopics failed: {failed_content_topics}" 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): def test_filter_subscribe_to_29_content_topics_in_separate_calls(self, subscribe_main_nodes):
_100_content_topics = [str(i) for i in range(100)] _29_content_topics = [str(i) for i in range(29)]
for content_topic in _100_content_topics: for content_topic in _29_content_topics:
self.create_filter_subscription({"requestId": "1", "contentFilters": [content_topic], "pubsubTopic": self.test_pubsub_topic}) self.create_filter_subscription({"requestId": "1", "contentFilters": [content_topic], "pubsubTopic": self.test_pubsub_topic})
failed_content_topics = [] 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}") logger.debug(f"Running test with content topic {content_topic}")
message = self.create_message(contentTopic=content_topic) message = self.create_message(contentTopic=content_topic)
try: try:
@ -75,6 +75,11 @@ class TestFilterSubscribeCreate(StepsFilter):
logger.error(f"ContentTopic {content_topic} failed: {str(ex)}") logger.error(f"ContentTopic {content_topic} failed: {str(ex)}")
failed_content_topics.append(content_topic) failed_content_topics.append(content_topic)
assert not failed_content_topics, f"ContentTopics failed: {failed_content_topics}" 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): def test_filter_subscribe_to_101_content_topics(self, subscribe_main_nodes):
try: try: