Skip to content
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

Deflake Join_should_succeed_when_joined_to_allowed_room subtest of restricted rooms tests #413

Merged
merged 1 commit into from
Jul 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion tests/restricted_rooms_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,29 @@ func checkRestrictedRoom(t *testing.T, alice *client.CSAPI, bob *client.CSAPI, a
})

t.Run("Join should succeed when joined to allowed room", func(t *testing.T) {
// Join the allowed room, attempt to join the room again, which now should succeed.
// Join the allowed room.
bob.JoinRoom(t, allowed_room, []string{"hs1"})

// Confirm that we joined the allowed room by changing displayname and
// waiting for confirmation in the /sync response. (This is an attempt
// to mitigate race conditions between Synapse workers. We want to
// ensure that the worker serving the join to `room` knows we are joined
// to `allowed_room`.)
bob.SendEventSynced(
t,
allowed_room,
b.Event{
Type: "m.room.member",
Sender: bob.UserID,
StateKey: &bob.UserID,
Content: map[string]interface{}{
"membership": "join",
"displayname": "Bobby",
},
},
)

// We should now be able to join the restricted room.
bob.JoinRoom(t, room, []string{"hs1"})

// Joining the same room again should work fine (e.g. to change your display name).
Expand Down