aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/plugins/plugin-transcoding.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/plugins/plugin-transcoding.ts')
-rw-r--r--server/tests/plugins/plugin-transcoding.ts23
1 files changed, 9 insertions, 14 deletions
diff --git a/server/tests/plugins/plugin-transcoding.ts b/server/tests/plugins/plugin-transcoding.ts
index 4839e8792..a3613293a 100644
--- a/server/tests/plugins/plugin-transcoding.ts
+++ b/server/tests/plugins/plugin-transcoding.ts
@@ -7,16 +7,14 @@ import { getAudioStream, getVideoFileFPS, getVideoStreamFromFile } from '@server
7import { 7import {
8 cleanupTests, 8 cleanupTests,
9 flushAndRunServer, 9 flushAndRunServer,
10 getVideo,
11 PluginsCommand, 10 PluginsCommand,
12 ServerInfo, 11 ServerInfo,
13 setAccessTokensToServers, 12 setAccessTokensToServers,
14 setDefaultVideoChannel, 13 setDefaultVideoChannel,
15 testFfmpegStreamError, 14 testFfmpegStreamError,
16 uploadVideoAndGetId,
17 waitJobs 15 waitJobs
18} from '@shared/extra-utils' 16} from '@shared/extra-utils'
19import { VideoDetails, VideoPrivacy } from '@shared/models' 17import { VideoPrivacy } from '@shared/models'
20 18
21async function createLiveWrapper (server: ServerInfo) { 19async function createLiveWrapper (server: ServerInfo) {
22 const liveAttributes = { 20 const liveAttributes = {
@@ -81,8 +79,7 @@ describe('Test transcoding plugins', function () {
81 describe('When using a plugin adding profiles to existing encoders', function () { 79 describe('When using a plugin adding profiles to existing encoders', function () {
82 80
83 async function checkVideoFPS (uuid: string, type: 'above' | 'below', fps: number) { 81 async function checkVideoFPS (uuid: string, type: 'above' | 'below', fps: number) {
84 const res = await getVideo(server.url, uuid) 82 const video = await server.videosCommand.get({ id: uuid })
85 const video = res.body as VideoDetails
86 const files = video.files.concat(...video.streamingPlaylists.map(p => p.files)) 83 const files = video.files.concat(...video.streamingPlaylists.map(p => p.files))
87 84
88 for (const file of files) { 85 for (const file of files) {
@@ -119,7 +116,7 @@ describe('Test transcoding plugins', function () {
119 it('Should not use the plugin profile if not chosen by the admin', async function () { 116 it('Should not use the plugin profile if not chosen by the admin', async function () {
120 this.timeout(240000) 117 this.timeout(240000)
121 118
122 const videoUUID = (await uploadVideoAndGetId({ server, videoName: 'video' })).uuid 119 const videoUUID = (await server.videosCommand.quickUpload({ name: 'video' })).uuid
123 await waitJobs([ server ]) 120 await waitJobs([ server ])
124 121
125 await checkVideoFPS(videoUUID, 'above', 20) 122 await checkVideoFPS(videoUUID, 'above', 20)
@@ -130,7 +127,7 @@ describe('Test transcoding plugins', function () {
130 127
131 await updateConf(server, 'low-vod', 'default') 128 await updateConf(server, 'low-vod', 'default')
132 129
133 const videoUUID = (await uploadVideoAndGetId({ server, videoName: 'video' })).uuid 130 const videoUUID = (await server.videosCommand.quickUpload({ name: 'video' })).uuid
134 await waitJobs([ server ]) 131 await waitJobs([ server ])
135 132
136 await checkVideoFPS(videoUUID, 'below', 12) 133 await checkVideoFPS(videoUUID, 'below', 12)
@@ -141,7 +138,7 @@ describe('Test transcoding plugins', function () {
141 138
142 await updateConf(server, 'input-options-vod', 'default') 139 await updateConf(server, 'input-options-vod', 'default')
143 140
144 const videoUUID = (await uploadVideoAndGetId({ server, videoName: 'video' })).uuid 141 const videoUUID = (await server.videosCommand.quickUpload({ name: 'video' })).uuid
145 await waitJobs([ server ]) 142 await waitJobs([ server ])
146 143
147 await checkVideoFPS(videoUUID, 'below', 6) 144 await checkVideoFPS(videoUUID, 'below', 6)
@@ -152,13 +149,11 @@ describe('Test transcoding plugins', function () {
152 149
153 await updateConf(server, 'bad-scale-vod', 'default') 150 await updateConf(server, 'bad-scale-vod', 'default')
154 151
155 const videoUUID = (await uploadVideoAndGetId({ server, videoName: 'video' })).uuid 152 const videoUUID = (await server.videosCommand.quickUpload({ name: 'video' })).uuid
156 await waitJobs([ server ]) 153 await waitJobs([ server ])
157 154
158 // Transcoding failed 155 // Transcoding failed
159 const res = await getVideo(server.url, videoUUID) 156 const video = await server.videosCommand.get({ id: videoUUID })
160 const video: VideoDetails = res.body
161
162 expect(video.files).to.have.lengthOf(1) 157 expect(video.files).to.have.lengthOf(1)
163 expect(video.streamingPlaylists).to.have.lengthOf(0) 158 expect(video.streamingPlaylists).to.have.lengthOf(0)
164 }) 159 })
@@ -224,7 +219,7 @@ describe('Test transcoding plugins', function () {
224 expect(config.transcoding.availableProfiles).to.deep.equal([ 'default' ]) 219 expect(config.transcoding.availableProfiles).to.deep.equal([ 'default' ])
225 expect(config.live.transcoding.availableProfiles).to.deep.equal([ 'default' ]) 220 expect(config.live.transcoding.availableProfiles).to.deep.equal([ 'default' ])
226 221
227 const videoUUID = (await uploadVideoAndGetId({ server, videoName: 'video' })).uuid 222 const videoUUID = (await server.videosCommand.quickUpload({ name: 'video' })).uuid
228 await waitJobs([ server ]) 223 await waitJobs([ server ])
229 224
230 await checkVideoFPS(videoUUID, 'above', 20) 225 await checkVideoFPS(videoUUID, 'above', 20)
@@ -243,7 +238,7 @@ describe('Test transcoding plugins', function () {
243 it('Should use the new vod encoders', async function () { 238 it('Should use the new vod encoders', async function () {
244 this.timeout(240000) 239 this.timeout(240000)
245 240
246 const videoUUID = (await uploadVideoAndGetId({ server, videoName: 'video', fixture: 'video_short_240p.mp4' })).uuid 241 const videoUUID = (await server.videosCommand.quickUpload({ name: 'video', fixture: 'video_short_240p.mp4' })).uuid
247 await waitJobs([ server ]) 242 await waitJobs([ server ])
248 243
249 const path = server.serversCommand.buildDirectory(join('videos', videoUUID + '-240.mp4')) 244 const path = server.serversCommand.buildDirectory(join('videos', videoUUID + '-240.mp4'))