From 9b2844fb291ca06259da17dff2992a94cf2a13b7 Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Thu, 30 Sep 2021 21:51:20 -0500 Subject: [PATCH 1/2] More test coverage to ensure we process MSC2716 events in existing room versions Synapse changes in https://github.com/matrix-org/synapse/pull/10962 --- tests/msc2716_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/msc2716_test.go b/tests/msc2716_test.go index fc6faf72..4e747c71 100644 --- a/tests/msc2716_test.go +++ b/tests/msc2716_test.go @@ -780,6 +780,9 @@ func TestBackfillingHistory(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) + // Insert a backfilled event batchSendRes := batchSendHistoricalMessages( t, @@ -794,6 +797,7 @@ func TestBackfillingHistory(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"}, @@ -807,6 +811,20 @@ func TestBackfillingHistory(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, + createJoinStateEventsForBackfillRequest([]string{virtualUserID}, timeAfterEventBefore), + createMessageEventsForBackfillRequest([]string{virtualUserID}, timeAfterEventBefore, 1), + // Status + 200, + ) }) t.Run("Not allowed to redact MSC2716 insertion, batch, marker events", func(t *testing.T) { From 0e54e35ac680f57cc6153cb72bb24e4b326e6473 Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Thu, 14 Oct 2021 20:51:17 -0500 Subject: [PATCH 2/2] Fix merge error --- tests/msc2716_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/msc2716_test.go b/tests/msc2716_test.go index 7bed5d06..1f0b63e2 100644 --- a/tests/msc2716_test.go +++ b/tests/msc2716_test.go @@ -822,8 +822,8 @@ func TestImportHistoricalMessages(t *testing.T) { roomID, eventIdBefore, nextBatchID, - createJoinStateEventsForBackfillRequest([]string{virtualUserID}, timeAfterEventBefore), - createMessageEventsForBackfillRequest([]string{virtualUserID}, timeAfterEventBefore, 1), + createJoinStateEventsForBatchSendRequest([]string{virtualUserID}, timeAfterEventBefore), + createMessageEventsForBatchSendRequest([]string{virtualUserID}, timeAfterEventBefore, 1), // Status 200, )