diff options
| author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2022-05-16 06:17:40 +0200 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2022-05-16 06:18:49 +0200 |
| commit | 5c6ebe19cca28a96518325bd16435c9e555bc13c (patch) | |
| tree | 3f0737af22fcaa5616768343c1383754129b9810 /tests | |
| parent | 8b2a93ee5bec74e0b4d84bd5c6a22c62b157232e (diff) | |
[4.0.x] Fixed #33681 -- Made Redis client pass CACHES["OPTIONS"] to a connection pool.
Thanks Ben Picolo for the report.
Backport of d27e6b233f83c3429f21ff3c250a28ff302637ef from main
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/cache/tests.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/cache/tests.py b/tests/cache/tests.py index 7764b92597..ab276eaea3 100644 --- a/tests/cache/tests.py +++ b/tests/cache/tests.py @@ -1898,6 +1898,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): |
