From 556e1e9c9262dfd8a620e72e131b17b77afb18fd Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Fri, 23 Jul 2021 00:41:26 -0500 Subject: [PATCH 1/2] Use experimental org.matrix.msc2716 room version for MSC2716 tests As introduced in https://github.com/matrix-org/synapse/pull/10245, use experimental `org.matrix.msc2716` room version. --- tests/msc2716_test.go | 45 ++++++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/tests/msc2716_test.go b/tests/msc2716_test.go index 8f99881b..3e80ce3d 100644 --- a/tests/msc2716_test.go +++ b/tests/msc2716_test.go @@ -75,8 +75,9 @@ func TestBackfillingHistory(t *testing.T) { t.Parallel() roomID := as.CreateRoom(t, map[string]interface{}{ - "preset": "public_chat", - "name": "the hangout spot", + "room_version": "org.matrix.msc2716", + "preset": "public_chat", + "name": "the hangout spot", }) alice.JoinRoom(t, roomID, nil) @@ -189,8 +190,9 @@ func TestBackfillingHistory(t *testing.T) { t.Parallel() roomID := as.CreateRoom(t, map[string]interface{}{ - "preset": "public_chat", - "name": "the hangout spot", + "room_version": "org.matrix.msc2716", + "preset": "public_chat", + "name": "the hangout spot", }) alice.JoinRoom(t, roomID, nil) @@ -239,8 +241,9 @@ func TestBackfillingHistory(t *testing.T) { t.Parallel() roomID := as.CreateRoom(t, map[string]interface{}{ - "preset": "public_chat", - "name": "the hangout spot", + "room_version": "org.matrix.msc2716", + "preset": "public_chat", + "name": "the hangout spot", }) alice.JoinRoom(t, roomID, nil) @@ -289,8 +292,9 @@ func TestBackfillingHistory(t *testing.T) { t.Parallel() roomID := as.CreateRoom(t, map[string]interface{}{ - "preset": "public_chat", - "name": "the hangout spot", + "room_version": "org.matrix.msc2716", + "preset": "public_chat", + "name": "the hangout spot", }) batchSendHistoricalMessages( @@ -314,8 +318,9 @@ func TestBackfillingHistory(t *testing.T) { t.Parallel() roomID := as.CreateRoom(t, map[string]interface{}{ - "preset": "public_chat", - "name": "the hangout spot", + "room_version": "org.matrix.msc2716", + "preset": "public_chat", + "name": "the hangout spot", }) alice.JoinRoom(t, roomID, nil) @@ -348,8 +353,9 @@ func TestBackfillingHistory(t *testing.T) { t.Parallel() roomID := as.CreateRoom(t, map[string]interface{}{ - "preset": "public_chat", - "name": "the hangout spot", + "room_version": "org.matrix.msc2716", + "preset": "public_chat", + "name": "the hangout spot", }) alice.JoinRoom(t, roomID, nil) @@ -406,8 +412,9 @@ func TestBackfillingHistory(t *testing.T) { t.Parallel() roomID := as.CreateRoom(t, map[string]interface{}{ - "preset": "public_chat", - "name": "the hangout spot", + "room_version": "org.matrix.msc2716", + "preset": "public_chat", + "name": "the hangout spot", }) alice.JoinRoom(t, roomID, nil) @@ -482,8 +489,9 @@ func TestBackfillingHistory(t *testing.T) { t.Parallel() roomID := as.CreateRoom(t, map[string]interface{}{ - "preset": "public_chat", - "name": "the hangout spot", + "room_version": "org.matrix.msc2716", + "preset": "public_chat", + "name": "the hangout spot", }) alice.JoinRoom(t, roomID, nil) @@ -589,8 +597,9 @@ func TestBackfillingHistory(t *testing.T) { t.Parallel() roomID := as.CreateRoom(t, map[string]interface{}{ - "preset": "public_chat", - "name": "the hangout spot", + "room_version": "org.matrix.msc2716", + "preset": "public_chat", + "name": "the hangout spot", }) alice.JoinRoom(t, roomID, nil) From 9b7d99adec8ca72f625a921aefaa8180a026f142 Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Mon, 26 Jul 2021 16:51:04 -0500 Subject: [PATCH 2/2] Use shared createRoomOpts --- tests/msc2716_test.go | 60 +++++++++++-------------------------------- 1 file changed, 15 insertions(+), 45 deletions(-) diff --git a/tests/msc2716_test.go b/tests/msc2716_test.go index 3e80ce3d..0d77eb38 100644 --- a/tests/msc2716_test.go +++ b/tests/msc2716_test.go @@ -44,6 +44,12 @@ var ( markerInsertionContentField = "org.matrix.msc2716.marker.insertion" ) +var createRoomOpts = map[string]interface{}{ + "preset": "public_chat", + "name": "the hangout spot", + "room_version": "org.matrix.msc2716", +} + func TestBackfillingHistory(t *testing.T) { deployment := Deploy(t, b.BlueprintHSWithApplicationService) defer deployment.Destroy(t) @@ -74,11 +80,7 @@ func TestBackfillingHistory(t *testing.T) { t.Run("Backfilled historical events resolve with proper state in correct order", func(t *testing.T) { t.Parallel() - roomID := as.CreateRoom(t, map[string]interface{}{ - "room_version": "org.matrix.msc2716", - "preset": "public_chat", - "name": "the hangout spot", - }) + roomID := as.CreateRoom(t, createRoomOpts) alice.JoinRoom(t, roomID, nil) // Create some normal messages in the timeline. We're creating them in @@ -189,11 +191,7 @@ func TestBackfillingHistory(t *testing.T) { t.Run("Backfilled historical events from multiple users in the same chunk", func(t *testing.T) { t.Parallel() - roomID := as.CreateRoom(t, map[string]interface{}{ - "room_version": "org.matrix.msc2716", - "preset": "public_chat", - "name": "the hangout spot", - }) + roomID := as.CreateRoom(t, createRoomOpts) alice.JoinRoom(t, roomID, nil) // Create the "live" event we are going to insert our backfilled events next to @@ -240,11 +238,7 @@ func TestBackfillingHistory(t *testing.T) { t.Run("Backfilled historical events with m.historical do not come down in an incremental sync", func(t *testing.T) { t.Parallel() - roomID := as.CreateRoom(t, map[string]interface{}{ - "room_version": "org.matrix.msc2716", - "preset": "public_chat", - "name": "the hangout spot", - }) + roomID := as.CreateRoom(t, createRoomOpts) alice.JoinRoom(t, roomID, nil) // Create the "live" event we are going to insert our backfilled events next to @@ -291,11 +285,7 @@ func TestBackfillingHistory(t *testing.T) { t.Run("Unrecognised prev_event ID will throw an error", func(t *testing.T) { t.Parallel() - roomID := as.CreateRoom(t, map[string]interface{}{ - "room_version": "org.matrix.msc2716", - "preset": "public_chat", - "name": "the hangout spot", - }) + roomID := as.CreateRoom(t, createRoomOpts) batchSendHistoricalMessages( t, @@ -317,11 +307,7 @@ func TestBackfillingHistory(t *testing.T) { t.Run("Normal users aren't allowed to backfill messages", func(t *testing.T) { t.Parallel() - roomID := as.CreateRoom(t, map[string]interface{}{ - "room_version": "org.matrix.msc2716", - "preset": "public_chat", - "name": "the hangout spot", - }) + roomID := as.CreateRoom(t, createRoomOpts) alice.JoinRoom(t, roomID, nil) eventIDsBefore := createMessagesInRoom(t, alice, roomID, 1) @@ -352,11 +338,7 @@ func TestBackfillingHistory(t *testing.T) { t.Skip("Skipping until federation is implemented") t.Parallel() - roomID := as.CreateRoom(t, map[string]interface{}{ - "room_version": "org.matrix.msc2716", - "preset": "public_chat", - "name": "the hangout spot", - }) + roomID := as.CreateRoom(t, createRoomOpts) alice.JoinRoom(t, roomID, nil) eventIDsBefore := createMessagesInRoom(t, alice, roomID, 1) @@ -411,11 +393,7 @@ func TestBackfillingHistory(t *testing.T) { t.Skip("Skipping until federation is implemented") t.Parallel() - roomID := as.CreateRoom(t, map[string]interface{}{ - "room_version": "org.matrix.msc2716", - "preset": "public_chat", - "name": "the hangout spot", - }) + roomID := as.CreateRoom(t, createRoomOpts) alice.JoinRoom(t, roomID, nil) eventIDsBefore := createMessagesInRoom(t, alice, roomID, 1) @@ -488,11 +466,7 @@ func TestBackfillingHistory(t *testing.T) { t.Skip("Skipping until federation is implemented") t.Parallel() - roomID := as.CreateRoom(t, map[string]interface{}{ - "room_version": "org.matrix.msc2716", - "preset": "public_chat", - "name": "the hangout spot", - }) + roomID := as.CreateRoom(t, createRoomOpts) alice.JoinRoom(t, roomID, nil) // Join the room from a remote homeserver before any backfilled messages are sent @@ -596,11 +570,7 @@ func TestBackfillingHistory(t *testing.T) { t.Skip("Skipping until federation is implemented") t.Parallel() - roomID := as.CreateRoom(t, map[string]interface{}{ - "room_version": "org.matrix.msc2716", - "preset": "public_chat", - "name": "the hangout spot", - }) + roomID := as.CreateRoom(t, createRoomOpts) alice.JoinRoom(t, roomID, nil) // Join the room from a remote homeserver before any backfilled messages are sent