forked from matrix-org/synapse
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request matrix-org#3846 from matrix-org/neilj/expose-regis…
…tered-users expose number of real reserved users
- Loading branch information
Showing
4 changed files
with
60 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Add synapse_admin_mau:registered_reserved_users metric to expose number of real reaserved users |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -183,3 +183,34 @@ def test_populate_monthly_users_should_not_update(self): | |
self.store.populate_monthly_active_users('user_id') | ||
self.pump() | ||
self.store.upsert_monthly_active_user.assert_not_called() | ||
|
||
def test_get_reserved_real_user_account(self): | ||
# Test no reserved users, or reserved threepids | ||
count = self.store.get_registered_reserved_users_count() | ||
self.assertEquals(self.get_success(count), 0) | ||
# Test reserved users but no registered users | ||
|
||
user1 = '@user1:example.com' | ||
user2 = '@user2:example.com' | ||
user1_email = '[email protected]' | ||
user2_email = '[email protected]' | ||
threepids = [ | ||
{'medium': 'email', 'address': user1_email}, | ||
{'medium': 'email', 'address': user2_email}, | ||
] | ||
self.hs.config.mau_limits_reserved_threepids = threepids | ||
self.store.initialise_reserved_users(threepids) | ||
self.pump() | ||
count = self.store.get_registered_reserved_users_count() | ||
self.assertEquals(self.get_success(count), 0) | ||
|
||
# Test reserved registed users | ||
self.store.register(user_id=user1, token="123", password_hash=None) | ||
self.store.register(user_id=user2, token="456", password_hash=None) | ||
self.pump() | ||
|
||
now = int(self.hs.get_clock().time_msec()) | ||
self.store.user_add_threepid(user1, "email", user1_email, now, now) | ||
self.store.user_add_threepid(user2, "email", user2_email, now, now) | ||
count = self.store.get_registered_reserved_users_count() | ||
self.assertEquals(self.get_success(count), len(threepids)) |