def test_db_instance(self): cache = oslo_cache.get_cache() redis_driver = driver.DataDriver(self.conf, cache, driver.ControlDriver (self.conf, cache)) self.assertTrue(isinstance(redis_driver.connection, redis.StrictRedis))
def test_db_instance(self): oslo_cache.register_config(self.conf) cache = oslo_cache.get_cache(self.conf) redis_driver = driver.DataDriver( self.conf, cache, driver.ControlDriver(self.conf, cache)) self.assertIsInstance(redis_driver.connection, redis.StrictRedis)
def test_version_match(self): cache = oslo_cache.get_cache() with mock.patch('redis.StrictRedis.info') as info: info.return_value = {'redis_version': '2.4.6'} self.assertRaises(RuntimeError, driver.DataDriver, self.conf, cache) info.return_value = {'redis_version': '2.11'} try: driver.DataDriver(self.conf, cache) except RuntimeError: self.fail('version match failed')