summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2020-10-19 21:13:50 +0100
committerGitHub <noreply@github.com>2020-10-19 21:13:50 +0100
commit96e7d3c4a0feec6d19b873fd550bcfffd485d910 (patch)
tree0277d94dd40ebe3b61a2d848f596436dda8a0683 /tests
parentDrop unused `device_max_stream_id` table (#8589) (diff)
downloadsynapse-96e7d3c4a0feec6d19b873fd550bcfffd485d910.tar.xz
Fix 'LruCache' object has no attribute '_on_resize' (#8591)
We need to make sure we are readu for the `set_cache_factor` callback.
Diffstat (limited to 'tests')
-rw-r--r--tests/util/test_lrucache.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/util/test_lrucache.py b/tests/util/test_lrucache.py
index f12834edab..a739a6aaaf 100644
--- a/tests/util/test_lrucache.py
+++ b/tests/util/test_lrucache.py
@@ -19,7 +19,8 @@ from mock import Mock
 from synapse.util.caches.lrucache import LruCache
 from synapse.util.caches.treecache import TreeCache
 
-from .. import unittest
+from tests import unittest
+from tests.unittest import override_config
 
 
 class LruCacheTestCase(unittest.HomeserverTestCase):
@@ -83,6 +84,11 @@ class LruCacheTestCase(unittest.HomeserverTestCase):
         cache.clear()
         self.assertEquals(len(cache), 0)
 
+    @override_config({"caches": {"per_cache_factors": {"mycache": 10}}})
+    def test_special_size(self):
+        cache = LruCache(10, "mycache")
+        self.assertEqual(cache.max_size, 100)
+
 
 class LruCacheCallbacksTestCase(unittest.HomeserverTestCase):
     def test_get(self):