From 928dfc618e81854da198d8615d499cd199ddbd73 Mon Sep 17 00:00:00 2001 From: Tobias Urdin Date: Wed, 28 Sep 2022 12:24:11 +0200 Subject: [PATCH] Change StrictRedis usage to Redis The StrictRedis class is only an alias for Redis in >= 3.0.0 Change-Id: I5136852af5d0b4dc3542948a4114e06f0e4a0060 --- releasenotes/notes/remove-strict-redis-e50cccbdf4a86f76.yaml | 4 ++++ zaqar/storage/redis/driver.py | 4 ++-- zaqar/tests/unit/storage/test_impl_redis.py | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 releasenotes/notes/remove-strict-redis-e50cccbdf4a86f76.yaml diff --git a/releasenotes/notes/remove-strict-redis-e50cccbdf4a86f76.yaml b/releasenotes/notes/remove-strict-redis-e50cccbdf4a86f76.yaml new file mode 100644 index 000000000..c11467cd7 --- /dev/null +++ b/releasenotes/notes/remove-strict-redis-e50cccbdf4a86f76.yaml @@ -0,0 +1,4 @@ +--- +upgrade: + - | + The minimum redis-py version required is now >= 3.0.0 diff --git a/zaqar/storage/redis/driver.py b/zaqar/storage/redis/driver.py index 18153aa3e..6ec9fb34e 100644 --- a/zaqar/storage/redis/driver.py +++ b/zaqar/storage/redis/driver.py @@ -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, diff --git a/zaqar/tests/unit/storage/test_impl_redis.py b/zaqar/tests/unit/storage/test_impl_redis.py index 8424bc75d..feefa6dbe 100644 --- a/zaqar/tests/unit/storage/test_impl_redis.py +++ b/zaqar/tests/unit/storage/test_impl_redis.py @@ -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,