Merge "Change StrictRedis usage to Redis"

This commit is contained in:
Zuul 2023-08-21 18:54:14 +00:00 committed by Gerrit Code Review
commit 169d917c3e
3 changed files with 8 additions and 4 deletions

View File

@ -0,0 +1,4 @@
---
upgrade:
- |
The minimum redis-py version required is now >= 3.0.0

View File

@ -318,14 +318,14 @@ def _get_redis_client(driver):
return sentinel.master_for(connection_uri.master)
elif connection_uri.strategy == STRATEGY_TCP:
return redis.StrictRedis(
return redis.Redis(
host=connection_uri.hostname,
port=connection_uri.port,
db=connection_uri.dbid,
password=connection_uri.password,
socket_timeout=connection_uri.socket_timeout)
else:
return redis.StrictRedis(
return redis.Redis(
unix_socket_path=connection_uri.unix_socket_path,
db=connection_uri.dbid,
password=connection_uri.password,

View File

@ -179,13 +179,13 @@ class RedisDriverTest(testing.TestBase):
driver.ControlDriver
(self.conf, cache))
self.assertIsInstance(redis_driver.connection, redis.StrictRedis)
self.assertIsInstance(redis_driver.connection, redis.Redis)
def test_version_match(self):
oslo_cache.register_config(self.conf)
cache = oslo_cache.get_cache(self.conf)
with mock.patch('redis.StrictRedis.info') as info:
with mock.patch('redis.Redis.info') as info:
info.return_value = {'redis_version': '2.4.6'}
self.assertRaises(RuntimeError, driver.DataDriver,
self.conf, cache,