From 99b51d94ba11619c848ef58dc343dad667f038a7 Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Wed, 29 Jun 2022 18:48:37 +0200 Subject: [PATCH 1/3] Application service can join remote federated room without profile set --- tests/federation_room_join_test.go | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/federation_room_join_test.go b/tests/federation_room_join_test.go index c9ef319a..7056a754 100644 --- a/tests/federation_room_join_test.go +++ b/tests/federation_room_join_test.go @@ -522,3 +522,28 @@ func TestSendJoinPartialStateResponse(t *testing.T) { func typeAndStateKeyForEvent(result gjson.Result) string { return strings.Join([]string{result.Map()["type"].Str, result.Map()["state_key"].Str}, "|") } + +func TestJoinFederatedRoomFromApplicationServiceUser(t *testing.T) { + deployment := Deploy(t, b.BlueprintHSWithApplicationService) + defer deployment.Destroy(t) + + // Create the application service bridge user that is able to import historical messages + asUserID := "@the-bridge-user:hs1" + as := deployment.Client(t, "hs1", asUserID) + + // Create the federated user which will fetch the messages from a remote homeserver + remoteUserID := "@charlie:hs2" + remoteCharlie := deployment.Client(t, "hs2", remoteUserID) + + t.Run("join remote federated room as application service user", func(t *testing.T) { + //t.Parallel() + // Create the room from a remote homeserver + roomID := remoteCharlie.CreateRoom(t, map[string]interface{}{ + "preset": "public_chat", + "name": "hs2 room", + }) + + // Join the AS to the remote federated room (without a profile set) + as.JoinRoom(t, roomID, []string{"hs2"}) + }) +} From cff83cce4727d23ed0f09bf6518cdd550bb4f49d Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Tue, 5 Jul 2022 05:42:12 -0500 Subject: [PATCH 2/3] Disambiguate --- tests/federation_room_join_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/federation_room_join_test.go b/tests/federation_room_join_test.go index 7056a754..0ba9baae 100644 --- a/tests/federation_room_join_test.go +++ b/tests/federation_room_join_test.go @@ -523,15 +523,15 @@ func typeAndStateKeyForEvent(result gjson.Result) string { return strings.Join([]string{result.Map()["type"].Str, result.Map()["state_key"].Str}, "|") } -func TestJoinFederatedRoomFromApplicationServiceUser(t *testing.T) { +func TestJoinFederatedRoomFromApplicationServiceBridgeUser(t *testing.T) { deployment := Deploy(t, b.BlueprintHSWithApplicationService) defer deployment.Destroy(t) - // Create the application service bridge user that is able to import historical messages + // Create the application service bridge user to try to join the room from asUserID := "@the-bridge-user:hs1" as := deployment.Client(t, "hs1", asUserID) - // Create the federated user which will fetch the messages from a remote homeserver + // Create the federated remote user which will create the room remoteUserID := "@charlie:hs2" remoteCharlie := deployment.Client(t, "hs2", remoteUserID) @@ -543,7 +543,7 @@ func TestJoinFederatedRoomFromApplicationServiceUser(t *testing.T) { "name": "hs2 room", }) - // Join the AS to the remote federated room (without a profile set) + // Join the AS bridge user to the remote federated room (without a profile set) as.JoinRoom(t, roomID, []string{"hs2"}) }) } From d5ceb8a29be3512dc03b27b3cbcedec99d8e3834 Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Tue, 12 Jul 2022 12:18:46 -0500 Subject: [PATCH 3/3] Skip test with AS in Dendrite See https://github.com/matrix-org/complement/pull/399#discussion_r910211811 --- tests/federation_room_join_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/federation_room_join_test.go b/tests/federation_room_join_test.go index 0ba9baae..8b664f9b 100644 --- a/tests/federation_room_join_test.go +++ b/tests/federation_room_join_test.go @@ -524,6 +524,7 @@ func typeAndStateKeyForEvent(result gjson.Result) string { } func TestJoinFederatedRoomFromApplicationServiceBridgeUser(t *testing.T) { + runtime.SkipIf(t, runtime.Dendrite) // Dendrite doesn't read AS registration files from Complement yet deployment := Deploy(t, b.BlueprintHSWithApplicationService) defer deployment.Destroy(t)