Change StrictRedis usage to Redis

The StrictRedis class is only an alias for
Redis in >= 3.0.0

Change-Id: I5136852af5d0b4dc3542948a4114e06f0e4a0060
This commit is contained in:
Tobias Urdin 2022-09-28 12:24:11 +02:00 committed by Erik Olof Gunnar Andersson
parent c611c5c6e8
commit 928dfc618e
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,