diff options
author | AbdealiJK <abdealikothari@gmail.com> | 2020-11-09 18:57:42 +0530 |
---|---|---|
committer | Asif Saif Uddin <auvipy@gmail.com> | 2020-12-03 12:50:15 +0600 |
commit | 6cb9d6639e800012e733a0535db34653705290b9 (patch) | |
tree | 32d858015225361c253c79d8f15d10087e24dc56 /t | |
parent | d4dd8d72064496a447d5344f6349806103166db1 (diff) | |
download | kombu-6cb9d6639e800012e733a0535db34653705290b9.tar.gz |
redis: Support Sentinel with SSL
Use the SentinelManagedSSLConnection when SSL is enabled for the
transport. The redis-py project doesn't have a connection class for
SSL+Sentinel yet. So, create a class in redis.py to add that
functionality.
Diffstat (limited to 't')
-rw-r--r-- | t/unit/transport/test_redis.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/t/unit/transport/test_redis.py b/t/unit/transport/test_redis.py index f976dcc9..8a73db43 100644 --- a/t/unit/transport/test_redis.py +++ b/t/unit/transport/test_redis.py @@ -1465,3 +1465,25 @@ class test_RedisSentinel: connection.connect() expected = "'master_name' transport option must be specified." assert expected == excinfo.value.args[0] + + def test_sentinel_with_ssl(self): + ssl_params = { + 'ssl_cert_reqs': 2, + 'ssl_ca_certs': '/foo/ca.pem', + 'ssl_certfile': '/foo/cert.crt', + 'ssl_keyfile': '/foo/pkey.key' + } + with patch('redis.sentinel.Sentinel') as patched: + with Connection( + 'sentinel://', + transport_options={'master_name': 'not_important'}, + ssl=ssl_params) as conn: + params = conn.default_channel._connparams() + assert params['ssl_cert_reqs'] == ssl_params['ssl_cert_reqs'] + assert params['ssl_ca_certs'] == ssl_params['ssl_ca_certs'] + assert params['ssl_certfile'] == ssl_params['ssl_certfile'] + assert params['ssl_keyfile'] == ssl_params['ssl_keyfile'] + assert params.get('ssl') is None + from kombu.transport.redis import SentinelManagedSSLConnection + assert (params['connection_class'] is + SentinelManagedSSLConnection) |