summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2023-03-31 13:51:51 +0100
committerGitHub <noreply@github.com>2023-03-31 13:51:51 +0100
commit6204c3663eabec57e897e7e75180b959a936e1fe (patch)
treeb4c4e7e6b91b60c7c40670a6a149acb0c753e491 /tests
parentRevert "Set thread_id column to non-null for event_push_{actions,actions_stag... (diff)
downloadsynapse-6204c3663eabec57e897e7e75180b959a936e1fe.tar.xz
Revert pruning of old devices (#15360)
* Revert "Fix registering a device on an account with lots of devices (#15348)"

This reverts commit f0d8f66eaaacfa75bed65bc5d0c602fbc5339c85.

* Revert "Delete stale non-e2e devices for users, take 3 (#15183)"

This reverts commit 78cdb72cd6b0e007c314d9fed9f629dfc5b937a6.
Diffstat (limited to 'tests')
-rw-r--r--tests/handlers/test_admin.py2
-rw-r--r--tests/handlers/test_device.py2
-rw-r--r--tests/rest/client/test_register.py47
-rw-r--r--tests/storage/test_client_ips.py4
4 files changed, 3 insertions, 52 deletions
diff --git a/tests/handlers/test_admin.py b/tests/handlers/test_admin.py
index f0ba3775c8..5569ccef8a 100644
--- a/tests/handlers/test_admin.py
+++ b/tests/handlers/test_admin.py
@@ -272,7 +272,7 @@ class ExfiltrateData(unittest.HomeserverTestCase):
         self.assertIn("device_id", args[0][0])
         self.assertIsNone(args[0][0]["display_name"])
         self.assertIsNone(args[0][0]["last_seen_user_agent"])
-        self.assertEqual(args[0][0]["last_seen_ts"], 600)
+        self.assertIsNone(args[0][0]["last_seen_ts"])
         self.assertIsNone(args[0][0]["last_seen_ip"])
 
     def test_connections(self) -> None:
diff --git a/tests/handlers/test_device.py b/tests/handlers/test_device.py
index a456bffd63..ce7525e29c 100644
--- a/tests/handlers/test_device.py
+++ b/tests/handlers/test_device.py
@@ -115,7 +115,7 @@ class DeviceTestCase(unittest.HomeserverTestCase):
                 "device_id": "xyz",
                 "display_name": "display 0",
                 "last_seen_ip": None,
-                "last_seen_ts": 1000000,
+                "last_seen_ts": None,
             },
             device_map["xyz"],
         )
diff --git a/tests/rest/client/test_register.py b/tests/rest/client/test_register.py
index 7ae84e3139..b228dba861 100644
--- a/tests/rest/client/test_register.py
+++ b/tests/rest/client/test_register.py
@@ -794,53 +794,6 @@ class RegisterRestServletTestCase(unittest.HomeserverTestCase):
             ApprovalNoticeMedium.NONE, channel.json_body["approval_notice_medium"]
         )
 
-    def test_check_stale_devices_get_pruned(self) -> None:
-        """Check that if a user has some stale devices we log them out when they
-        log in a new device."""
-
-        # Register some devices, but not too many that we go over the threshold
-        # where we prune more aggressively.
-        user_id = self.register_user("user", "pass")
-        for _ in range(0, 50):
-            self.login(user_id, "pass")
-
-        store = self.hs.get_datastores().main
-
-        res = self.get_success(store.get_devices_by_user(user_id))
-        self.assertEqual(len(res), 50)
-
-        # Advance time so that the above devices are considered "old".
-        self.reactor.advance(30 * 24 * 60 * 60 * 1000)
-
-        self.login(user_id, "pass")
-
-        self.reactor.pump([60] * 10)  # Ensure background job runs
-
-        # We expect all old devices to have been logged out
-        res = self.get_success(store.get_devices_by_user(user_id))
-        self.assertEqual(len(res), 1)
-
-    def test_check_recent_devices_get_pruned(self) -> None:
-        """Check that if a user has many devices we log out the last oldest
-        ones.
-
-        Note: this is similar to above, except if we lots of devices we prune
-        devices even if they're not old.
-        """
-
-        # Register a lot of devices in a short amount of time
-        user_id = self.register_user("user", "pass")
-        for _ in range(0, 100):
-            self.login(user_id, "pass")
-            self.reactor.advance(100)
-
-        store = self.hs.get_datastores().main
-
-        # We keep up to 50 devices that have been used in the last week, plus
-        # the device that was last logged in.
-        res = self.get_success(store.get_devices_by_user(user_id))
-        self.assertEqual(len(res), 51)
-
 
 class AccountValidityTestCase(unittest.HomeserverTestCase):
     servlets = [
diff --git a/tests/storage/test_client_ips.py b/tests/storage/test_client_ips.py
index f989986538..cd0079871c 100644
--- a/tests/storage/test_client_ips.py
+++ b/tests/storage/test_client_ips.py
@@ -170,8 +170,6 @@ class ClientIpStoreTestCase(unittest.HomeserverTestCase):
             )
         )
 
-        last_seen = self.clock.time_msec()
-
         if after_persisting:
             # Trigger the storage loop
             self.reactor.advance(10)
@@ -192,7 +190,7 @@ class ClientIpStoreTestCase(unittest.HomeserverTestCase):
                         "device_id": device_id,
                         "ip": None,
                         "user_agent": None,
-                        "last_seen": last_seen,
+                        "last_seen": None,
                     },
                 ],
             )