summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorShalabh Chaturvedi <shalabh.chaturvedi+github@gmail.com>2022-08-25 10:47:52 -0700
committerGitHub <noreply@github.com>2022-08-25 23:47:52 +0600
commitec533af9c1c6e156a1fe754fddc2095ebdba8554 (patch)
tree38279c9ff6946cd9112bd19c2a61f6fe28a66626 /t
parent717ad3ddc98d83a7b9e2cb7054bb92a0cd6c8d53 (diff)
downloadkombu-ec533af9c1c6e156a1fe754fddc2095ebdba8554.tar.gz
Fix incompatibility with redis in disconnect() (#1589)
* Accept *args in disconnect() * Add test for redis connection timeout error
Diffstat (limited to 't')
-rw-r--r--t/integration/test_redis.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/t/integration/test_redis.py b/t/integration/test_redis.py
index 169a32dc..b2ae5ab8 100644
--- a/t/integration/test_redis.py
+++ b/t/integration/test_redis.py
@@ -1,6 +1,7 @@
from __future__ import annotations
import os
+import socket
from time import sleep
import pytest
@@ -134,3 +135,18 @@ class test_RedisPriority(BasePriority):
@pytest.mark.flaky(reruns=5, reruns_delay=2)
class test_RedisMessage(BaseMessage):
pass
+
+
+@pytest.mark.env('redis')
+def test_RedisConnectTimeout(monkeypatch):
+ # simulate a connection timeout for a new connection
+ def connect_timeout(self):
+ raise socket.timeout
+ monkeypatch.setattr(
+ redis.connection.Connection, "_connect", connect_timeout)
+
+ # ensure the timeout raises a TimeoutError
+ with pytest.raises(redis.exceptions.TimeoutError):
+ # note the host/port here is irrelevant because
+ # connect will raise a socket.timeout
+ kombu.Connection('redis://localhost:12345').connect()