Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send marker events in all federation tests (MSC2716) #248

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions tests/msc2716_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,11 @@ func TestImportHistoricalMessages(t *testing.T) {
)
batchSendResBody := client.ParseJSON(t, batchSendRes)
historicalEventIDs := client.GetJSONFieldStringArray(t, batchSendResBody, "event_ids")
baseInsertionEventID := client.GetJSONFieldStr(t, batchSendResBody, "base_insertion_event_id")

// Send the marker event which lets remote homeservers know there are
// some historical messages back at the given insertion event.
sendMarkerAndEnsureBackfilled(t, as, alice, roomID, baseInsertionEventID)

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

// Send the marker event which lets remote homeservers know there are
// some historical messages back at the given insertion event.
sendMarkerAndEnsureBackfilled(t, as, alice, roomID, insertionEventID)

// Join the room from a remote homeserver after the historical messages were sent
remoteCharlie.JoinRoom(t, roomID, []string{"hs1"})

Expand Down Expand Up @@ -756,7 +765,8 @@ func TestImportHistoricalMessages(t *testing.T) {
},
})

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

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

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

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

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

redactEventID(t, alice, roomID, insertionEventID, 403)
Expand Down Expand Up @@ -1110,11 +1122,11 @@ func ensureVirtualUserRegistered(t *testing.T, c *client.CSAPI, virtualUserLocal
}
}

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

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