Skip to content

Commit 86e13f9

Browse files
committed
test: Remove LOCAL_REMOTE logic
Signed-off-by: Joas Schilling <[email protected]>
1 parent 41625f2 commit 86e13f9

File tree

3 files changed

+11
-75
lines changed

3 files changed

+11
-75
lines changed

tests/integration/features/bootstrap/FeatureContext.php

+2-51
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,7 @@ class FeatureContext implements Context, SnippetAcceptingContext {
9191
private array $cookieJars;
9292

9393
protected string $localServerUrl;
94-
95-
protected string $localRemoteServerUrl;
96-
9794
protected string $remoteServerUrl;
98-
9995
protected string $baseUrl;
10096

10197
protected string $currentServer;
@@ -184,7 +180,6 @@ public function getAttendeeId(string $type, string $id, string $room, ?string $u
184180
public function __construct() {
185181
$this->cookieJars = [];
186182
$this->localServerUrl = getenv('TEST_SERVER_URL');
187-
$this->localRemoteServerUrl = getenv('TEST_LOCAL_REMOTE_URL');
188183
$this->remoteServerUrl = getenv('TEST_REMOTE_URL');
189184

190185
foreach (['LOCAL', 'REMOTE'] as $server) {
@@ -563,7 +558,6 @@ private function assertRooms(array $rooms, TableNode $formData, bool $shouldOrde
563558
if (isset($expectedRoom['lastMessageActorId'])) {
564559
$data['lastMessageActorId'] = $room['lastMessage'] ? $room['lastMessage']['actorId'] : '';
565560
$data['lastMessageActorId'] = str_replace(rtrim($this->localServerUrl, '/'), '{$LOCAL_URL}', $data['lastMessageActorId']);
566-
$data['lastMessageActorId'] = str_replace(rtrim($this->localRemoteServerUrl, '/'), '{$LOCAL_REMOTE_URL}', $data['lastMessageActorId']);
567561
$data['lastMessageActorId'] = str_replace(rtrim($this->remoteServerUrl, '/'), '{$REMOTE_URL}', $data['lastMessageActorId']);
568562
}
569563
if (isset($expectedRoom['lastReadMessage'])) {
@@ -650,13 +644,7 @@ public function userAcceptsDeclinesRemoteInvite(string $user, string $acceptsDec
650644
$verb = $acceptsDeclines === 'accepts' ? 'POST' : 'DELETE';
651645

652646
$this->setCurrentUser($user);
653-
if ($this->currentServer === 'LOCAL' && $server === 'LOCAL') {
654-
$this->baseUrl = $this->localRemoteServerUrl;
655-
$this->sendRequest($verb, '/apps/spreed/api/' . $apiVersion . '/federation/invitation/' . $inviteId);
656-
$this->baseUrl = $this->localServerUrl;
657-
} else {
658-
$this->sendRequest($verb, '/apps/spreed/api/' . $apiVersion . '/federation/invitation/' . $inviteId);
659-
}
647+
$this->sendRequest($verb, '/apps/spreed/api/' . $apiVersion . '/federation/invitation/' . $inviteId);
660648
$this->assertStatusCode($this->response, $status);
661649
$response = $this->getDataFromResponse($this->response);
662650

@@ -719,11 +707,9 @@ private function assertInvites($invites, TableNode $formData) {
719707
protected function translateRemoteServer(string $server): string {
720708
$server = str_replace([
721709
'http://localhost:8080',
722-
'http://localhost:8180',
723710
'http://localhost:8280',
724711
], [
725712
'LOCAL',
726-
'LOCAL_REMOTE',
727713
'REMOTE',
728714
], $server);
729715
if (str_contains($server, 'http://')) {
@@ -905,9 +891,6 @@ protected function assertAttendeeList(string $identifier, ?TableNode $formData,
905891
if (isset($attendee['actorId']) && str_ends_with($attendee['actorId'], '@{$LOCAL_URL}')) {
906892
$attendee['actorId'] = str_replace('{$LOCAL_URL}', rtrim($this->localServerUrl, '/'), $attendee['actorId']);
907893
}
908-
if (isset($attendee['actorId']) && str_ends_with($attendee['actorId'], '@{$LOCAL_REMOTE_URL}')) {
909-
$attendee['actorId'] = str_replace('{$LOCAL_REMOTE_URL}', rtrim($this->localRemoteServerUrl, '/'), $attendee['actorId']);
910-
}
911894
if (isset($attendee['actorId']) && str_ends_with($attendee['actorId'], '@{$REMOTE_URL}')) {
912895
$attendee['actorId'] = str_replace('{$REMOTE_URL}', rtrim($this->remoteServerUrl, '/'), $attendee['actorId']);
913896
}
@@ -926,9 +909,6 @@ protected function assertAttendeeList(string $identifier, ?TableNode $formData,
926909
if (isset($attendee['sessionIds']) && str_contains($attendee['sessionIds'], '@{$LOCAL_URL}')) {
927910
$attendee['sessionIds'] = str_replace('{$LOCAL_URL}', rtrim($this->localServerUrl, '/'), $attendee['sessionIds']);
928911
}
929-
if (isset($attendee['sessionIds']) && str_contains($attendee['sessionIds'], '@{$LOCAL_REMOTE_URL}')) {
930-
$attendee['sessionIds'] = str_replace('{$LOCAL_REMOTE_URL}', rtrim($this->localRemoteServerUrl, '/'), $attendee['sessionIds']);
931-
}
932912
if (isset($attendee['sessionIds']) && str_contains($attendee['sessionIds'], '@{$REMOTE_URL}')) {
933913
$attendee['sessionIds'] = str_replace('{$REMOTE_URL}', rtrim($this->remoteServerUrl, '/'), $attendee['sessionIds']);
934914
}
@@ -1997,8 +1977,6 @@ public function userAddAttendeeToRoom(string $user, string $newType, string $new
19971977
if ($newType === 'federated_user') {
19981978
if (!str_contains($newId, '@')) {
19991979
$newId .= '@' . $this->remoteServerUrl;
2000-
} elseif (str_ends_with($newId, '@LOCAL_REMOTE')) {
2001-
$newId = str_replace('LOCAL_REMOTE', $this->localRemoteServerUrl, $newId);
20021980
} else {
20031981
$newId = str_replace('REMOTE', $this->remoteServerUrl, $newId);
20041982
}
@@ -2067,11 +2045,8 @@ public function userSetsPermissionsForInRoomTo(string $user, string $participant
20672045
} elseif (strpos($participant, 'guest') === 0) {
20682046
$sessionId = self::$userToSessionId[$participant];
20692047
$attendeeId = $this->getAttendeeId('guests', sha1($sessionId), $identifier, $statusCode === 200 ? $user : null);
2070-
} elseif (str_ends_with($participant, '@{$LOCAL_REMOTE_URL}') ||
2071-
str_ends_with($participant, '@{$REMOTE_URL}')) {
2072-
$participant = str_replace('{$LOCAL_REMOTE_URL}', rtrim($this->localRemoteServerUrl, '/'), $participant);
2048+
} elseif (str_ends_with($participant, '@{$REMOTE_URL}')) {
20732049
$participant = str_replace('{$REMOTE_URL}', rtrim($this->remoteServerUrl, '/'), $participant);
2074-
20752050
$attendeeId = $this->getAttendeeId('federated_users', $participant, $identifier, $statusCode === 200 ? $user : null);
20762051
} else {
20772052
$attendeeId = $this->getAttendeeId('users', $participant, $identifier, $statusCode === 200 ? $user : null);
@@ -2325,7 +2300,6 @@ public function userSendsMessageToRoom(string $user, string $sendingMode, string
23252300
$message = substr($message, 1, -1);
23262301
$message = str_replace('\n', "\n", $message);
23272302
$message = str_replace('{$LOCAL_URL}', $this->localServerUrl, $message);
2328-
$message = str_replace('{$LOCAL_REMOTE_URL}', $this->localRemoteServerUrl, $message);
23292303
$message = str_replace('{$REMOTE_URL}', $this->remoteServerUrl, $message);
23302304
if (str_contains($message, '@"TEAM_ID(')) {
23312305
$result = preg_match('/TEAM_ID\(([^)]+)\)/', $message, $matches);
@@ -2743,9 +2717,6 @@ protected function preparePollExpectedData(array $expected): array {
27432717
if (str_ends_with($expected['actorId'], '@{$LOCAL_URL}')) {
27442718
$expected['actorId'] = str_replace('{$LOCAL_URL}', rtrim($this->localServerUrl, '/'), $expected['actorId']);
27452719
}
2746-
if (str_ends_with($expected['actorId'], '@{$LOCAL_REMOTE_URL}')) {
2747-
$expected['actorId'] = str_replace('{$LOCAL_REMOTE_URL}', rtrim($this->localRemoteServerUrl, '/'), $expected['actorId']);
2748-
}
27492720
if (str_ends_with($expected['actorId'], '@{$REMOTE_URL}')) {
27502721
$expected['actorId'] = str_replace('{$REMOTE_URL}', rtrim($this->remoteServerUrl, '/'), $expected['actorId']);
27512722
}
@@ -2754,9 +2725,6 @@ protected function preparePollExpectedData(array $expected): array {
27542725
if (str_contains($expected['details'], '@{$LOCAL_URL}')) {
27552726
$expected['details'] = str_replace('{$LOCAL_URL}', rtrim($this->localServerUrl, '/'), $expected['details']);
27562727
}
2757-
if (str_contains($expected['details'], '@{$LOCAL_REMOTE_URL}')) {
2758-
$expected['details'] = str_replace('{$LOCAL_REMOTE_URL}', rtrim($this->localRemoteServerUrl, '/'), $expected['details']);
2759-
}
27602728
if (str_contains($expected['details'], '@{$REMOTE_URL}')) {
27612729
$expected['details'] = str_replace('{$REMOTE_URL}', rtrim($this->remoteServerUrl, '/'), $expected['details']);
27622730
}
@@ -3211,19 +3179,13 @@ protected function compareDataResponse(?TableNode $formData = null) {
32113179
if (str_ends_with($expected[$i]['actorId'], '@{$LOCAL_URL}')) {
32123180
$expected[$i]['actorId'] = str_replace('{$LOCAL_URL}', rtrim($this->localServerUrl, '/'), $expected[$i]['actorId']);
32133181
}
3214-
if (str_ends_with($expected[$i]['actorId'], '@{$LOCAL_REMOTE_URL}')) {
3215-
$expected[$i]['actorId'] = str_replace('{$LOCAL_REMOTE_URL}', rtrim($this->localRemoteServerUrl, '/'), $expected[$i]['actorId']);
3216-
}
32173182
if (str_ends_with($expected[$i]['actorId'], '@{$REMOTE_URL}')) {
32183183
$expected[$i]['actorId'] = str_replace('{$REMOTE_URL}', rtrim($this->remoteServerUrl, '/'), $expected[$i]['actorId']);
32193184
}
32203185

32213186
if (str_contains($expected[$i]['messageParameters'], '{$LOCAL_URL}')) {
32223187
$expected[$i]['messageParameters'] = str_replace('{$LOCAL_URL}', str_replace('/', '\/', rtrim($this->localServerUrl, '/')), $expected[$i]['messageParameters']);
32233188
}
3224-
if (str_contains($expected[$i]['messageParameters'], '{$LOCAL_REMOTE_URL}')) {
3225-
$expected[$i]['messageParameters'] = str_replace('{$LOCAL_REMOTE_URL}', str_replace('/', '\/', rtrim($this->localRemoteServerUrl, '/')), $expected[$i]['messageParameters']);
3226-
}
32273189
if (str_contains($expected[$i]['messageParameters'], '{$REMOTE_URL}')) {
32283190
$expected[$i]['messageParameters'] = str_replace('{$REMOTE_URL}', str_replace('/', '\/', rtrim($this->remoteServerUrl, '/')), $expected[$i]['messageParameters']);
32293191
}
@@ -3232,9 +3194,6 @@ protected function compareDataResponse(?TableNode $formData = null) {
32323194
if (str_ends_with($expected[$i]['lastEditActorId'], '@{$LOCAL_URL}')) {
32333195
$expected[$i]['lastEditActorId'] = str_replace('{$LOCAL_URL}', rtrim($this->localServerUrl, '/'), $expected[$i]['lastEditActorId']);
32343196
}
3235-
if (str_ends_with($expected[$i]['lastEditActorId'], '@{$LOCAL_REMOTE_URL}')) {
3236-
$expected[$i]['lastEditActorId'] = str_replace('{$LOCAL_REMOTE_URL}', rtrim($this->localRemoteServerUrl, '/'), $expected[$i]['lastEditActorId']);
3237-
}
32383197
if (str_ends_with($expected[$i]['lastEditActorId'], '@{$REMOTE_URL}')) {
32393198
$expected[$i]['lastEditActorId'] = str_replace('{$REMOTE_URL}', rtrim($this->remoteServerUrl, '/'), $expected[$i]['lastEditActorId']);
32403199
}
@@ -3510,18 +3469,12 @@ public function userGetsTheFollowingCandidateMentionsInRoomFor($user, $identifie
35103469
if (str_ends_with($row['id'], '@{$LOCAL_URL}')) {
35113470
$row['id'] = str_replace('{$LOCAL_URL}', rtrim($this->localServerUrl, '/'), $row['id']);
35123471
}
3513-
if (str_ends_with($row['id'], '@{$LOCAL_REMOTE_URL}')) {
3514-
$row['id'] = str_replace('{$LOCAL_REMOTE_URL}', rtrim($this->localRemoteServerUrl, '/'), $row['id']);
3515-
}
35163472
if (str_ends_with($row['id'], '@{$REMOTE_URL}')) {
35173473
$row['id'] = str_replace('{$REMOTE_URL}', rtrim($this->remoteServerUrl, '/'), $row['id']);
35183474
}
35193475
if (str_ends_with($row['mentionId'], '@{$BASE_URL}')) {
35203476
$row['mentionId'] = str_replace('{$BASE_URL}', rtrim($this->localServerUrl, '/'), $row['mentionId']);
35213477
}
3522-
if (str_ends_with($row['mentionId'], '@{$LOCAL_REMOTE_URL}')) {
3523-
$row['mentionId'] = str_replace('{$LOCAL_REMOTE_URL}', rtrim($this->localRemoteServerUrl, '/'), $row['mentionId']);
3524-
}
35253478
if (str_ends_with($row['mentionId'], '@{$REMOTE_URL}')) {
35263479
$row['mentionId'] = str_replace('{$REMOTE_URL}', rtrim($this->remoteServerUrl, '/'), $row['mentionId']);
35273480
}
@@ -4006,7 +3959,6 @@ private function assertNotifications($notifications, TableNode $formData) {
40063959
$messageText = self::$messageIdToText[$message] ?? 'UNKNOWN_MESSAGE';
40073960

40083961
$messageText = str_replace($this->localServerUrl, '{$LOCAL_URL}', $messageText);
4009-
$messageText = str_replace($this->localRemoteServerUrl, '{$LOCAL_REMOTE_URL}', $messageText);
40103962
$messageText = str_replace($this->remoteServerUrl, '{$REMOTE_URL}', $messageText);
40113963

40123964
$data['object_id'] = self::$tokenToIdentifier[$roomToken] . '/' . $messageText;
@@ -4583,7 +4535,6 @@ private function assertReactionList(?TableNode $formData): void {
45834535
$reaction['actorId'] = ($reaction['actorType'] === 'guests') ? self::$sessionIdToUser[$reaction['actorId']] : (string)$reaction['actorId'];
45844536
if ($reaction['actorType'] === 'federated_users') {
45854537
$reaction['actorId'] = str_replace(rtrim($this->localServerUrl, '/'), '{$LOCAL_URL}', $reaction['actorId']);
4586-
$reaction['actorId'] = str_replace(rtrim($this->localRemoteServerUrl, '/'), '{$LOCAL_REMOTE_URL}', $reaction['actorId']);
45874538
$reaction['actorId'] = str_replace(rtrim($this->remoteServerUrl, '/'), '{$REMOTE_URL}', $reaction['actorId']);
45884539
}
45894540
return $reaction;

tests/integration/features/federation/call.feature

+8-8
Original file line numberDiff line numberDiff line change
@@ -353,8 +353,8 @@ Feature: federation/call
353353
| remoteServerUrl | remoteToken | state | inviterCloudId | inviterDisplayName |
354354
| LOCAL | room | 0 | participant1@LOCAL | participant1-displayname |
355355
And user "participant2" accepts invite to room "room" of server "LOCAL" with 200 (v1)
356-
| id | name | type | remoteServer | remoteToken |
357-
| LOCAL::room | room | 2 | LOCAL | room |
356+
| id | name | type | remoteServer | remoteToken |
357+
| LOCAL::room | room | 2 | LOCAL | room |
358358
And using server "LOCAL"
359359
And user "participant1" joins room "room" with 200 (v4)
360360
And user "participant1" joins call "room" with 400 (v4)
@@ -381,8 +381,8 @@ Feature: federation/call
381381
| remoteServerUrl | remoteToken | state | inviterCloudId | inviterDisplayName |
382382
| LOCAL | room | 0 | participant1@LOCAL | participant1-displayname |
383383
And user "participant2" accepts invite to room "room" of server "LOCAL" with 200 (v1)
384-
| id | name | type | remoteServer | remoteToken |
385-
| LOCAL::room | room | 2 | LOCAL | room |
384+
| id | name | type | remoteServer | remoteToken |
385+
| LOCAL::room | room | 2 | LOCAL | room |
386386
And using server "LOCAL"
387387
And user "participant1" joins room "room" with 200 (v4)
388388
And user "participant1" joins call "room" with 200 (v4)
@@ -404,8 +404,8 @@ Feature: federation/call
404404
| remoteServerUrl | remoteToken | state | inviterCloudId | inviterDisplayName |
405405
| LOCAL | room | 0 | participant1@LOCAL | participant1-displayname |
406406
And user "participant2" accepts invite to room "room" of server "LOCAL" with 200 (v1)
407-
| id | name | type | remoteServer | remoteToken |
408-
| LOCAL::room | room | 2 | LOCAL | room |
407+
| id | name | type | remoteServer | remoteToken |
408+
| LOCAL::room | room | 2 | LOCAL | room |
409409
And using server "LOCAL"
410410
And user "participant1" joins room "room" with 200 (v4)
411411
And user "participant1" joins call "room" with 200 (v4)
@@ -431,8 +431,8 @@ Feature: federation/call
431431
| remoteServerUrl | remoteToken | state | inviterCloudId | inviterDisplayName |
432432
| LOCAL | room | 0 | participant1@LOCAL | participant1-displayname |
433433
And user "participant2" accepts invite to room "room" of server "LOCAL" with 200 (v1)
434-
| id | name | type | remoteServer | remoteToken |
435-
| LOCAL::room | room | 2 | LOCAL | room |
434+
| id | name | type | remoteServer | remoteToken |
435+
| LOCAL::room | room | 2 | LOCAL | room |
436436
And using server "LOCAL"
437437
And user "participant1" joins room "room" with 200 (v4)
438438
And user "participant1" joins call "room" with 200 (v4)

tests/integration/run.sh

+1-16
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,6 @@ echo -e "Running on process ID: \033[1;35m$PHPPID1\033[0m"
3131
# Output filtered php server logs
3232
tail -f phpserver.log | grep --line-buffered -v -E ":[0-9]+ Accepted$" | grep --line-buffered -v -E ":[0-9]+ Closing$" &
3333

34-
PORT_FED=8180
35-
export PORT_FED
36-
37-
echo "" > phpserver_fed.log
38-
PHP_CLI_SERVER_WORKERS=3 php -S localhost:${PORT_FED} -t ${ROOT_DIR} &> phpserver_fed.log &
39-
PHPPID2=$!
40-
echo -e "Running on process ID: \033[1;35m$PHPPID2\033[0m"
41-
42-
# Output filtered federated php server logs
43-
tail -f phpserver_fed.log | grep --line-buffered -v -E ":[0-9]+ Accepted$" | grep --line-buffered -v -E ":[0-9]+ Closing$" &
44-
4534
occ_host() {
4635
NEXTCLOUD_CONFIG_DIR=${MAIN_SERVER_CONFIG_DIR} ${ROOT_DIR}/occ "$@"
4736
}
@@ -100,14 +89,13 @@ echo -e "Running on process ID: \033[1;35m$PHPPID3\033[0m"
10089
tail -f phpserver_fed_real.log | grep --line-buffered -v -E ":[0-9]+ Accepted$" | grep --line-buffered -v -E ":[0-9]+ Closing$" &
10190

10291
# Kill all sub-processes in case of ctrl+c
103-
trap 'pkill -P $PHPPID1; pkill -P $PHPPID2; pkill -P $PHPPID3; pkill -P $PROCESS_ID; wait $PHPPID1; wait $PHPPID2; wait $PHPPID3;' INT TERM
92+
trap 'pkill -P $PHPPID1; pkill -P $PHPPID3; pkill -P $PROCESS_ID; wait $PHPPID1; wait $PHPPID3;' INT TERM
10493

10594
export NEXTCLOUD_HOST_ROOT_DIR=${ROOT_DIR}
10695
export NEXTCLOUD_HOST_CONFIG_DIR=${MAIN_SERVER_CONFIG_DIR}
10796
export NEXTCLOUD_REMOTE_ROOT_DIR=${REMOTE_ROOT_DIR}
10897
export NEXTCLOUD_REMOTE_CONFIG_DIR=${REAL_FEDERATED_SERVER_CONFIG_DIR}
10998
export TEST_SERVER_URL="http://localhost:8080/"
110-
export TEST_LOCAL_REMOTE_URL="http://localhost:8180/"
11199
export TEST_REMOTE_URL="http://localhost:8280/"
112100

113101
export NEXTCLOUD_CONFIG_DIR="$MAIN_SERVER_CONFIG_DIR"
@@ -204,12 +192,10 @@ echo -e "\033[0;36m#\033[0m"
204192

205193
# Kill child PHP processes
206194
pkill -P $PHPPID1;
207-
pkill -P $PHPPID2;
208195
pkill -P $PHPPID3;
209196

210197
# Kill parent PHP processes
211198
kill -TERM $PHPPID1;
212-
kill -TERM $PHPPID2;
213199
kill -TERM $PHPPID3;
214200

215201
# Kill child processes of this script (e.g. tail)
@@ -248,7 +234,6 @@ rm -rf ${REMOTE_ROOT_DIR}/apps/spreedcheats
248234
rm -rf ${REMOTE_ROOT_DIR}/apps/talk_webhook_demo
249235

250236
wait $PHPPID1
251-
wait $PHPPID2
252237
wait $PHPPID3
253238

254239
echo ''

0 commit comments

Comments
 (0)