From 3e03473e0fb9e3ab8a68e1d138d7eb4910cd61f9 Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Fri, 10 Jan 2025 16:22:30 -0600 Subject: [PATCH] Add reproduction of the situation for a Synapse consistency issue Reproduction test for https://github.com/element-hq/synapse/pull/18075 --- tests/csapi/synapse_consistency_test.go | 36 +++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 tests/csapi/synapse_consistency_test.go diff --git a/tests/csapi/synapse_consistency_test.go b/tests/csapi/synapse_consistency_test.go new file mode 100644 index 00000000..74330d3a --- /dev/null +++ b/tests/csapi/synapse_consistency_test.go @@ -0,0 +1,36 @@ +package csapi_tests + +import ( + "testing" + + "github.com/matrix-org/complement" + "github.com/matrix-org/complement/client" + "github.com/matrix-org/complement/helpers" +) + +func TestSynapseConsistency(t *testing.T) { + numHomeservers := 2 + deployment := complement.Deploy(t, numHomeservers) + defer deployment.Destroy(t) + + alice := deployment.Register(t, "hs1", helpers.RegistrationOpts{LocalpartSuffix: "alice"}) + + charlie1 := deployment.Register(t, "hs2", helpers.RegistrationOpts{LocalpartSuffix: "charlie1"}) + charlie2 := deployment.Register(t, "hs2", helpers.RegistrationOpts{LocalpartSuffix: "charlie2"}) + + t.Run("test1", func(t *testing.T) { + // Create a room on hs1 + roomID := alice.MustCreateRoom(t, map[string]interface{}{ + "preset": "private_chat", + }) + + // Invite multiple users from hs2 + alice.MustInviteRoom(t, roomID, charlie1.UserID) + charlie1.MustSyncUntil(t, client.SyncReq{}, client.SyncInvitedTo(charlie1.UserID, roomID)) + charlie1.MustJoinRoom(t, roomID, []string{"hs1"}) + + alice.MustInviteRoom(t, roomID, charlie2.UserID) + charlie2.MustSyncUntil(t, client.SyncReq{}, client.SyncInvitedTo(charlie2.UserID, roomID)) + charlie2.MustJoinRoom(t, roomID, []string{"hs1"}) + }) +}