Skip to content

Commit

Permalink
More test coverage to ensure we process MSC2716 events in existing ro…
Browse files Browse the repository at this point in the history
…om versions (#209)

Synapse changes in matrix-org/synapse#10962

Part of MSC2716: matrix-org/matrix-spec-proposals#2716
  • Loading branch information
MadLittleMods authored Oct 26, 2021
1 parent f8e0b1a commit fdeba70
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/msc2716_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,9 @@ func TestImportHistoricalMessages(t *testing.T) {
eventIdBefore := eventIDsBefore[0]
timeAfterEventBefore := time.Now()

// Create eventIDsAfter to avoid the "No forward extremities left!" 500 error from Synapse
createMessagesInRoom(t, alice, roomID, 2)

// Import a historical event
batchSendRes := batchSendHistoricalMessages(
t,
Expand All @@ -827,6 +830,7 @@ func TestImportHistoricalMessages(t *testing.T) {
)
batchSendResBody := client.ParseJSON(t, batchSendRes)
historicalEventIDs := client.GetJSONFieldStringArray(t, batchSendResBody, "event_ids")
nextBatchID := client.GetJSONFieldStr(t, batchSendResBody, "next_batch_id")

messagesRes := alice.MustDoFunc(t, "GET", []string{"_matrix", "client", "r0", "rooms", roomID, "messages"}, client.WithContentType("application/json"), client.WithQueries(url.Values{
"dir": []string{"b"},
Expand All @@ -840,6 +844,20 @@ func TestImportHistoricalMessages(t *testing.T) {
}, nil),
},
})

// Now try to do a subsequent batch send. This will make sure
// that insertion events are stored/tracked and can be matched up in the next batch
batchSendHistoricalMessages(
t,
as,
roomID,
eventIdBefore,
nextBatchID,
createJoinStateEventsForBatchSendRequest([]string{virtualUserID}, timeAfterEventBefore),
createMessageEventsForBatchSendRequest([]string{virtualUserID}, timeAfterEventBefore, 1),
// Status
200,
)
})

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

0 comments on commit fdeba70

Please sign in to comment.