summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorMatus Valo <matusvalo@users.noreply.github.com>2020-09-24 11:41:21 +0200
committerGitHub <noreply@github.com>2020-09-24 12:41:21 +0300
commitfaa1d86b525e63315026f0607fa522992c003c77 (patch)
treeb35c1a5a16e2b85c178888ab3b884be69a7f1ad7 /t
parentf475285894d7e3c2c13f5272168415724d6ff847 (diff)
downloadkombu-faa1d86b525e63315026f0607fa522992c003c77.tar.gz
Redis Transport: Small improvements of `SentinelChannel` (#1253)
* Redis Sentinel connection string now supports default sentinel port * Raise ValueError when SentinelChannel is missing master_name transport option
Diffstat (limited to 't')
-rw-r--r--t/unit/transport/test_redis.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/t/unit/transport/test_redis.py b/t/unit/transport/test_redis.py
index 59c95acf..43a1efa1 100644
--- a/t/unit/transport/test_redis.py
+++ b/t/unit/transport/test_redis.py
@@ -1410,6 +1410,7 @@ class test_RedisSentinel:
def test_getting_master_from_sentinel(self):
with patch('redis.sentinel.Sentinel') as patched:
connection = Connection(
+ 'sentinel://localhost/;'
'sentinel://localhost:65532/;'
'sentinel://user@localhost:65533/;'
'sentinel://:password@localhost:65534/;'
@@ -1422,6 +1423,7 @@ class test_RedisSentinel:
connection.channel()
patched.assert_called_once_with(
[
+ ('localhost', 26379),
('localhost', 65532),
('localhost', 65533),
('localhost', 65534),
@@ -1472,3 +1474,13 @@ class test_RedisSentinel:
)
with pytest.raises(ConnectionError):
connection.channel()
+
+ def test_missing_master_name_transport_option(self):
+ connection = Connection(
+ 'sentinel://localhost:65534/',
+ )
+ with patch('redis.sentinel.Sentinel'), \
+ pytest.raises(ValueError) as excinfo:
+ connection.connect()
+ expected = "'master_name' transport option must be specified."
+ assert expected == excinfo.value.args[0]