summaryrefslogtreecommitdiff
path: root/t/unit
diff options
context:
space:
mode:
authorMehdi Pourfar <mehdipourfar@gmail.com>2021-12-24 12:51:44 +0330
committerGitHub <noreply@github.com>2021-12-24 15:21:44 +0600
commita9c4f9837c1ad2296a9b21311f79c8cdbddade6b (patch)
treec5f966a10f1cb233f9b3cef997164780f8056d42 /t/unit
parent47781af0508a168a8726f024165ce583c1d5de24 (diff)
downloadkombu-a9c4f9837c1ad2296a9b21311f79c8cdbddade6b.tar.gz
respect connection timeout (#1458)
* pass timeout to ensure connection function * test connection respect its timeout
Diffstat (limited to 't/unit')
-rw-r--r--t/unit/test_connection.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/t/unit/test_connection.py b/t/unit/test_connection.py
index 0b184d3b..83f233cf 100644
--- a/t/unit/test_connection.py
+++ b/t/unit/test_connection.py
@@ -587,6 +587,16 @@ class test_Connection:
conn = Connection('example.com;example.com;')
assert conn.as_uri() == 'amqp://guest:**@example.com:5672//'
+ def test_connection_respect_its_timeout(self):
+ invalid_port = 1222
+ with Connection(
+ f'amqp://guest:guest@localhost:{invalid_port}//',
+ transport_options={'max_retries': 2},
+ connect_timeout=1
+ ) as conn:
+ with pytest.raises(OperationalError):
+ conn.default_channel
+
class test_Connection_with_transport_options: