diff options
author | Erik Johnston <erik@matrix.org> | 2024-07-26 10:28:04 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2024-07-26 10:28:04 +0100 |
commit | 470c5d34d10d3794617ed3efb05fc4910319dcfa (patch) | |
tree | 754b3c94b1c93250f8e18aa7c878d97751fb1925 | |
parent | Move to integration tests (diff) | |
download | synapse-470c5d34d10d3794617ed3efb05fc4910319dcfa.tar.xz |
Review comments
-rw-r--r-- | synapse/handlers/sliding_sync.py | 3 | ||||
-rw-r--r-- | tests/rest/client/test_sync.py | 33 |
2 files changed, 21 insertions, 15 deletions
diff --git a/synapse/handlers/sliding_sync.py b/synapse/handlers/sliding_sync.py index 4e8d6e02d4..e714662a02 100644 --- a/synapse/handlers/sliding_sync.py +++ b/synapse/handlers/sliding_sync.py @@ -1750,6 +1750,9 @@ class SlidingSyncHandler: else: assert from_bound is not None + # TODO: Limit the number of state events we're about to send down + # the room, if its too many we should change this to an + # `initial=True`? deltas = await self.store.get_current_state_deltas_for_room( room_id=room_id, from_token=from_bound, diff --git a/tests/rest/client/test_sync.py b/tests/rest/client/test_sync.py index 05a9da1101..e1199a3336 100644 --- a/tests/rest/client/test_sync.py +++ b/tests/rest/client/test_sync.py @@ -4476,7 +4476,7 @@ class SlidingSyncTestCase(SlidingSyncBase): def test_incremental_sync_incremental_state(self) -> None: """Test that we only get state updates in incremental sync for rooms - we've already seen. + we've already seen (LIVE). """ user1_id = self.register_user("user1", "pass") @@ -4611,8 +4611,8 @@ class SlidingSyncTestCase(SlidingSyncBase): def test_incremental_sync_full_state_previously(self, limited: bool) -> None: """ Test getting room data where we have previously sent down the room, but - we missed sending down some data previously and so its state is - considered PREVIOUSLY. + we missed sending down some timeline events previously and so its status + is considered PREVIOUSLY. There are two versions of this test, one where there are more messages than the timeline limit, and one where there isn't. @@ -4645,7 +4645,10 @@ class SlidingSyncTestCase(SlidingSyncBase): } # The first room gets sent down the initial sync - _, initial_from_token = self.do_sync(sync_body, tok=user1_tok) + response_body, initial_from_token = self.do_sync(sync_body, tok=user1_tok) + self.assertCountEqual( + response_body["rooms"].keys(), {room_id1}, response_body["rooms"] + ) # We now send down some events in room1 (depending on the test param). expected_events = [] # The set of events in the timeline @@ -4661,7 +4664,13 @@ class SlidingSyncTestCase(SlidingSyncBase): self.helper.send(room_id2, "msg", tok=user1_tok) # Only the second room gets sent down sync. - _, from_token = self.do_sync(sync_body, since=initial_from_token, tok=user1_tok) + response_body, from_token = self.do_sync( + sync_body, since=initial_from_token, tok=user1_tok + ) + + self.assertCountEqual( + response_body["rooms"].keys(), {room_id2}, response_body["rooms"] + ) # FIXME: This is a hack to record that the first room wasn't sent down # sync, as we don't implement that currently. @@ -4673,16 +4682,6 @@ class SlidingSyncTestCase(SlidingSyncBase): user=requester.user, requester=requester, conn_id=conn_id, - lists={ - "list": SlidingSyncConfig.SlidingSyncList( - timeline_limit=1, - required_state=[ - (EventTypes.Name, ""), - ], - ), - }, - room_subscriptions={}, - extensions=None, ) parsed_initial_from_token = self.get_success( @@ -4714,6 +4713,10 @@ class SlidingSyncTestCase(SlidingSyncBase): # This sync should contain the messages from room1 not yet sent down. response_body, _ = self.do_sync(sync_body, since=from_token, tok=user1_tok) + self.assertCountEqual( + response_body["rooms"].keys(), {room_id1}, response_body["rooms"] + ) + self.assertEqual( [ev["event_id"] for ev in response_body["rooms"][room_id1]["timeline"]], expected_events[-timeline_limit:], |