Skip to content

Commit

Permalink
Deflake Join_should_succeed_when_joined_to_allowed_room subtest of …
Browse files Browse the repository at this point in the history
…restricted rooms tests (#413)
  • Loading branch information
David Robertson authored Jul 13, 2022
1 parent ab94cac commit b894551
Showing 1 changed file with 22 additions and 1 deletion.
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

0 comments on commit b894551

Please sign in to comment.