-
Notifications
You must be signed in to change notification settings - Fork 260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sliding Sync: Move filters tests to rest layer #17703
Sliding Sync: Move filters tests to rest layer #17703
Conversation
# Remove rooms if we can't figure out what room type it is | ||
if not sync_room_map[room_id].has_known_state: | ||
filtered_room_id_set.remove(room_id) | ||
continue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixing filter_rooms_using_tables
(the new path using the new sliding sync tables) to take into account has_known_state
.
The _no_stripped_state
tests exercise these scenarios.
Found this bug because we're actually testing the new path now with this PR.
@@ -1139,3 +1139,61 @@ def test_rooms_bump_stamp_invites(self) -> None: | |||
self.assertEqual( | |||
response_body["rooms"][room_id]["bump_stamp"], invite_pos.stream | |||
) | |||
|
|||
def test_rooms_meta_is_dm(self) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test is "new" because I moved the "Ensure DM's are correctly marked" checking from one of the filtering tests to it's own separate thing here.
) | ||
|
||
def test_filters_is_dm(self) -> None: | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These tests existed before as unit tests against filter_rooms(...)
directly but now that we also have filter_rooms_using_tables(...)
they've been migrated to integration tests at the REST layer operating against the Sliding Sync API itself. This way we can test both code paths with the same tests.
They are just refactored to be at this new layer and interact with the API.
@@ -547,323 +622,6 @@ def test_wait_for_new_data_timeout(self) -> None: | |||
# There should be no room sent down. | |||
self.assertFalse(channel.json_body["rooms"]) | |||
|
|||
def test_filter_list(self) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These filter tests already at the REST layer were just moved to tests/rest/client/sliding_sync/test_lists_filters.py
now that we have a specific file for it.
@@ -141,6 +142,167 @@ def _assertRequiredStateIncludes( | |||
message=str(actual_required_state), | |||
) | |||
|
|||
def _add_new_dm_to_global_account_data( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just moving some helpers to the SlidingSyncBase
so we can use them across the Sliding Sync tests more easily.
@@ -2984,1384 +2979,6 @@ def test_state_reset(self) -> None: | |||
self.assertTrue(room_id1 in newly_left) | |||
|
|||
|
|||
class FilterRoomsTestCase(HomeserverTestCase): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These tests we're moved to tests/rest/client/sliding_sync/test_lists_filters.py
and refactored to interact with the Sliding Sync API directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good to me!
Just a few comments.
} | ||
response_body, _ = self.do_sync(sync_body, tok=user1_tok) | ||
self.assertIncludes( | ||
set(response_body["lists"]["foo-list"]["ops"][0]["room_ids"]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not an issue here, but the ops
field in sync responses is completely omitted from the MSC. ie. https://github.com/matrix-org/matrix-spec-proposals/blob/erikj/sss/proposals/4186-simplified-sliding-sync.md#response-format
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're thinking about removing it in favor of just a straight list like room_ids: []
but until then I'll use it (context #17671 (comment))
Thanks for the review @devonh 🦌 |
Move filters tests to rest layer in order to test the new (with sliding sync tables) and fallback paths that Sliding Sync can use.
Also found a bug in the new path because it's not being tested which is also fixed in this PR. We now take into account
has_known_state
when filtering.Spawning from #17662 (comment). This should have been done when we started using the new sliding sync tables in #17630
Pull Request Checklist
EventStore
toEventWorkerStore
.".code blocks
.(run the linters)