Fix redis-sentinel tests shenanigans

This commit is contained in:
Théophile Diot 2024-01-23 14:09:51 +01:00
parent 271d262308
commit a0e0d43949
No known key found for this signature in database
GPG key ID: 248FEA4BAE400D06

View file

@ -76,14 +76,19 @@ try:
f" Trying to connect to Redis Sentinel with the following parameters:\nhosts: {sentinel_hosts}\nmaster: {sentinel_master}\nssl: {redis_ssl}\nusername: {sentinel_username}\npassword: {sentinel_password}",
flush=True,
)
sentinel = Sentinel(sentinel_hosts, username=sentinel_username, password=sentinel_password, ssl=redis_ssl, socket_timeout=1)
sentinel = Sentinel(sentinel_hosts, username=sentinel_username, password=sentinel_password, sentinel_kwargs=dict(ssl=redis_ssl), socket_timeout=1) # type: ignore
print(
f" Trying to get a Redis Sentinel slave for master {sentinel_master} with the following parameters:\n"
+ f"host: {redis_host}\nport: {redis_port}\ndb: {redis_db}\nssl: {redis_ssl}\nusername: {getenv('REDIS_USERNAME', None) or None}\npassword: {getenv('REDIS_PASSWORD', None) or None}",
flush=True,
)
redis_client = sentinel.slave_for(sentinel_master, db=redis_db, username=getenv("REDIS_USERNAME", None) or None, password=getenv("REDIS_PASSWORD", None) or None, ssl_cert_reqs="none")
redis_client = sentinel.slave_for(
sentinel_master,
db=redis_db,
username=getenv("REDIS_USERNAME", None) or None,
password=getenv("REDIS_PASSWORD", None) or None,
)
else:
print(
" Trying to connect to Redis with the following parameters:\n"