aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/videos/video-transcoder.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-13 09:43:59 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:18 +0200
commit6c5065a011b099618681a37bd77eaa7bd3db752e (patch)
tree352252a00b25013c4b1902f6bcd9668aba295c7b /server/tests/api/videos/video-transcoder.ts
parent0d8ecb7592577f54012413a2b5a9b159cfc90399 (diff)
downloadPeerTube-6c5065a011b099618681a37bd77eaa7bd3db752e.tar.gz
PeerTube-6c5065a011b099618681a37bd77eaa7bd3db752e.tar.zst
PeerTube-6c5065a011b099618681a37bd77eaa7bd3db752e.zip
Introduce server commands
Diffstat (limited to 'server/tests/api/videos/video-transcoder.ts')
-rw-r--r--server/tests/api/videos/video-transcoder.ts22
1 files changed, 10 insertions, 12 deletions
diff --git a/server/tests/api/videos/video-transcoder.ts b/server/tests/api/videos/video-transcoder.ts
index e74fb5bef..f16b22bae 100644
--- a/server/tests/api/videos/video-transcoder.ts
+++ b/server/tests/api/videos/video-transcoder.ts
@@ -9,14 +9,12 @@ import { VIDEO_TRANSCODING_FPS } from '../../../../server/initializers/constants
9import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' 9import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
10import { 10import {
11 buildAbsoluteFixturePath, 11 buildAbsoluteFixturePath,
12 buildServerDirectory,
13 cleanupTests, 12 cleanupTests,
14 doubleFollow, 13 doubleFollow,
15 flushAndRunMultipleServers, 14 flushAndRunMultipleServers,
16 generateHighBitrateVideo, 15 generateHighBitrateVideo,
17 generateVideoWithFramerate, 16 generateVideoWithFramerate,
18 getMyVideos, 17 getMyVideos,
19 getServerFileSize,
20 getVideo, 18 getVideo,
21 getVideoFileMetadataUrl, 19 getVideoFileMetadataUrl,
22 getVideosList, 20 getVideosList,
@@ -285,7 +283,7 @@ describe('Test video transcoding', function () {
285 283
286 expect(videoDetails.files).to.have.lengthOf(4) 284 expect(videoDetails.files).to.have.lengthOf(4)
287 285
288 const path = buildServerDirectory(servers[1], join('videos', video.uuid + '-240.mp4')) 286 const path = servers[1].serversCommand.buildDirectory(join('videos', video.uuid + '-240.mp4'))
289 const probe = await getAudioStream(path) 287 const probe = await getAudioStream(path)
290 288
291 if (probe.audioStream) { 289 if (probe.audioStream) {
@@ -316,7 +314,7 @@ describe('Test video transcoding', function () {
316 const videoDetails: VideoDetails = res2.body 314 const videoDetails: VideoDetails = res2.body
317 315
318 expect(videoDetails.files).to.have.lengthOf(4) 316 expect(videoDetails.files).to.have.lengthOf(4)
319 const path = buildServerDirectory(servers[1], join('videos', video.uuid + '-240.mp4')) 317 const path = servers[1].serversCommand.buildDirectory(join('videos', video.uuid + '-240.mp4'))
320 const probe = await getAudioStream(path) 318 const probe = await getAudioStream(path)
321 expect(probe).to.not.have.property('audioStream') 319 expect(probe).to.not.have.property('audioStream')
322 } 320 }
@@ -344,7 +342,7 @@ describe('Test video transcoding', function () {
344 342
345 const fixturePath = buildAbsoluteFixturePath(videoAttributes.fixture) 343 const fixturePath = buildAbsoluteFixturePath(videoAttributes.fixture)
346 const fixtureVideoProbe = await getAudioStream(fixturePath) 344 const fixtureVideoProbe = await getAudioStream(fixturePath)
347 const path = buildServerDirectory(servers[1], join('videos', video.uuid + '-240.mp4')) 345 const path = servers[1].serversCommand.buildDirectory(join('videos', video.uuid + '-240.mp4'))
348 346
349 const videoProbe = await getAudioStream(path) 347 const videoProbe = await getAudioStream(path)
350 348
@@ -506,13 +504,13 @@ describe('Test video transcoding', function () {
506 expect(videoDetails.files[3].fps).to.be.below(31) 504 expect(videoDetails.files[3].fps).to.be.below(31)
507 505
508 for (const resolution of [ '240', '360', '480' ]) { 506 for (const resolution of [ '240', '360', '480' ]) {
509 const path = buildServerDirectory(servers[1], join('videos', video.uuid + '-' + resolution + '.mp4')) 507 const path = servers[1].serversCommand.buildDirectory(join('videos', video.uuid + '-' + resolution + '.mp4'))
510 const fps = await getVideoFileFPS(path) 508 const fps = await getVideoFileFPS(path)
511 509
512 expect(fps).to.be.below(31) 510 expect(fps).to.be.below(31)
513 } 511 }
514 512
515 const path = buildServerDirectory(servers[1], join('videos', video.uuid + '-720.mp4')) 513 const path = servers[1].serversCommand.buildDirectory(join('videos', video.uuid + '-720.mp4'))
516 const fps = await getVideoFileFPS(path) 514 const fps = await getVideoFileFPS(path)
517 515
518 expect(fps).to.be.above(58).and.below(62) 516 expect(fps).to.be.above(58).and.below(62)
@@ -547,13 +545,13 @@ describe('Test video transcoding', function () {
547 const video = res.body.data.find(v => v.name === videoAttributes.name) 545 const video = res.body.data.find(v => v.name === videoAttributes.name)
548 546
549 { 547 {
550 const path = buildServerDirectory(servers[1], join('videos', video.uuid + '-240.mp4')) 548 const path = servers[1].serversCommand.buildDirectory(join('videos', video.uuid + '-240.mp4'))
551 const fps = await getVideoFileFPS(path) 549 const fps = await getVideoFileFPS(path)
552 expect(fps).to.be.equal(25) 550 expect(fps).to.be.equal(25)
553 } 551 }
554 552
555 { 553 {
556 const path = buildServerDirectory(servers[1], join('videos', video.uuid + '-720.mp4')) 554 const path = servers[1].serversCommand.buildDirectory(join('videos', video.uuid + '-720.mp4'))
557 const fps = await getVideoFileFPS(path) 555 const fps = await getVideoFileFPS(path)
558 expect(fps).to.be.equal(59) 556 expect(fps).to.be.equal(59)
559 } 557 }
@@ -590,7 +588,7 @@ describe('Test video transcoding', function () {
590 const video = res.body.data.find(v => v.name === videoAttributes.name) 588 const video = res.body.data.find(v => v.name === videoAttributes.name)
591 589
592 for (const resolution of [ '240', '360', '480', '720', '1080' ]) { 590 for (const resolution of [ '240', '360', '480', '720', '1080' ]) {
593 const path = buildServerDirectory(servers[1], join('videos', video.uuid + '-' + resolution + '.mp4')) 591 const path = servers[1].serversCommand.buildDirectory(join('videos', video.uuid + '-' + resolution + '.mp4'))
594 592
595 const bitrate = await getVideoFileBitrate(path) 593 const bitrate = await getVideoFileBitrate(path)
596 const fps = await getVideoFileFPS(path) 594 const fps = await getVideoFileFPS(path)
@@ -636,7 +634,7 @@ describe('Test video transcoding', function () {
636 const resolutions = [ 240, 360, 480, 720, 1080 ] 634 const resolutions = [ 240, 360, 480, 720, 1080 ]
637 for (const r of resolutions) { 635 for (const r of resolutions) {
638 const path = `videos/${videoUUID}-${r}.mp4` 636 const path = `videos/${videoUUID}-${r}.mp4`
639 const size = await getServerFileSize(servers[1], path) 637 const size = await servers[1].serversCommand.getServerFileSize(path)
640 expect(size, `${path} not below ${60_000}`).to.be.below(60_000) 638 expect(size, `${path} not below ${60_000}`).to.be.below(60_000)
641 } 639 }
642 }) 640 })
@@ -651,7 +649,7 @@ describe('Test video transcoding', function () {
651 await waitJobs(servers) 649 await waitJobs(servers)
652 650
653 { 651 {
654 const path = buildServerDirectory(servers[1], join('videos', videoUUID + '-240.mp4')) 652 const path = servers[1].serversCommand.buildDirectory(join('videos', videoUUID + '-240.mp4'))
655 const metadata = await getMetadataFromFile(path) 653 const metadata = await getMetadataFromFile(path)
656 654
657 // expected format properties 655 // expected format properties