aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/transcoding
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-05-04 15:29:34 +0200
committerChocobozzz <chocobozzz@cpy.re>2023-05-09 08:57:34 +0200
commit5e47f6ab984a7d00782e4c7030afffa1ba480add (patch)
tree1ce586b591a8d71acbc301eba29b9a5e6490439e /server/tests/api/transcoding
parent6a4905602636afd6650c9e6f4d0fcc2105d91100 (diff)
downloadPeerTube-5e47f6ab984a7d00782e4c7030afffa1ba480add.tar.gz
PeerTube-5e47f6ab984a7d00782e4c7030afffa1ba480add.tar.zst
PeerTube-5e47f6ab984a7d00782e4c7030afffa1ba480add.zip
Support studio transcoding in peertube runner
Diffstat (limited to 'server/tests/api/transcoding')
-rw-r--r--server/tests/api/transcoding/video-studio.ts42
1 files changed, 14 insertions, 28 deletions
diff --git a/server/tests/api/transcoding/video-studio.ts b/server/tests/api/transcoding/video-studio.ts
index 30f72e6e9..2f64ef6bd 100644
--- a/server/tests/api/transcoding/video-studio.ts
+++ b/server/tests/api/transcoding/video-studio.ts
@@ -1,5 +1,5 @@
1import { expect } from 'chai' 1import { expect } from 'chai'
2import { checkPersistentTmpIsEmpty, expectStartWith } from '@server/tests/shared' 2import { checkPersistentTmpIsEmpty, checkVideoDuration, expectStartWith } from '@server/tests/shared'
3import { areMockObjectStorageTestsDisabled, getAllFiles } from '@shared/core-utils' 3import { areMockObjectStorageTestsDisabled, getAllFiles } from '@shared/core-utils'
4import { VideoStudioTask } from '@shared/models' 4import { VideoStudioTask } from '@shared/models'
5import { 5import {
@@ -18,20 +18,6 @@ describe('Test video studio', function () {
18 let servers: PeerTubeServer[] = [] 18 let servers: PeerTubeServer[] = []
19 let videoUUID: string 19 let videoUUID: string
20 20
21 async function checkDuration (server: PeerTubeServer, duration: number) {
22 const video = await server.videos.get({ id: videoUUID })
23
24 expect(video.duration).to.be.approximately(duration, 1)
25
26 for (const file of video.files) {
27 const metadata = await server.videos.getFileMetadata({ url: file.metadataUrl })
28
29 for (const stream of metadata.streams) {
30 expect(Math.round(stream.duration)).to.be.approximately(duration, 1)
31 }
32 }
33 }
34
35 async function renewVideo (fixture = 'video_short.webm') { 21 async function renewVideo (fixture = 'video_short.webm') {
36 const video = await servers[0].videos.quickUpload({ name: 'video', fixture }) 22 const video = await servers[0].videos.quickUpload({ name: 'video', fixture })
37 videoUUID = video.uuid 23 videoUUID = video.uuid
@@ -79,7 +65,7 @@ describe('Test video studio', function () {
79 ]) 65 ])
80 66
81 for (const server of servers) { 67 for (const server of servers) {
82 await checkDuration(server, 3) 68 await checkVideoDuration(server, videoUUID, 3)
83 69
84 const video = await server.videos.get({ id: videoUUID }) 70 const video = await server.videos.get({ id: videoUUID })
85 expect(new Date(video.publishedAt)).to.be.below(beforeTasks) 71 expect(new Date(video.publishedAt)).to.be.below(beforeTasks)
@@ -100,7 +86,7 @@ describe('Test video studio', function () {
100 ]) 86 ])
101 87
102 for (const server of servers) { 88 for (const server of servers) {
103 await checkDuration(server, 2) 89 await checkVideoDuration(server, videoUUID, 2)
104 } 90 }
105 }) 91 })
106 92
@@ -119,7 +105,7 @@ describe('Test video studio', function () {
119 ]) 105 ])
120 106
121 for (const server of servers) { 107 for (const server of servers) {
122 await checkDuration(server, 4) 108 await checkVideoDuration(server, videoUUID, 4)
123 } 109 }
124 }) 110 })
125 }) 111 })
@@ -140,7 +126,7 @@ describe('Test video studio', function () {
140 ]) 126 ])
141 127
142 for (const server of servers) { 128 for (const server of servers) {
143 await checkDuration(server, 10) 129 await checkVideoDuration(server, videoUUID, 10)
144 } 130 }
145 }) 131 })
146 132
@@ -158,7 +144,7 @@ describe('Test video studio', function () {
158 ]) 144 ])
159 145
160 for (const server of servers) { 146 for (const server of servers) {
161 await checkDuration(server, 7) 147 await checkVideoDuration(server, videoUUID, 7)
162 } 148 }
163 }) 149 })
164 150
@@ -183,7 +169,7 @@ describe('Test video studio', function () {
183 ]) 169 ])
184 170
185 for (const server of servers) { 171 for (const server of servers) {
186 await checkDuration(server, 12) 172 await checkVideoDuration(server, videoUUID, 12)
187 } 173 }
188 }) 174 })
189 175
@@ -201,7 +187,7 @@ describe('Test video studio', function () {
201 ]) 187 ])
202 188
203 for (const server of servers) { 189 for (const server of servers) {
204 await checkDuration(server, 7) 190 await checkVideoDuration(server, videoUUID, 7)
205 } 191 }
206 }) 192 })
207 193
@@ -219,7 +205,7 @@ describe('Test video studio', function () {
219 ]) 205 ])
220 206
221 for (const server of servers) { 207 for (const server of servers) {
222 await checkDuration(server, 10) 208 await checkVideoDuration(server, videoUUID, 10)
223 } 209 }
224 }) 210 })
225 211
@@ -237,7 +223,7 @@ describe('Test video studio', function () {
237 ]) 223 ])
238 224
239 for (const server of servers) { 225 for (const server of servers) {
240 await checkDuration(server, 10) 226 await checkVideoDuration(server, videoUUID, 10)
241 } 227 }
242 }) 228 })
243 }) 229 })
@@ -279,7 +265,7 @@ describe('Test video studio', function () {
279 await createTasks(VideoStudioCommand.getComplexTask()) 265 await createTasks(VideoStudioCommand.getComplexTask())
280 266
281 for (const server of servers) { 267 for (const server of servers) {
282 await checkDuration(server, 9) 268 await checkVideoDuration(server, videoUUID, 9)
283 } 269 }
284 }) 270 })
285 }) 271 })
@@ -309,7 +295,7 @@ describe('Test video studio', function () {
309 const video = await server.videos.get({ id: videoUUID }) 295 const video = await server.videos.get({ id: videoUUID })
310 expect(video.files).to.have.lengthOf(0) 296 expect(video.files).to.have.lengthOf(0)
311 297
312 await checkDuration(server, 9) 298 await checkVideoDuration(server, videoUUID, 9)
313 } 299 }
314 }) 300 })
315 }) 301 })
@@ -351,7 +337,7 @@ describe('Test video studio', function () {
351 expectStartWith(hlsFile.fileUrl, ObjectStorageCommand.getMockPlaylistBaseUrl()) 337 expectStartWith(hlsFile.fileUrl, ObjectStorageCommand.getMockPlaylistBaseUrl())
352 } 338 }
353 339
354 await checkDuration(server, 9) 340 await checkVideoDuration(server, videoUUID, 9)
355 } 341 }
356 }) 342 })
357 }) 343 })
@@ -370,7 +356,7 @@ describe('Test video studio', function () {
370 await waitJobs(servers) 356 await waitJobs(servers)
371 357
372 for (const server of servers) { 358 for (const server of servers) {
373 await checkDuration(server, 9) 359 await checkVideoDuration(server, videoUUID, 9)
374 } 360 }
375 }) 361 })
376 362