summary refs log tree commit diff
path: root/tests/storage/test_purge.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2020-09-30 20:29:19 +0100
committerGitHub <noreply@github.com>2020-09-30 20:29:19 +0100
commit7941372ec84786f85ae6d75fd2d7a4af5b72ac98 (patch)
tree7871841ee56daa554a283a8b2d409b8739047128 /tests/storage/test_purge.py
parentMerge pull request #8425 from matrix-org/rav/extremity_metrics (diff)
downloadsynapse-7941372ec84786f85ae6d75fd2d7a4af5b72ac98.tar.xz
Make token serializing/deserializing async (#8427)
The idea is that in future tokens will encode a mapping of instance to position. However, we don't want to include the full instance name in the string representation, so instead we'll have a mapping between instance name and an immutable integer ID in the DB that we can use instead. We'll then do the lookup when we serialize/deserialize the token (we could alternatively pass around an `Instance` type that includes both the name and ID, but that turns out to be a lot more invasive).
Diffstat (limited to 'tests/storage/test_purge.py')
-rw-r--r--tests/storage/test_purge.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/storage/test_purge.py b/tests/storage/test_purge.py
index 723cd28933..cc1f3c53c5 100644
--- a/tests/storage/test_purge.py
+++ b/tests/storage/test_purge.py
@@ -47,12 +47,15 @@ class PurgeTests(HomeserverTestCase):
         storage = self.hs.get_storage()
 
         # Get the topological token
-        event = str(
-            self.get_success(store.get_topological_token_for_event(last["event_id"]))
+        token = self.get_success(
+            store.get_topological_token_for_event(last["event_id"])
         )
+        token_str = self.get_success(token.to_string(self.hs.get_datastore()))
 
         # Purge everything before this topological token
-        self.get_success(storage.purge_events.purge_history(self.room_id, event, True))
+        self.get_success(
+            storage.purge_events.purge_history(self.room_id, token_str, True)
+        )
 
         # 1-3 should fail and last will succeed, meaning that 1-3 are deleted
         # and last is not.