Skip to content

Commit 2f799c8

Browse files
authored
Deflake guest user test (#871)
*Hopefully*, fixes #836
1 parent 1e86c19 commit 2f799c8

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

tests/30rooms/13guestaccess.pl

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@
3434

3535
matrix_set_room_guest_access( $user, $room_id, "can_join" )
3636
->then( sub {
37-
matrix_join_room( $guest_user, $room_id )
37+
# we use join_room_synced as a proxy for ensuring that the join event
38+
# has propagated to the workers, otherwise the worker that receives
39+
# the event send request might not know that we are in the room.
40+
# (see https://github.com/matrix-org/sytest/issues/836)
41+
matrix_join_room_synced( $guest_user, $room_id );
3842
})->then( sub {
3943
matrix_send_room_text_message( $guest_user, $room_id, body => "sup" );
4044
})->then( sub {
@@ -125,7 +129,7 @@
125129

126130
matrix_set_room_guest_access( $user, $room_id, "can_join" )
127131
->then( sub {
128-
matrix_join_room( $guest_user, $room_id );
132+
matrix_join_room_synced( $guest_user, $room_id );
129133
})->then( sub {
130134
matrix_get_room_membership( $user, $room_id, $guest_user );
131135
})->then( sub {
@@ -154,7 +158,11 @@
154158
my $displayname_uri = "/r0/profile/:user_id/displayname";
155159

156160
matrix_set_room_guest_access( $user, $room_id, "can_join" )->then( sub {
157-
matrix_join_room( $guest_user, $room_id );
161+
# we use join_room_synced as a proxy for ensuring that the join event
162+
# has propagated to the workers, otherwise the worker that receives
163+
# the profile request might not know that we are in the room.
164+
# (see https://github.com/matrix-org/sytest/issues/836)
165+
matrix_join_room_synced( $guest_user, $room_id );
158166
})->then( sub {
159167
do_request_json_for( $guest_user,
160168
method => "GET",
@@ -225,7 +233,7 @@
225233
})->then( sub {
226234
matrix_join_room( $remote_user, $room_id );
227235
})->then( sub {
228-
matrix_join_room( $guest_user, $room_id );
236+
matrix_join_room_synced( $guest_user, $room_id );
229237
})->then( sub {
230238
matrix_get_room_membership( $local_user, $room_id, $guest_user );
231239
})->then( sub {

0 commit comments

Comments
 (0)