Skip to content

Commit

Permalink
Added a unit test that proves timeout is used when retry policy is sp…
Browse files Browse the repository at this point in the history
…ecified.
  • Loading branch information
thedrow committed Oct 20, 2024
1 parent 6a77355 commit 82bf9ba
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion t/unit/test_messaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import pytest

from kombu import Connection, Consumer, Exchange, Producer, Queue
from kombu.exceptions import MessageStateError
from kombu.exceptions import MessageStateError, OperationalError
from kombu.utils import json
from kombu.utils.functional import ChannelPromise
from t.mocks import Transport
Expand Down Expand Up @@ -156,6 +156,20 @@ def test_publish_with_timeout(self):
timeout = p._channel.basic_publish.call_args[1]['timeout']
assert timeout == 1

def test_publish_with_timeout_and_retry_policy(self):
p = self.connection.Producer()
p.channel = Mock()
p.channel.connection.client.declared_entities = set()
p.publish('test_timeout', exchange=Exchange('foo'), timeout=1, retry_policy={
"max_retries": 20,
"interval_start": 1,
"interval_step": 2,
"interval_max": 30,
"retry_errors": (OperationalError,)
})
timeout = p._channel.basic_publish.call_args[1]['timeout']
assert timeout == 1

def test_publish_with_reply_to(self):
p = self.connection.Producer()
p.channel = Mock()
Expand Down

0 comments on commit 82bf9ba

Please sign in to comment.