From b3ddf68887a920eb587237616503c6a64708f2c9 Mon Sep 17 00:00:00 2001 From: Chrislearn Young Date: Wed, 8 Oct 2025 18:16:42 +0800 Subject: [PATCH 1/2] Wait second to make sure events synced to hs1 --- tests/restricted_rooms_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/restricted_rooms_test.go b/tests/restricted_rooms_test.go index 2787ad74..5b78ab71 100644 --- a/tests/restricted_rooms_test.go +++ b/tests/restricted_rooms_test.go @@ -4,6 +4,7 @@ package tests import ( "testing" + "time" "github.com/tidwall/gjson" @@ -325,6 +326,7 @@ func doTestRestrictedRoomsRemoteJoinLocalUser(t *testing.T, roomVersion string, }) charlie.MustLeaveRoom(t, room) + time.Sleep(time.Second) // Ensure the events have synced to hs1. alice.MustSyncUntil(t, client.SyncReq{}, client.SyncTimelineHas( room, From b90131de4bb12c5642f48538cc5aea1d913847fe Mon Sep 17 00:00:00 2001 From: Chrislearn Young Date: Sun, 26 Oct 2025 07:34:38 +0800 Subject: [PATCH 2/2] Use SyncLeftFrom to check charlie left --- tests/restricted_rooms_test.go | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/tests/restricted_rooms_test.go b/tests/restricted_rooms_test.go index 5b78ab71..1fd28588 100644 --- a/tests/restricted_rooms_test.go +++ b/tests/restricted_rooms_test.go @@ -4,7 +4,6 @@ package tests import ( "testing" - "time" "github.com/tidwall/gjson" @@ -326,19 +325,8 @@ func doTestRestrictedRoomsRemoteJoinLocalUser(t *testing.T, roomVersion string, }) charlie.MustLeaveRoom(t, room) - time.Sleep(time.Second) // Ensure the events have synced to hs1. - alice.MustSyncUntil(t, client.SyncReq{}, client.SyncTimelineHas( - room, - func(ev gjson.Result) bool { - if ev.Get("type").Str != "m.room.member" || ev.Get("state_key").Str != charlie.UserID { - return false - } - must.Equal(t, ev.Get("content").Get("membership").Str, "leave", "Charlie failed to leave the room") - - return true - }, - )) + alice.MustSyncUntil(t, client.SyncReq{}, client.SyncLeftFrom(charlie.UserID, room)) // Have bob leave and rejoin. This should still work even though hs2 isn't in // the room anymore!