diff options
author | Olivier Wilkinson (reivilibre) <olivier@librepush.net> | 2021-07-05 16:13:12 +0100 |
---|---|---|
committer | Olivier Wilkinson (reivilibre) <olivier@librepush.net> | 2021-07-05 16:13:12 +0100 |
commit | 2082de4a237f46d2594331d47aa91593b5552087 (patch) | |
tree | 29b7687125304aff2305f7548a2d5537445fdc2d | |
parent | Characterise current R30 behaviour using tests (diff) | |
download | synapse-2082de4a237f46d2594331d47aa91593b5552087.tar.xz |
Changelog and antilint
Signed-off-by: Olivier Wilkinson (reivilibre) <olivier@librepush.net>
-rw-r--r-- | changelog.d/10315.misc | 1 | ||||
-rw-r--r-- | tests/app/test_phone_stats_home.py | 20 |
2 files changed, 6 insertions, 15 deletions
diff --git a/changelog.d/10315.misc b/changelog.d/10315.misc new file mode 100644 index 0000000000..2c78644e20 --- /dev/null +++ b/changelog.d/10315.misc @@ -0,0 +1 @@ +Add tests to characterise the current behaviour of R30 phone-home metrics. diff --git a/tests/app/test_phone_stats_home.py b/tests/app/test_phone_stats_home.py index 6319ab8a7e..0a57b6ec18 100644 --- a/tests/app/test_phone_stats_home.py +++ b/tests/app/test_phone_stats_home.py @@ -26,9 +26,7 @@ class PhoneHomeTestCase(HomeserverTestCase): self.helper.send(room_id, "message", tok=access_token) # Check the R30 results do not count that user. - r30_results = self.get_success( - self.hs.get_datastore().count_r30_users() - ) + r30_results = self.get_success(self.hs.get_datastore().count_r30_users()) self.assertEqual(r30_results, {"all": 0}) # Advance 30 days (+ 1 second, because strict inequality causes issues if we are @@ -36,9 +34,7 @@ class PhoneHomeTestCase(HomeserverTestCase): self.reactor.advance(30 * DAY + 1) # (Make sure the user isn't somehow counted by this point.) - r30_results = self.get_success( - self.hs.get_datastore().count_r30_users() - ) + r30_results = self.get_success(self.hs.get_datastore().count_r30_users()) self.assertEqual(r30_results, {"all": 0}) # Send a message (this counts as activity) @@ -48,18 +44,14 @@ class PhoneHomeTestCase(HomeserverTestCase): self.reactor.advance(4) # *Now* the user is counted. - r30_results = self.get_success( - self.hs.get_datastore().count_r30_users() - ) + r30_results = self.get_success(self.hs.get_datastore().count_r30_users()) self.assertEqual(r30_results, {"all": 1, "unknown": 1}) # Advance 27 days. The user has now not posted for 27 days. self.reactor.advance(27 * DAY) # The user is still counted. - r30_results = self.get_success( - self.hs.get_datastore().count_r30_users() - ) + r30_results = self.get_success(self.hs.get_datastore().count_r30_users()) self.assertEqual(r30_results, {"all": 1, "unknown": 1}) # Advance another day. The user has now not posted for 28 days. @@ -67,9 +59,7 @@ class PhoneHomeTestCase(HomeserverTestCase): # The user is now no longer counted in R30. # TODO: why is this the case after only 28 days? - r30_results = self.get_success( - self.hs.get_datastore().count_r30_users() - ) + r30_results = self.get_success(self.hs.get_datastore().count_r30_users()) self.assertEqual(r30_results, {"all": 0}) def test_r30_user_must_be_retained_for_at_least_a_month(self): |