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:
parent
c611c5c6e8
commit
928dfc618e
@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
upgrade:
|
||||||
|
- |
|
||||||
|
The minimum redis-py version required is now >= 3.0.0
|
@ -318,14 +318,14 @@ def _get_redis_client(driver):
|
|||||||
return sentinel.master_for(connection_uri.master)
|
return sentinel.master_for(connection_uri.master)
|
||||||
|
|
||||||
elif connection_uri.strategy == STRATEGY_TCP:
|
elif connection_uri.strategy == STRATEGY_TCP:
|
||||||
return redis.StrictRedis(
|
return redis.Redis(
|
||||||
host=connection_uri.hostname,
|
host=connection_uri.hostname,
|
||||||
port=connection_uri.port,
|
port=connection_uri.port,
|
||||||
db=connection_uri.dbid,
|
db=connection_uri.dbid,
|
||||||
password=connection_uri.password,
|
password=connection_uri.password,
|
||||||
socket_timeout=connection_uri.socket_timeout)
|
socket_timeout=connection_uri.socket_timeout)
|
||||||
else:
|
else:
|
||||||
return redis.StrictRedis(
|
return redis.Redis(
|
||||||
unix_socket_path=connection_uri.unix_socket_path,
|
unix_socket_path=connection_uri.unix_socket_path,
|
||||||
db=connection_uri.dbid,
|
db=connection_uri.dbid,
|
||||||
password=connection_uri.password,
|
password=connection_uri.password,
|
||||||
|
@ -179,13 +179,13 @@ class RedisDriverTest(testing.TestBase):
|
|||||||
driver.ControlDriver
|
driver.ControlDriver
|
||||||
(self.conf, cache))
|
(self.conf, cache))
|
||||||
|
|
||||||
self.assertIsInstance(redis_driver.connection, redis.StrictRedis)
|
self.assertIsInstance(redis_driver.connection, redis.Redis)
|
||||||
|
|
||||||
def test_version_match(self):
|
def test_version_match(self):
|
||||||
oslo_cache.register_config(self.conf)
|
oslo_cache.register_config(self.conf)
|
||||||
cache = oslo_cache.get_cache(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'}
|
info.return_value = {'redis_version': '2.4.6'}
|
||||||
self.assertRaises(RuntimeError, driver.DataDriver,
|
self.assertRaises(RuntimeError, driver.DataDriver,
|
||||||
self.conf, cache,
|
self.conf, cache,
|
||||||
|
Loading…
Reference in New Issue
Block a user