Skip to content

Commit

Permalink
test(kafka): Bump the default poll timeout from 2s to 5s (#3647)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dav1dde authored May 24, 2024
1 parent ee84ed1 commit 9ecefb3
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tests/integration/fixtures/processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def __init__(self, consumer, options, topic_name, timeout=None):
self.consumer = consumer
self.test_producer = kafka_producer(options)
self.topic_name = topic_name
self.timeout = timeout or 2
self.timeout = timeout or 5

# Connect to the topic and poll a first test message.
# First poll takes forever, the next ones are fast.
Expand Down Expand Up @@ -246,13 +246,15 @@ def get_outcome(self, timeout=None):
assert len(outcomes) == 1, "More than one outcome was consumed"
return outcomes[0]

def assert_rate_limited(self, reason, key_id=None, categories=None, quantity=None):
def assert_rate_limited(
self, reason, key_id=None, categories=None, quantity=None, timeout=1
):
if categories is None:
outcome = self.get_outcome()
outcome = self.get_outcome(timeout=timeout)
assert isinstance(outcome["category"], int)
outcomes = [outcome]
else:
outcomes = self.get_outcomes()
outcomes = self.get_outcomes(timeout=timeout)
expected = {category_value(category) for category in categories}
actual = {outcome["category"] for outcome in outcomes}
assert actual == expected, (actual, expected)
Expand Down

0 comments on commit 9ecefb3

Please sign in to comment.