Skip to content

Commit 7679e69

Browse files
committed
Send marker events in all federation tests
The marker event is important to let the remote homeservers know there are historical messages at the given insertion event it points to. It's just a lucky happen-stance that the tests passed before without the need for the marker event. Marker events are required/expected in order for the history to be properly visible on remote homservers.
1 parent aaf78a8 commit 7679e69

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

tests/msc2716_test.go

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,11 @@ func TestImportHistoricalMessages(t *testing.T) {
575575
)
576576
batchSendResBody := client.ParseJSON(t, batchSendRes)
577577
historicalEventIDs := client.GetJSONFieldStringArray(t, batchSendResBody, "event_ids")
578+
baseInsertionEventID := client.GetJSONFieldStr(t, batchSendResBody, "base_insertion_event_id")
579+
580+
// Send the marker event which lets remote homeservers know there are
581+
// some historical messages back at the given insertion event.
582+
sendMarkerAndEnsureBackfilled(t, as, alice, roomID, baseInsertionEventID)
578583

579584
// Join the room from a remote homeserver after the historical messages were sent
580585
remoteCharlie.JoinRoom(t, roomID, []string{"hs1"})
@@ -654,6 +659,10 @@ func TestImportHistoricalMessages(t *testing.T) {
654659
batchSendResBody := client.ParseJSON(t, batchSendRes)
655660
historicalEventIDs := client.GetJSONFieldStringArray(t, batchSendResBody, "event_ids")
656661

662+
// Send the marker event which lets remote homeservers know there are
663+
// some historical messages back at the given insertion event.
664+
sendMarkerAndEnsureBackfilled(t, as, alice, roomID, insertionEventID)
665+
657666
// Join the room from a remote homeserver after the historical messages were sent
658667
remoteCharlie.JoinRoom(t, roomID, []string{"hs1"})
659668

@@ -756,7 +765,8 @@ func TestImportHistoricalMessages(t *testing.T) {
756765
},
757766
})
758767

759-
// Send the marker event
768+
// Send the marker event which lets remote homeservers know there are
769+
// some historical messages back at the given insertion event.
760770
sendMarkerAndEnsureBackfilled(t, as, remoteCharlie, roomID, baseInsertionEventID)
761771

762772
// FIXME: In the future, we should probably replace the following logic
@@ -849,7 +859,8 @@ func TestImportHistoricalMessages(t *testing.T) {
849859
},
850860
})
851861

852-
// Send the marker event
862+
// Send the marker event which lets remote homeservers know there are
863+
// some historical messages back at the given insertion event.
853864
sendMarkerAndEnsureBackfilled(t, as, remoteCharlie, roomID, baseInsertionEventID)
854865

855866
// FIXME: In the future, we should probably replace the following logic
@@ -959,7 +970,8 @@ func TestImportHistoricalMessages(t *testing.T) {
959970
batchEventID := client.GetJSONFieldStr(t, batchSendResBody, "batch_event_id")
960971
baseInsertionEventID := client.GetJSONFieldStr(t, batchSendResBody, "base_insertion_event_id")
961972

962-
// Send the marker event
973+
// Send the marker event which lets remote homeservers know there are
974+
// some historical messages back at the given insertion event.
963975
markerEventID := sendMarkerAndEnsureBackfilled(t, as, alice, roomID, baseInsertionEventID)
964976

965977
redactEventID(t, alice, roomID, insertionEventID, 403)
@@ -1110,11 +1122,11 @@ func ensureVirtualUserRegistered(t *testing.T, c *client.CSAPI, virtualUserLocal
11101122
}
11111123
}
11121124

1125+
// Send the marker event which lets remote homeservers know there are
1126+
// some historical messages back at the given insertion event.
11131127
func sendMarkerAndEnsureBackfilled(t *testing.T, as *client.CSAPI, c *client.CSAPI, roomID, insertionEventID string) (markerEventID string) {
11141128
t.Helper()
11151129

1116-
// Send a marker event to let all of the homeservers know about the
1117-
// insertion point where all of the historical messages are at
11181130
markerEvent := b.Event{
11191131
Type: markerEventType,
11201132
Content: map[string]interface{}{

0 commit comments

Comments
 (0)