@@ -277,29 +277,29 @@ func TestSync(t *testing.T) {
277277
278278 t .Parallel ()
279279
280- // alice creates two rooms, which charlie (on our test server) joins
280+ // alice creates two rooms, which hs2ObserverUser (on our test server) joins
281281 srv := federation .NewServer (t , deployment ,
282282 federation .HandleKeyRequests (),
283283 federation .HandleTransactionRequests (nil , nil ),
284284 )
285285 cancel := srv .Listen ()
286286 defer cancel ()
287287
288- charlie := srv .UserID ("charlie " )
288+ hs2ObserverUser := srv .UserID ("hs2ObserverUser " )
289289
290290 redactionRoomID := alice .MustCreateRoom (t , map [string ]interface {}{"preset" : "public_chat" })
291- redactionRoom := srv .MustJoinRoom (t , deployment , deployment .GetFullyQualifiedHomeserverName (t , "hs1" ), redactionRoomID , charlie )
291+ redactionRoom := srv .MustJoinRoom (t , deployment , deployment .GetFullyQualifiedHomeserverName (t , "hs1" ), redactionRoomID , hs2ObserverUser )
292292
293293 sentinelRoomID := alice .MustCreateRoom (t , map [string ]interface {}{"preset" : "public_chat" })
294- sentinelRoom := srv .MustJoinRoom (t , deployment , deployment .GetFullyQualifiedHomeserverName (t , "hs1" ), sentinelRoomID , charlie )
294+ sentinelRoom := srv .MustJoinRoom (t , deployment , deployment .GetFullyQualifiedHomeserverName (t , "hs1" ), sentinelRoomID , hs2ObserverUser )
295295
296- // charlie creates a bogus redaction, which he sends out, followed by
296+ // hs2ObserverUser creates a bogus redaction, which he sends out, followed by
297297 // a good event - in another room - to act as a sentinel. It's not
298298 // guaranteed, but hopefully if the sentinel is received, so was the
299299 // redaction.
300300 redactionEvent := srv .MustCreateEvent (t , redactionRoom , federation.Event {
301301 Type : "m.room.redaction" ,
302- Sender : charlie ,
302+ Sender : hs2ObserverUser ,
303303 Content : map [string ]interface {}{},
304304 Redacts : "$12345" })
305305 redactionRoom .AddEvent (redactionEvent )
@@ -308,7 +308,7 @@ func TestSync(t *testing.T) {
308308
309309 sentinelEvent := srv .MustCreateEvent (t , sentinelRoom , federation.Event {
310310 Type : "m.room.test" ,
311- Sender : charlie ,
311+ Sender : hs2ObserverUser ,
312312 Content : map [string ]interface {}{"body" : "1234" },
313313 })
314314 sentinelRoom .AddEvent (sentinelEvent )
@@ -318,14 +318,14 @@ func TestSync(t *testing.T) {
318318 // wait for the sentinel to arrive
319319 nextBatch := alice .MustSyncUntil (t , client.SyncReq {}, client .SyncTimelineHasEventID (sentinelRoomID , sentinelEvent .EventID ()))
320320
321- // charlie sends another batch of events to force a gappy sync.
321+ // hs2ObserverUser sends another batch of events to force a gappy sync.
322322 // We have to send 11 events to force a gap, since we use a filter with a timeline limit of 10 events.
323323 pdus := make ([]json.RawMessage , 11 )
324324 var lastSentEventId string
325325 for i := range pdus {
326326 ev := srv .MustCreateEvent (t , redactionRoom , federation.Event {
327327 Type : "m.room.message" ,
328- Sender : charlie ,
328+ Sender : hs2ObserverUser ,
329329 Content : map [string ]interface {}{},
330330 })
331331 redactionRoom .AddEvent (ev )
@@ -403,7 +403,7 @@ func TestSync(t *testing.T) {
403403 //
404404 // Regression test for https://github.com/element-hq/synapse/issues/16948
405405
406- charlie := deployment .Register (t , "hs1" , helpers.RegistrationOpts {LocalpartSuffix : "charlie " })
406+ hs2ObserverUser := deployment .Register (t , "hs1" , helpers.RegistrationOpts {LocalpartSuffix : "hs2ObserverUser " })
407407 roomID := alice .MustCreateRoom (t , map [string ]interface {}{"preset" : "public_chat" })
408408
409409 aliceSyncFilter := `{
@@ -414,23 +414,23 @@ func TestSync(t *testing.T) {
414414 }`
415415 _ , initialSyncToken := alice .MustSync (t , client.SyncReq {Filter : aliceSyncFilter })
416416
417- charlie .MustJoinRoom (t , roomID , nil )
417+ hs2ObserverUser .MustJoinRoom (t , roomID , nil )
418418 syncToken := alice .MustSyncUntil (t , client.SyncReq {Filter : aliceSyncFilter , Since : initialSyncToken },
419- syncDeviceListsHas ("changed" , charlie .UserID ),
419+ syncDeviceListsHas ("changed" , hs2ObserverUser .UserID ),
420420 )
421421
422422 // Charlie sends a message, and leaves
423- sendMessages (t , charlie , roomID , "test" , 1 )
424- charlie .MustLeaveRoom (t , roomID )
423+ sendMessages (t , hs2ObserverUser , roomID , "test" , 1 )
424+ hs2ObserverUser .MustLeaveRoom (t , roomID )
425425
426- // Alice sees charlie in the "left" section
426+ // Alice sees hs2ObserverUser in the "left" section
427427 alice .MustSyncUntil (t , client.SyncReq {Filter : aliceSyncFilter , Since : syncToken },
428- syncDeviceListsHas ("left" , charlie .UserID ),
428+ syncDeviceListsHas ("left" , hs2ObserverUser .UserID ),
429429 )
430430
431431 // ... even if she makes the request twice
432432 resp , _ := alice .MustSync (t , client.SyncReq {Filter : aliceSyncFilter , Since : syncToken })
433- if err := syncDeviceListsHas ("left" , charlie .UserID )(alice .UserID , resp ); err != nil {
433+ if err := syncDeviceListsHas ("left" , hs2ObserverUser .UserID )(alice .UserID , resp ); err != nil {
434434 t .Error (err )
435435 }
436436 })
@@ -441,11 +441,11 @@ func TestSync(t *testing.T) {
441441// This is a regression test for
442442// https://github.com/matrix-org/synapse/issues/16463
443443//
444- // We test this by having a local user (alice) and remote user (charlie ) in a
444+ // We test this by having a local user (alice) and remote user (hs2ObserverUser ) in a
445445// room. Charlie sends 50+ messages into the room without sending to Alice's
446446// server. Charlie then sends one more which get sent to Alice.
447447//
448- // Alice should observe that she receives some (though not all) of charlie 's
448+ // Alice should observe that she receives some (though not all) of hs2ObserverUser 's
449449// events, with the `limited` flag set.
450450func TestSyncTimelineGap (t * testing.T ) {
451451 runtime .SkipIf (t , runtime .Dendrite )
@@ -460,10 +460,10 @@ func TestSyncTimelineGap(t *testing.T) {
460460 cancel := srv .Listen ()
461461 defer cancel ()
462462
463- charlie := srv .UserID ("charlie " )
463+ hs2ObserverUser := srv .UserID ("hs2ObserverUser " )
464464
465465 roomID := alice .MustCreateRoom (t , map [string ]interface {}{"preset" : "public_chat" })
466- room := srv .MustJoinRoom (t , deployment , deployment .GetFullyQualifiedHomeserverName (t , "hs1" ), roomID , charlie )
466+ room := srv .MustJoinRoom (t , deployment , deployment .GetFullyQualifiedHomeserverName (t , "hs1" ), roomID , hs2ObserverUser )
467467
468468 filterID := createFilter (t , alice , map [string ]interface {}{
469469 "room" : map [string ]interface {}{
@@ -489,7 +489,7 @@ func TestSyncTimelineGap(t *testing.T) {
489489 for i := 0 ; i < 50 ; i ++ {
490490 event := srv .MustCreateEvent (t , room , federation.Event {
491491 Type : "m.room.message" ,
492- Sender : charlie ,
492+ Sender : hs2ObserverUser ,
493493 Content : map [string ]interface {}{
494494 "body" : "Remote message" ,
495495 "msgtype" : "m.text" ,
@@ -503,7 +503,7 @@ func TestSyncTimelineGap(t *testing.T) {
503503 // previous 50.
504504 lastEvent := srv .MustCreateEvent (t , room , federation.Event {
505505 Type : "m.room.message" ,
506- Sender : charlie ,
506+ Sender : hs2ObserverUser ,
507507 Content : map [string ]interface {}{
508508 "body" : "End" ,
509509 "msgtype" : "m.text" ,
@@ -520,11 +520,11 @@ func TestSyncTimelineGap(t *testing.T) {
520520 // We now test two different modes of /sync work. The first is when we are
521521 // syncing when the server receives the `lastEvent` (and so, at least
522522 // Synapse, will start sending down some events immediately). In this mode
523- // we may see alice's message, but charlie 's messages should set the limited
523+ // we may see alice's message, but hs2ObserverUser 's messages should set the limited
524524 // flag.
525525 //
526526 // The second mode is when we incremental sync *after* all the events have
527- // finished being persisted, and so we get only charlie 's messages.
527+ // finished being persisted, and so we get only hs2ObserverUser 's messages.
528528 t .Run ("incremental" , func (t * testing.T ) {
529529 timelineSequence := make ([]gjson.Result , 0 )
530530
@@ -574,7 +574,7 @@ func TestSyncTimelineGap(t *testing.T) {
574574 t .Fatalf ("Got message from alice after limited flag" )
575575 }
576576 } else {
577- if ev .Get ("sender" ).Str == charlie {
577+ if ev .Get ("sender" ).Str == hs2ObserverUser {
578578 t .Fatalf ("Got message from remote without limited flag being set" )
579579 }
580580 }
@@ -631,32 +631,32 @@ func TestPresenceSyncDifferentRooms(t *testing.T) {
631631 alice := deployment .Register (t , "hs1" , helpers.RegistrationOpts {})
632632 bob := deployment .Register (t , "hs1" , helpers.RegistrationOpts {})
633633
634- charlie := deployment .Register (t , "hs1" , helpers.RegistrationOpts {
635- LocalpartSuffix : "charlie " ,
634+ hs2ObserverUser := deployment .Register (t , "hs1" , helpers.RegistrationOpts {
635+ LocalpartSuffix : "hs2ObserverUser " ,
636636 })
637637
638638 // Alice creates two rooms: one with her and Bob, and a second with her and Charlie.
639639 bobRoomID := alice .MustCreateRoom (t , map [string ]interface {}{})
640- charlieRoomID := alice .MustCreateRoom (t , map [string ]interface {}{})
641- nextBatch := alice .MustSyncUntil (t , client.SyncReq {}, client .SyncJoinedTo (alice .UserID , bobRoomID ), client .SyncJoinedTo (alice .UserID , charlieRoomID ))
640+ hs2ObserverUserRoomID := alice .MustCreateRoom (t , map [string ]interface {}{})
641+ nextBatch := alice .MustSyncUntil (t , client.SyncReq {}, client .SyncJoinedTo (alice .UserID , bobRoomID ), client .SyncJoinedTo (alice .UserID , hs2ObserverUserRoomID ))
642642
643643 alice .MustInviteRoom (t , bobRoomID , bob .UserID )
644- alice .MustInviteRoom (t , charlieRoomID , charlie .UserID )
644+ alice .MustInviteRoom (t , hs2ObserverUserRoomID , hs2ObserverUser .UserID )
645645 bob .MustJoinRoom (t , bobRoomID , nil )
646- charlie .MustJoinRoom (t , charlieRoomID , nil )
646+ hs2ObserverUser .MustJoinRoom (t , hs2ObserverUserRoomID , nil )
647647
648648 nextBatch = alice .MustSyncUntil (t ,
649649 client.SyncReq {Since : nextBatch },
650650 client .SyncJoinedTo (bob .UserID , bobRoomID ),
651- client .SyncJoinedTo (charlie .UserID , charlieRoomID ),
651+ client .SyncJoinedTo (hs2ObserverUser .UserID , hs2ObserverUserRoomID ),
652652 )
653653
654654 // Bob and Charlie mark themselves as online.
655655 reqBody := client .WithJSONBody (t , map [string ]interface {}{
656656 "presence" : "online" ,
657657 })
658658 bob .Do (t , "PUT" , []string {"_matrix" , "client" , "v3" , "presence" , bob .UserID , "status" }, reqBody )
659- charlie .Do (t , "PUT" , []string {"_matrix" , "client" , "v3" , "presence" , charlie .UserID , "status" }, reqBody )
659+ hs2ObserverUser .Do (t , "PUT" , []string {"_matrix" , "client" , "v3" , "presence" , hs2ObserverUser .UserID , "status" }, reqBody )
660660
661661 // Alice should see that Bob and Charlie are online. She may see this happen
662662 // simultaneously in one /sync response, or separately in two /sync
@@ -675,14 +675,14 @@ func TestPresenceSyncDifferentRooms(t *testing.T) {
675675 if x .Get ("sender" ).Str == bob .UserID {
676676 seenBobOnline = true
677677 }
678- if x .Get ("sender" ).Str == charlie .UserID {
678+ if x .Get ("sender" ).Str == hs2ObserverUser .UserID {
679679 seenCharlieOnline = true
680680 }
681681 if seenBobOnline && seenCharlieOnline {
682682 return nil
683683 }
684684 }
685- return fmt .Errorf ("all users not present yet, bob %t charlie %t" , seenBobOnline , seenCharlieOnline )
685+ return fmt .Errorf ("all users not present yet, bob %t hs2ObserverUser %t" , seenBobOnline , seenCharlieOnline )
686686 })
687687}
688688
@@ -827,8 +827,8 @@ func TestLeaveReinviteSyncFederated(t *testing.T) {
827827 alice := deployment .Register (t , "hs1" , helpers.RegistrationOpts {})
828828 bob := deployment .Register (t , "hs2" , helpers.RegistrationOpts {})
829829
830- // Charlie is simply here to flag when events arrive over federation to hs2.
831- charlie := deployment .Register (t , "hs2" , helpers.RegistrationOpts {})
830+ // This user is here to flag when events arrive over federation to hs2.
831+ hs2ObserverUser := deployment .Register (t , "hs2" , helpers.RegistrationOpts {})
832832
833833 // 1. Alice creates a room and both Bob and Charlie join
834834 roomID := alice .MustCreateRoom (t , map [string ]any {
@@ -837,20 +837,20 @@ func TestLeaveReinviteSyncFederated(t *testing.T) {
837837
838838 // Users on hs2 need to join via federation, so we need to specify the server name
839839 alice .MustInviteRoom (t , roomID , bob .UserID )
840- alice .MustInviteRoom (t , roomID , charlie .UserID )
840+ alice .MustInviteRoom (t , roomID , hs2ObserverUser .UserID )
841841 bob .MustSyncUntil (t , client.SyncReq {}, client .SyncInvitedTo (bob .UserID , roomID ))
842- charlie .MustSyncUntil (t , client.SyncReq {}, client .SyncInvitedTo (charlie .UserID , roomID ))
842+ hs2ObserverUser .MustSyncUntil (t , client.SyncReq {}, client .SyncInvitedTo (hs2ObserverUser .UserID , roomID ))
843843
844844 bob .MustJoinRoom (t , roomID , []spec.ServerName {
845845 deployment .GetFullyQualifiedHomeserverName (t , "hs1" ),
846846 })
847- charlie .MustJoinRoom (t , roomID , []spec.ServerName {
847+ hs2ObserverUser .MustJoinRoom (t , roomID , []spec.ServerName {
848848 deployment .GetFullyQualifiedHomeserverName (t , "hs1" ),
849849 })
850850
851851 // 2. Both Bob and Charlie do a sync and verify that they see the join
852852 bobSince := bob .MustSyncUntil (t , client.SyncReq {}, client .SyncJoinedTo (bob .UserID , roomID ))
853- charlieSince := charlie .MustSyncUntil (t , client.SyncReq {}, client .SyncJoinedTo (charlie .UserID , roomID ))
853+ hs2ObserverUser .MustSyncUntil (t , client.SyncReq {}, client .SyncJoinedTo (hs2ObserverUser .UserID , roomID ))
854854
855855 // 3. Alice kicks Bob from the room and then re-invites them.
856856 // For kicking, we need to use the POST /rooms/{roomId}/kick endpoint
@@ -862,17 +862,19 @@ func TestLeaveReinviteSyncFederated(t *testing.T) {
862862
863863 // Wait until Bob is kicked.
864864 aliceSince := alice .MustSyncUntil (t , client.SyncReq {}, client .SyncLeftFrom (bob .UserID , roomID ))
865- charlieSince = charlie .MustSyncUntil (t , client.SyncReq {Since : charlieSince }, client .SyncLeftFrom (bob .UserID , roomID ))
865+
866+ // Wait until hs2 sees that Bob has been kicked. If we don't wait, then we
867+ // have no idea whether `hs2` received the kick event.
868+ hs2ObserverUser .MustSyncUntil (t , client.SyncReq {}, client .SyncLeftFrom (bob .UserID , roomID ))
866869
867870 // Alice re-invites Bob
868871 alice .MustInviteRoom (t , roomID , bob .UserID )
869872 alice .MustSyncUntil (t , client.SyncReq {Since : aliceSince }, client .SyncInvitedTo (bob .UserID , roomID ))
870873
871- // Wait until hs2 sees that Bob has been kicked and re-invited (this is all
872- // Charlie is needed for). If we don't wait, then Bob might sync too early
873- // (slow federation) and catch the kick in one sync iteration, and the
874- // invite in another, invalidating the test conditions.
875- charlieSince = charlie .MustSyncUntil (t , client.SyncReq {Since : charlieSince }, client .SyncInvitedTo (bob .UserID , roomID ))
874+ // Wait until hs2 sees that Bob has been re-invited. If we don't wait, then
875+ // Bob might sync too early (slow federation) and catch the kick in one sync
876+ // iteration, and the invite in another, invalidating the test conditions.
877+ hs2ObserverUser .MustSyncUntil (t , client.SyncReq {}, client .SyncInvitedTo (bob .UserID , roomID ))
876878
877879 // 4. Bob does an incremental sync. Bob's last sync was after they joined the room.
878880 jsonRes , _ := bob .MustSync (t , client.SyncReq {Since : bobSince })
0 commit comments