summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDaniel Calviño Sánchez <danxuliu@gmail.com>2023-02-21 02:13:25 +0100
committerDaniel Calviño Sánchez <danxuliu@gmail.com>2023-02-22 13:09:26 +0100
commiteca3161d246eac7e874a17ee3b747bb0129bee7b (patch)
treea3dd7785af66b729aa909f0c1930301dc22c396d /tests
parent808c9f0e36fadf4af0a6c8d0fc943361a7b421bf (diff)
Add failed status to recordings
Although recordings should not fail in some cases they could (for example, if the configuration is wrong, the disk is full...). A new recording status, "failed", has been added to notify that situation to the Nextcloud server from the recording server. Typically call participants will not be able to do anything about the failure, so the clients can just show a notification to the moderators and hint about asking the system administrators. In any case, even if the recording status is "failed" further recordings can be started, which will behave as if the recording was started from the "none" status. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/integration/features/bootstrap/FeatureContext.php1
-rw-r--r--tests/integration/features/bootstrap/RecordingTrait.php14
-rw-r--r--tests/integration/features/callapi/recording.feature172
-rw-r--r--tests/php/Chat/SystemMessage/ListenerTest.php84
4 files changed, 271 insertions, 0 deletions
diff --git a/tests/integration/features/bootstrap/FeatureContext.php b/tests/integration/features/bootstrap/FeatureContext.php
index 7fe7f6f79..91e0df3e1 100644
--- a/tests/integration/features/bootstrap/FeatureContext.php
+++ b/tests/integration/features/bootstrap/FeatureContext.php
@@ -153,6 +153,7 @@ class FeatureContext implements Context, SnippetAcceptingContext {
self::$tokenToIdentifier = [];
self::$sessionIdToUser = [
'cli' => 'cli',
+ 'failed-to-get-session' => 'failed-to-get-session',
];
self::$userToSessionId = [];
self::$userToAttendeeId = [];
diff --git a/tests/integration/features/bootstrap/RecordingTrait.php b/tests/integration/features/bootstrap/RecordingTrait.php
index edb096fce..cd346a005 100644
--- a/tests/integration/features/bootstrap/RecordingTrait.php
+++ b/tests/integration/features/bootstrap/RecordingTrait.php
@@ -120,6 +120,20 @@ trait RecordingTrait {
$this->sendBackendRequestFromRecordingServer($data, $statusCode, $apiVersion);
}
+ /**
+ * @When /^recording server sent failed request for recording in room "([^"]*)" with (\d+)(?: \((v1)\))?$/
+ */
+ public function recordingServerSentFailedRequestForRecordingInRoomWith(string $identifier, int $statusCode, string $apiVersion = 'v1') {
+ $data = [
+ 'type' => 'failed',
+ 'failed' => [
+ 'token' => FeatureContext::getTokenForIdentifier($identifier),
+ ],
+ ];
+
+ $this->sendBackendRequestFromRecordingServer($data, $statusCode, $apiVersion);
+ }
+
private function sendBackendRequestFromRecordingServer(array $data, int $statusCode, string $apiVersion = 'v1') {
$body = json_encode($data);
diff --git a/tests/integration/features/callapi/recording.feature b/tests/integration/features/callapi/recording.feature
index 0755a7129..1369f1e36 100644
--- a/tests/integration/features/callapi/recording.feature
+++ b/tests/integration/features/callapi/recording.feature
@@ -89,6 +89,178 @@ Feature: callapi/recording
| type | name | callRecording |
| 2 | room1 | 0 |
+ Scenario: Recording failed to start
+ Given recording server is started
+ And the following "spreed" app config is set
+ | signaling_dev | yes |
+ And user "participant1" creates room "room1" (v4)
+ | roomType | 2 |
+ | roomName | room1 |
+ And user "participant1" joins room "room1" with 200 (v4)
+ And user "participant1" joins call "room1" with 200 (v4)
+ And user "participant1" starts "video" recording in room "room1" with 200 (v1)
+ And recording server received the following requests
+ | token | data |
+ | room1 | {"type":"start","start":{"status":1,"owner":"participant1","actor":{"type":"users","id":"participant1"}}} |
+ And user "participant1" is participant of the following unordered rooms (v4)
+ | type | name | callRecording |
+ | 2 | room1 | 3 |
+ When recording server sent failed request for recording in room "room1" with 200
+ Then user "participant1" sees the following system messages in room "room1" with 200 (v1)
+ | room | actorType | actorId | actorDisplayName | systemMessage |
+ | room1 | users | participant1 | participant1-displayname | call_started |
+ | room1 | users | participant1 | participant1-displayname | conversation_created |
+ And user "participant1" is participant of the following unordered rooms (v4)
+ | type | name | callRecording |
+ | 2 | room1 | 5 |
+
+ Scenario: Video recording failed
+ Given recording server is started
+ And the following "spreed" app config is set
+ | signaling_dev | yes |
+ And user "participant1" creates room "room1" (v4)
+ | roomType | 2 |
+ | roomName | room1 |
+ And user "participant1" joins room "room1" with 200 (v4)
+ And user "participant1" joins call "room1" with 200 (v4)
+ And user "participant1" starts "video" recording in room "room1" with 200 (v1)
+ And recording server received the following requests
+ | token | data |
+ | room1 | {"type":"start","start":{"status":1,"owner":"participant1","actor":{"type":"users","id":"participant1"}}} |
+ And user "participant1" is participant of the following unordered rooms (v4)
+ | type | name | callRecording |
+ | 2 | room1 | 3 |
+ And recording server sent started request for "video" recording in room "room1" as "participant1" with 200
+ And user "participant1" is participant of the following unordered rooms (v4)
+ | type | name | callRecording |
+ | 2 | room1 | 1 |
+ When recording server sent failed request for recording in room "room1" with 200
+ Then user "participant1" sees the following system messages in room "room1" with 200 (v1)
+ | room | actorType | actorId | actorDisplayName | systemMessage |
+ | room1 | guests | failed-to-get-session | | recording_failed |
+ | room1 | users | participant1 | participant1-displayname | recording_started |
+ | room1 | users | participant1 | participant1-displayname | call_started |
+ | room1 | users | participant1 | participant1-displayname | conversation_created |
+ And user "participant1" is participant of the following unordered rooms (v4)
+ | type | name | callRecording |
+ | 2 | room1 | 5 |
+
+ Scenario: Start and stop recording again after the previous one failed to start
+ Given recording server is started
+ And the following "spreed" app config is set
+ | signaling_dev | yes |
+ And user "participant1" creates room "room1" (v4)
+ | roomType | 2 |
+ | roomName | room1 |
+ And user "participant1" joins room "room1" with 200 (v4)
+ And user "participant1" joins call "room1" with 200 (v4)
+ And user "participant1" starts "video" recording in room "room1" with 200 (v1)
+ And recording server received the following requests
+ | token | data |
+ | room1 | {"type":"start","start":{"status":1,"owner":"participant1","actor":{"type":"users","id":"participant1"}}} |
+ And user "participant1" is participant of the following unordered rooms (v4)
+ | type | name | callRecording |
+ | 2 | room1 | 3 |
+ And recording server sent failed request for recording in room "room1" with 200
+ And user "participant1" is participant of the following unordered rooms (v4)
+ | type | name | callRecording |
+ | 2 | room1 | 5 |
+ When user "participant1" starts "video" recording in room "room1" with 200 (v1)
+ And recording server received the following requests
+ | token | data |
+ | room1 | {"type":"start","start":{"status":1,"owner":"participant1","actor":{"type":"users","id":"participant1"}}} |
+ And user "participant1" is participant of the following unordered rooms (v4)
+ | type | name | callRecording |
+ | 2 | room1 | 3 |
+ And recording server sent started request for "video" recording in room "room1" as "participant1" with 200
+ Then user "participant1" sees the following system messages in room "room1" with 200 (v1)
+ | room | actorType | actorId | actorDisplayName | systemMessage |
+ | room1 | users | participant1 | participant1-displayname | recording_started |
+ | room1 | users | participant1 | participant1-displayname | call_started |
+ | room1 | users | participant1 | participant1-displayname | conversation_created |
+ And user "participant1" is participant of the following unordered rooms (v4)
+ | type | name | callRecording |
+ | 2 | room1 | 1 |
+ When user "participant1" stops recording in room "room1" with 200 (v1)
+ And recording server received the following requests
+ | token | data |
+ | room1 | {"type":"stop","stop":{"actor":{"type":"users","id":"participant1"}}} |
+ And user "participant1" is participant of the following unordered rooms (v4)
+ | type | name | callRecording |
+ | 2 | room1 | 1 |
+ And recording server sent stopped request for recording in room "room1" as "participant1" with 200
+ Then user "participant1" sees the following system messages in room "room1" with 200 (v1)
+ | room | actorType | actorId | actorDisplayName | systemMessage |
+ | room1 | users | participant1 | participant1-displayname | recording_stopped |
+ | room1 | users | participant1 | participant1-displayname | recording_started |
+ | room1 | users | participant1 | participant1-displayname | call_started |
+ | room1 | users | participant1 | participant1-displayname | conversation_created |
+ And user "participant1" is participant of the following unordered rooms (v4)
+ | type | name | callRecording |
+ | 2 | room1 | 0 |
+
+ Scenario: Start and stop recording again after the previous one failed
+ Given recording server is started
+ And the following "spreed" app config is set
+ | signaling_dev | yes |
+ And user "participant1" creates room "room1" (v4)
+ | roomType | 2 |
+ | roomName | room1 |
+ And user "participant1" joins room "room1" with 200 (v4)
+ And user "participant1" joins call "room1" with 200 (v4)
+ And user "participant1" starts "video" recording in room "room1" with 200 (v1)
+ And recording server received the following requests
+ | token | data |
+ | room1 | {"type":"start","start":{"status":1,"owner":"participant1","actor":{"type":"users","id":"participant1"}}} |
+ And user "participant1" is participant of the following unordered rooms (v4)
+ | type | name | callRecording |
+ | 2 | room1 | 3 |
+ And recording server sent started request for "video" recording in room "room1" as "participant1" with 200
+ And user "participant1" is participant of the following unordered rooms (v4)
+ | type | name | callRecording |
+ | 2 | room1 | 1 |
+ And recording server sent failed request for recording in room "room1" with 200
+ And user "participant1" is participant of the following unordered rooms (v4)
+ | type | name | callRecording |
+ | 2 | room1 | 5 |
+ When user "participant1" starts "video" recording in room "room1" with 200 (v1)
+ And recording server received the following requests
+ | token | data |
+ | room1 | {"type":"start","start":{"status":1,"owner":"participant1","actor":{"type":"users","id":"participant1"}}} |
+ And user "participant1" is participant of the following unordered rooms (v4)
+ | type | name | callRecording |
+ | 2 | room1 | 3 |
+ And recording server sent started request for "video" recording in room "room1" as "participant1" with 200
+ Then user "participant1" sees the following system messages in room "room1" with 200 (v1)
+ | room | actorType | actorId | actorDisplayName | systemMessage |
+ | room1 | users | participant1 | participant1-displayname | recording_started |
+ | room1 | guests | failed-to-get-session | | recording_failed |
+ | room1 | users | participant1 | participant1-displayname | recording_started |
+ | room1 | users | participant1 | participant1-displayname | call_started |
+ | room1 | users | participant1 | participant1-displayname | conversation_created |
+ And user "participant1" is participant of the following unordered rooms (v4)
+ | type | name | callRecording |
+ | 2 | room1 | 1 |
+ When user "participant1" stops recording in room "room1" with 200 (v1)
+ And recording server received the following requests
+ | token | data |
+ | room1 | {"type":"stop","stop":{"actor":{"type":"users","id":"participant1"}}} |
+ And user "participant1" is participant of the following unordered rooms (v4)
+ | type | name | callRecording |
+ | 2 | room1 | 1 |
+ And recording server sent stopped request for recording in room "room1" as "participant1" with 200
+ Then user "participant1" sees the following system messages in room "room1" with 200 (v1)
+ | room | actorType | actorId | actorDisplayName | systemMessage |
+ | room1 | users | participant1 | participant1-displayname | recording_stopped |
+ | room1 | users | participant1 | participant1-displayname | recording_started |
+ | room1 | guests | failed-to-get-session | | recording_failed |
+ | room1 | users | participant1 | participant1-displayname | recording_started |
+ | room1 | users | participant1 | participant1-displayname | call_started |
+ | room1 | users | participant1 | participant1-displayname | conversation_created |
+ And user "participant1" is participant of the following unordered rooms (v4)
+ | type | name | callRecording |
+ | 2 | room1 | 0 |
+
Scenario: Get error when start|stop recording and already did this
Given recording server is started
And the following "spreed" app config is set
diff --git a/tests/php/Chat/SystemMessage/ListenerTest.php b/tests/php/Chat/SystemMessage/ListenerTest.php
index 91dd198ae..77619b52b 100644
--- a/tests/php/Chat/SystemMessage/ListenerTest.php
+++ b/tests/php/Chat/SystemMessage/ListenerTest.php
@@ -461,6 +461,90 @@ class ListenerTest extends TestCase {
'bob',
['message' => 'audio_recording_stopped', 'parameters' => []],
],
+ [
+ Room::RECORDING_FAILED,
+ Room::RECORDING_VIDEO_STARTING,
+ null,
+ null,
+ null,
+ ],
+ [
+ Room::RECORDING_FAILED,
+ Room::RECORDING_AUDIO_STARTING,
+ null,
+ null,
+ null,
+ ],
+ [
+ Room::RECORDING_FAILED,
+ Room::RECORDING_VIDEO,
+ null,
+ null,
+ ['message' => 'recording_failed', 'parameters' => []],
+ ],
+ [
+ Room::RECORDING_FAILED,
+ Room::RECORDING_AUDIO,
+ null,
+ null,
+ ['message' => 'recording_failed', 'parameters' => []],
+ ],
+ [
+ Room::RECORDING_VIDEO_STARTING,
+ Room::RECORDING_FAILED,
+ null,
+ null,
+ null,
+ ],
+ [
+ Room::RECORDING_VIDEO_STARTING,
+ Room::RECORDING_FAILED,
+ Attendee::ACTOR_USERS,
+ 'alice',
+ null,
+ ],
+ [
+ Room::RECORDING_VIDEO,
+ Room::RECORDING_FAILED,
+ null,
+ null,
+ ['message' => 'recording_started', 'parameters' => []],
+ ],
+ [
+ Room::RECORDING_VIDEO,
+ Room::RECORDING_FAILED,
+ Attendee::ACTOR_USERS,
+ 'alice',
+ ['message' => 'recording_started', 'parameters' => []],
+ ],
+ [
+ Room::RECORDING_AUDIO_STARTING,
+ Room::RECORDING_FAILED,
+ null,
+ null,
+ null,
+ ],
+ [
+ Room::RECORDING_AUDIO_STARTING,
+ Room::RECORDING_FAILED,
+ Attendee::ACTOR_USERS,
+ 'alice',
+ null,
+ ],
+ [
+ Room::RECORDING_AUDIO,
+ Room::RECORDING_FAILED,
+ null,
+ null,
+ ['message' => 'audio_recording_started', 'parameters' => []],
+ ],
+ [
+ Room::RECORDING_AUDIO,
+ Room::RECORDING_FAILED,
+ Attendee::ACTOR_USERS,
+ 'alice',
+ ['message' => 'audio_recording_started', 'parameters' => []],
+ ],
];
}