Skip to content

Commit fdeba70

Browse files
More test coverage to ensure we process MSC2716 events in existing room versions (#209)
Synapse changes in matrix-org/synapse#10962 Part of MSC2716: matrix-org/matrix-spec-proposals#2716
1 parent f8e0b1a commit fdeba70

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/msc2716_test.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -813,6 +813,9 @@ func TestImportHistoricalMessages(t *testing.T) {
813813
eventIdBefore := eventIDsBefore[0]
814814
timeAfterEventBefore := time.Now()
815815

816+
// Create eventIDsAfter to avoid the "No forward extremities left!" 500 error from Synapse
817+
createMessagesInRoom(t, alice, roomID, 2)
818+
816819
// Import a historical event
817820
batchSendRes := batchSendHistoricalMessages(
818821
t,
@@ -827,6 +830,7 @@ func TestImportHistoricalMessages(t *testing.T) {
827830
)
828831
batchSendResBody := client.ParseJSON(t, batchSendRes)
829832
historicalEventIDs := client.GetJSONFieldStringArray(t, batchSendResBody, "event_ids")
833+
nextBatchID := client.GetJSONFieldStr(t, batchSendResBody, "next_batch_id")
830834

831835
messagesRes := alice.MustDoFunc(t, "GET", []string{"_matrix", "client", "r0", "rooms", roomID, "messages"}, client.WithContentType("application/json"), client.WithQueries(url.Values{
832836
"dir": []string{"b"},
@@ -840,6 +844,20 @@ func TestImportHistoricalMessages(t *testing.T) {
840844
}, nil),
841845
},
842846
})
847+
848+
// Now try to do a subsequent batch send. This will make sure
849+
// that insertion events are stored/tracked and can be matched up in the next batch
850+
batchSendHistoricalMessages(
851+
t,
852+
as,
853+
roomID,
854+
eventIdBefore,
855+
nextBatchID,
856+
createJoinStateEventsForBatchSendRequest([]string{virtualUserID}, timeAfterEventBefore),
857+
createMessageEventsForBatchSendRequest([]string{virtualUserID}, timeAfterEventBefore, 1),
858+
// Status
859+
200,
860+
)
843861
})
844862

845863
t.Run("Not allowed to redact MSC2716 insertion, batch, marker events", func(t *testing.T) {

0 commit comments

Comments
 (0)