mirror of
https://github.com/django/django.git
synced 2025-08-04 10:59:45 +00:00
Fixed #33681 -- Made Redis client pass CACHES["OPTIONS"] to a connection pool.
Thanks Ben Picolo for the report.
This commit is contained in:
parent
d3677043fc
commit
d27e6b233f
3 changed files with 21 additions and 3 deletions
17
tests/cache/tests.py
vendored
17
tests/cache/tests.py
vendored
|
@ -1817,6 +1817,23 @@ class RedisCacheTests(BaseCacheTests, TestCase):
|
|||
self.assertIsInstance(cache._cache._serializer.dumps(True), bytes)
|
||||
self.assertIsInstance(cache._cache._serializer.dumps("abc"), bytes)
|
||||
|
||||
@override_settings(
|
||||
CACHES=caches_setting_for_tests(
|
||||
base=RedisCache_params,
|
||||
exclude=redis_excluded_caches,
|
||||
OPTIONS={
|
||||
"db": 5,
|
||||
"socket_timeout": 0.1,
|
||||
"retry_on_timeout": True,
|
||||
},
|
||||
)
|
||||
)
|
||||
def test_redis_pool_options(self):
|
||||
pool = cache._cache._get_connection_pool(write=False)
|
||||
self.assertEqual(pool.connection_kwargs["db"], 5)
|
||||
self.assertEqual(pool.connection_kwargs["socket_timeout"], 0.1)
|
||||
self.assertIs(pool.connection_kwargs["retry_on_timeout"], True)
|
||||
|
||||
|
||||
class FileBasedCachePathLibTests(FileBasedCacheTests):
|
||||
def mkdtemp(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue