From 4e021cdd94466cf4ee9510f84ac047f4c3873629 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Mon, 5 Jul 2021 16:30:40 +0100 Subject: [PATCH 1/3] Fix race in MSC3083 TestRestrictedRoomsRemoteJoin This was broken by matrix-org/synapse#10272 --- tests/msc3083_test.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/msc3083_test.go b/tests/msc3083_test.go index 94cb5049..e3cacdb3 100644 --- a/tests/msc3083_test.go +++ b/tests/msc3083_test.go @@ -93,6 +93,15 @@ func checkRestrictedRoom(t *testing.T, alice *client.CSAPI, bob *client.CSAPI, s // Leaving the room works and the user is unable to re-join. bob.LeaveRoom(t, room) bob.LeaveRoom(t, space) + + alice.SyncUntilTimelineHas(t, space, func(ev gjson.Result) bool { + if ev.Get("type").Str != "m.room.member" || ev.Get("sender").Str != bob.UserID { + return false + } + + return ev.Get("content").Get("membership").Str == "leave" + }) + failJoinRoom(t, bob, room, "hs1") // Invite the user and joining should work. From b1a668442a309adb0926bf6833d0ce323b02a498 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Wed, 7 Jul 2021 12:47:40 +0100 Subject: [PATCH 2/3] Add comment --- tests/msc3083_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/msc3083_test.go b/tests/msc3083_test.go index e3cacdb3..ce7b162a 100644 --- a/tests/msc3083_test.go +++ b/tests/msc3083_test.go @@ -94,6 +94,8 @@ func checkRestrictedRoom(t *testing.T, alice *client.CSAPI, bob *client.CSAPI, s bob.LeaveRoom(t, room) bob.LeaveRoom(t, space) + // Wait until Alice sees Bob leave the space. This ensures that Alice's HS + // has processed the leave before Bob tries rejoining. alice.SyncUntilTimelineHas(t, space, func(ev gjson.Result) bool { if ev.Get("type").Str != "m.room.member" || ev.Get("sender").Str != bob.UserID { return false From 429797c36b46f19b5ba8e350db81dbd590e5e4f5 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Wed, 7 Jul 2021 13:09:11 +0100 Subject: [PATCH 3/3] Update tests/msc3083_test.go Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> --- tests/msc3083_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/msc3083_test.go b/tests/msc3083_test.go index ce7b162a..410e9a52 100644 --- a/tests/msc3083_test.go +++ b/tests/msc3083_test.go @@ -95,7 +95,8 @@ func checkRestrictedRoom(t *testing.T, alice *client.CSAPI, bob *client.CSAPI, s bob.LeaveRoom(t, space) // Wait until Alice sees Bob leave the space. This ensures that Alice's HS - // has processed the leave before Bob tries rejoining. + // has processed the leave before Bob tries rejoining, so that it rejects his + // attempt to join the room. alice.SyncUntilTimelineHas(t, space, func(ev gjson.Result) bool { if ev.Get("type").Str != "m.room.member" || ev.Get("sender").Str != bob.UserID { return false