summaryrefslogtreecommitdiff
path: root/tests/cache
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2022-05-16 06:17:40 +0200
committerGitHub <noreply@github.com>2022-05-16 06:17:40 +0200
commitd27e6b233f83c3429f21ff3c250a28ff302637ef (patch)
tree83111be79d958775ee6322f20fa4abdd04096655 /tests/cache
parentd3677043fce0fec5d082e8cae142d5e5df35a2b5 (diff)
Fixed #33681 -- Made Redis client pass CACHES["OPTIONS"] to a connection pool.
Thanks Ben Picolo for the report.
Diffstat (limited to 'tests/cache')
-rw-r--r--tests/cache/tests.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/cache/tests.py b/tests/cache/tests.py
index 460e8141d2..4a102d0cc2 100644
--- a/tests/cache/tests.py
+++ b/tests/cache/tests.py
@@ -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):