diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-08 10:18:40 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-20 15:27:17 +0200 |
commit | 4f2199144e428c16460750305f737b890c1ac322 (patch) | |
tree | a19c5c0f254ab0b32d6c8838af33a1ba260e4877 /server/tests/plugins | |
parent | 2c27e70471120c92e0bc8c8114141fbb31ff98ac (diff) | |
download | PeerTube-4f2199144e428c16460750305f737b890c1ac322.tar.gz PeerTube-4f2199144e428c16460750305f737b890c1ac322.tar.zst PeerTube-4f2199144e428c16460750305f737b890c1ac322.zip |
Introduce live command
Diffstat (limited to 'server/tests/plugins')
-rw-r--r-- | server/tests/plugins/action-hooks.ts | 3 | ||||
-rw-r--r-- | server/tests/plugins/filter-hooks.ts | 3 | ||||
-rw-r--r-- | server/tests/plugins/plugin-transcoding.ts | 28 |
3 files changed, 15 insertions, 19 deletions
diff --git a/server/tests/plugins/action-hooks.ts b/server/tests/plugins/action-hooks.ts index 0de5b523b..39266c62f 100644 --- a/server/tests/plugins/action-hooks.ts +++ b/server/tests/plugins/action-hooks.ts | |||
@@ -7,7 +7,6 @@ import { | |||
7 | addVideoCommentThread, | 7 | addVideoCommentThread, |
8 | addVideoInPlaylist, | 8 | addVideoInPlaylist, |
9 | blockUser, | 9 | blockUser, |
10 | createLive, | ||
11 | createUser, | 10 | createUser, |
12 | createVideoPlaylist, | 11 | createVideoPlaylist, |
13 | deleteVideoComment, | 12 | deleteVideoComment, |
@@ -96,7 +95,7 @@ describe('Test plugin action hooks', function () { | |||
96 | channelId: servers[0].videoChannel.id | 95 | channelId: servers[0].videoChannel.id |
97 | } | 96 | } |
98 | 97 | ||
99 | await createLive(servers[0].url, servers[0].accessToken, attributes) | 98 | await servers[0].liveCommand.createLive({ fields: attributes }) |
100 | 99 | ||
101 | await checkHook('action:api.live-video.created') | 100 | await checkHook('action:api.live-video.created') |
102 | }) | 101 | }) |
diff --git a/server/tests/plugins/filter-hooks.ts b/server/tests/plugins/filter-hooks.ts index e254046bf..e60bad38d 100644 --- a/server/tests/plugins/filter-hooks.ts +++ b/server/tests/plugins/filter-hooks.ts | |||
@@ -7,7 +7,6 @@ import { | |||
7 | addVideoCommentReply, | 7 | addVideoCommentReply, |
8 | addVideoCommentThread, | 8 | addVideoCommentThread, |
9 | cleanupTests, | 9 | cleanupTests, |
10 | createLive, | ||
11 | createVideoPlaylist, | 10 | createVideoPlaylist, |
12 | doubleFollow, | 11 | doubleFollow, |
13 | flushAndRunMultipleServers, | 12 | flushAndRunMultipleServers, |
@@ -156,7 +155,7 @@ describe('Test plugin filter hooks', function () { | |||
156 | channelId: servers[0].videoChannel.id | 155 | channelId: servers[0].videoChannel.id |
157 | } | 156 | } |
158 | 157 | ||
159 | await createLive(servers[0].url, servers[0].accessToken, attributes, HttpStatusCode.FORBIDDEN_403) | 158 | await servers[0].liveCommand.createLive({ fields: attributes, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) |
160 | }) | 159 | }) |
161 | 160 | ||
162 | it('Should run filter:api.video.pre-import-url.accept.result', async function () { | 161 | it('Should run filter:api.video.pre-import-url.accept.result', async function () { |
diff --git a/server/tests/plugins/plugin-transcoding.ts b/server/tests/plugins/plugin-transcoding.ts index 71c2adc72..65282419e 100644 --- a/server/tests/plugins/plugin-transcoding.ts +++ b/server/tests/plugins/plugin-transcoding.ts | |||
@@ -7,18 +7,15 @@ import { getAudioStream, getVideoFileFPS, getVideoStreamFromFile } from '@server | |||
7 | import { | 7 | import { |
8 | buildServerDirectory, | 8 | buildServerDirectory, |
9 | cleanupTests, | 9 | cleanupTests, |
10 | createLive, | ||
11 | flushAndRunServer, | 10 | flushAndRunServer, |
12 | getVideo, | 11 | getVideo, |
13 | PluginsCommand, | 12 | PluginsCommand, |
14 | sendRTMPStreamInVideo, | ||
15 | ServerInfo, | 13 | ServerInfo, |
16 | setAccessTokensToServers, | 14 | setAccessTokensToServers, |
17 | setDefaultVideoChannel, | 15 | setDefaultVideoChannel, |
18 | testFfmpegStreamError, | 16 | testFfmpegStreamError, |
19 | uploadVideoAndGetId, | 17 | uploadVideoAndGetId, |
20 | waitJobs, | 18 | waitJobs |
21 | waitUntilLivePublished | ||
22 | } from '@shared/extra-utils' | 19 | } from '@shared/extra-utils' |
23 | import { VideoDetails, VideoPrivacy } from '@shared/models' | 20 | import { VideoDetails, VideoPrivacy } from '@shared/models' |
24 | 21 | ||
@@ -29,8 +26,9 @@ async function createLiveWrapper (server: ServerInfo) { | |||
29 | privacy: VideoPrivacy.PUBLIC | 26 | privacy: VideoPrivacy.PUBLIC |
30 | } | 27 | } |
31 | 28 | ||
32 | const res = await createLive(server.url, server.accessToken, liveAttributes) | 29 | const { uuid } = await server.liveCommand.createLive({ fields: liveAttributes }) |
33 | return res.body.video.uuid | 30 | |
31 | return uuid | ||
34 | } | 32 | } |
35 | 33 | ||
36 | function updateConf (server: ServerInfo, vodProfile: string, liveProfile: string) { | 34 | function updateConf (server: ServerInfo, vodProfile: string, liveProfile: string) { |
@@ -171,8 +169,8 @@ describe('Test transcoding plugins', function () { | |||
171 | 169 | ||
172 | const liveVideoId = await createLiveWrapper(server) | 170 | const liveVideoId = await createLiveWrapper(server) |
173 | 171 | ||
174 | await sendRTMPStreamInVideo(server.url, server.accessToken, liveVideoId, 'video_short2.webm') | 172 | await server.liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short2.webm' }) |
175 | await waitUntilLivePublished(server.url, server.accessToken, liveVideoId) | 173 | await server.liveCommand.waitUntilLivePublished({ videoId: liveVideoId }) |
176 | await waitJobs([ server ]) | 174 | await waitJobs([ server ]) |
177 | 175 | ||
178 | await checkLiveFPS(liveVideoId, 'above', 20) | 176 | await checkLiveFPS(liveVideoId, 'above', 20) |
@@ -185,8 +183,8 @@ describe('Test transcoding plugins', function () { | |||
185 | 183 | ||
186 | const liveVideoId = await createLiveWrapper(server) | 184 | const liveVideoId = await createLiveWrapper(server) |
187 | 185 | ||
188 | await sendRTMPStreamInVideo(server.url, server.accessToken, liveVideoId, 'video_short2.webm') | 186 | await server.liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short2.webm' }) |
189 | await waitUntilLivePublished(server.url, server.accessToken, liveVideoId) | 187 | await server.liveCommand.waitUntilLivePublished({ videoId: liveVideoId }) |
190 | await waitJobs([ server ]) | 188 | await waitJobs([ server ]) |
191 | 189 | ||
192 | await checkLiveFPS(liveVideoId, 'below', 12) | 190 | await checkLiveFPS(liveVideoId, 'below', 12) |
@@ -199,8 +197,8 @@ describe('Test transcoding plugins', function () { | |||
199 | 197 | ||
200 | const liveVideoId = await createLiveWrapper(server) | 198 | const liveVideoId = await createLiveWrapper(server) |
201 | 199 | ||
202 | await sendRTMPStreamInVideo(server.url, server.accessToken, liveVideoId, 'video_short2.webm') | 200 | await server.liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short2.webm' }) |
203 | await waitUntilLivePublished(server.url, server.accessToken, liveVideoId) | 201 | await server.liveCommand.waitUntilLivePublished({ videoId: liveVideoId }) |
204 | await waitJobs([ server ]) | 202 | await waitJobs([ server ]) |
205 | 203 | ||
206 | await checkLiveFPS(liveVideoId, 'below', 6) | 204 | await checkLiveFPS(liveVideoId, 'below', 6) |
@@ -213,7 +211,7 @@ describe('Test transcoding plugins', function () { | |||
213 | 211 | ||
214 | const liveVideoId = await createLiveWrapper(server) | 212 | const liveVideoId = await createLiveWrapper(server) |
215 | 213 | ||
216 | const command = await sendRTMPStreamInVideo(server.url, server.accessToken, liveVideoId, 'video_short2.webm') | 214 | const command = await server.liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short2.webm' }) |
217 | await testFfmpegStreamError(command, true) | 215 | await testFfmpegStreamError(command, true) |
218 | }) | 216 | }) |
219 | 217 | ||
@@ -262,8 +260,8 @@ describe('Test transcoding plugins', function () { | |||
262 | 260 | ||
263 | const liveVideoId = await createLiveWrapper(server) | 261 | const liveVideoId = await createLiveWrapper(server) |
264 | 262 | ||
265 | await sendRTMPStreamInVideo(server.url, server.accessToken, liveVideoId, 'video_short2.webm') | 263 | await server.liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short2.webm' }) |
266 | await waitUntilLivePublished(server.url, server.accessToken, liveVideoId) | 264 | await server.liveCommand.waitUntilLivePublished({ videoId: liveVideoId }) |
267 | await waitJobs([ server ]) | 265 | await waitJobs([ server ]) |
268 | 266 | ||
269 | const playlistUrl = `${server.url}/static/streaming-playlists/hls/${liveVideoId}/0.m3u8` | 267 | const playlistUrl = `${server.url}/static/streaming-playlists/hls/${liveVideoId}/0.m3u8` |