-
Notifications
You must be signed in to change notification settings - Fork 60
Add tests for edge cases of multiple membership changes in sync period #787
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
base: main
Are you sure you want to change the base?
Conversation
Addresses element-hq/synapse#14683 case seen in the real world.
tests/csapi/sync_test.go
Outdated
// Alice re-invites Bob | ||
alice.MustInviteRoom(t, roomID, bob.UserID) | ||
|
||
// 4. Bob does a sync | ||
jsonRes, _ := bob.MustSync(t, client.SyncReq{Since: bobSince}) |
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 doesn't guarantee that the leave/invite will be federated to Bob's homeserver by the time Bob syncs.
Perhaps we need another hs2
user in the room to observe first
If we just use bob.MustSyncUntil(t, client.SyncReq{Since: bobSince}, client.SyncInvitedTo(bob.UserID, roomID))
the leave and invite could be separated in different sync responses as we paginate.
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.
Very good point. Another user would work. I'll modify the test to include that.
tests/csapi/sync_test.go
Outdated
|
||
// Wait until Bob is kicked. | ||
aliceSince := alice.MustSyncUntil(t, client.SyncReq{}, client.SyncLeftFrom(bob.UserID, roomID)) | ||
charlieSince = charlie.MustSyncUntil(t, client.SyncReq{Since: charlieSince}, client.SyncLeftFrom(bob.UserID, roomID)) |
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.
I don't think we need to worry about getting a since
token in any of these places execpt for bob
which we are actually testing incremental sync for.
The other sync's are just asserting pre-conditions.
charlieSince = charlie.MustSyncUntil(t, client.SyncReq{Since: charlieSince}, client.SyncLeftFrom(bob.UserID, roomID)) | |
charlie.MustSyncUntil(t, client.SyncReq{}, client.SyncLeftFrom(bob.UserID, roomID)) |
tests/csapi/sync_test.go
Outdated
|
||
// Wait until Bob is kicked. | ||
aliceSince := alice.MustSyncUntil(t, client.SyncReq{}, client.SyncLeftFrom(bob.UserID, roomID)) | ||
charlieSince = charlie.MustSyncUntil(t, client.SyncReq{Since: charlieSince}, client.SyncLeftFrom(bob.UserID, roomID)) |
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.
Add a comment about why we wait here as well
(needs wrapping)
charlieSince = charlie.MustSyncUntil(t, client.SyncReq{Since: charlieSince}, client.SyncLeftFrom(bob.UserID, roomID)) | |
// Wait until hs2 sees that Bob has been kicked. If we don't wait, then we have no idea whether `hs2` received the kick event. | |
charlieSince = charlie.MustSyncUntil(t, client.SyncReq{Since: charlieSince}, client.SyncLeftFrom(bob.UserID, roomID)) |
Addresses element-hq/synapse#14683 case seen in the real world.
Requires element-hq/synapse#18648 for these tests to pass in Synapse.
Pull Request Checklist