summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorNeil Johnson <neil@fragile.org.uk>2018-08-16 22:55:32 +0100
committerNeil Johnson <neil@fragile.org.uk>2018-08-16 22:55:32 +0100
commitbcfeb44afe750dadd4199e7c02302b0157bdab11 (patch)
treea2c3bb85b247336c67f5a1dd653ee91c086bfc39 /tests
parentblock event creation and room creation on hitting resource limits (diff)
downloadsynapse-bcfeb44afe750dadd4199e7c02302b0157bdab11.tar.xz
call reap on start up and fix under reaping bug
Diffstat (limited to 'tests')
-rw-r--r--tests/storage/test_monthly_active_users.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/storage/test_monthly_active_users.py b/tests/storage/test_monthly_active_users.py
index 511acbde9b..f2ed866ae7 100644
--- a/tests/storage/test_monthly_active_users.py
+++ b/tests/storage/test_monthly_active_users.py
@@ -75,6 +75,19 @@ class MonthlyActiveUsersTestCase(tests.unittest.TestCase):
         active_count = yield self.store.get_monthly_active_count()
         self.assertEquals(active_count, user_num)
 
+        # Test that regalar users are removed from the db
+        ru_count = 2
+        yield self.store.upsert_monthly_active_user("@ru1:server")
+        yield self.store.upsert_monthly_active_user("@ru2:server")
+        active_count = yield self.store.get_monthly_active_count()
+
+        self.assertEqual(active_count, user_num + ru_count)
+        self.hs.config.max_mau_value = user_num
+        yield self.store.reap_monthly_active_users()
+
+        active_count = yield self.store.get_monthly_active_count()
+        self.assertEquals(active_count, user_num)
+
     @defer.inlineCallbacks
     def test_can_insert_and_count_mau(self):
         count = yield self.store.get_monthly_active_count()