aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/videos/video-transcoder.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-07 11:51:09 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:17 +0200
commit65e6e2602c0d5521f3a6740f7469bb92830ecb53 (patch)
treef89024ffff1dafb0281ee2fe028e89b95101bd44 /server/tests/api/videos/video-transcoder.ts
parentbc8090411ddaa8d742ce4de3c83f9dba7bc18e2a (diff)
downloadPeerTube-65e6e2602c0d5521f3a6740f7469bb92830ecb53.tar.gz
PeerTube-65e6e2602c0d5521f3a6740f7469bb92830ecb53.tar.zst
PeerTube-65e6e2602c0d5521f3a6740f7469bb92830ecb53.zip
Introduce config command
Diffstat (limited to 'server/tests/api/videos/video-transcoder.ts')
-rw-r--r--server/tests/api/videos/video-transcoder.ts86
1 files changed, 45 insertions, 41 deletions
diff --git a/server/tests/api/videos/video-transcoder.ts b/server/tests/api/videos/video-transcoder.ts
index c95053a29..e74fb5bef 100644
--- a/server/tests/api/videos/video-transcoder.ts
+++ b/server/tests/api/videos/video-transcoder.ts
@@ -5,7 +5,6 @@ import * as chai from 'chai'
5import { FfprobeData } from 'fluent-ffmpeg' 5import { FfprobeData } from 'fluent-ffmpeg'
6import { omit } from 'lodash' 6import { omit } from 'lodash'
7import { join } from 'path' 7import { join } from 'path'
8import { Job } from '@shared/models'
9import { VIDEO_TRANSCODING_FPS } from '../../../../server/initializers/constants' 8import { VIDEO_TRANSCODING_FPS } from '../../../../server/initializers/constants'
10import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' 9import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
11import { 10import {
@@ -24,7 +23,6 @@ import {
24 makeGetRequest, 23 makeGetRequest,
25 ServerInfo, 24 ServerInfo,
26 setAccessTokensToServers, 25 setAccessTokensToServers,
27 updateCustomSubConfig,
28 uploadVideo, 26 uploadVideo,
29 uploadVideoAndGetId, 27 uploadVideoAndGetId,
30 waitJobs, 28 waitJobs,
@@ -43,22 +41,24 @@ import {
43const expect = chai.expect 41const expect = chai.expect
44 42
45function updateConfigForTranscoding (server: ServerInfo) { 43function updateConfigForTranscoding (server: ServerInfo) {
46 return updateCustomSubConfig(server.url, server.accessToken, { 44 return server.configCommand.updateCustomSubConfig({
47 transcoding: { 45 newConfig: {
48 enabled: true, 46 transcoding: {
49 allowAdditionalExtensions: true, 47 enabled: true,
50 allowAudioFiles: true, 48 allowAdditionalExtensions: true,
51 hls: { enabled: true }, 49 allowAudioFiles: true,
52 webtorrent: { enabled: true }, 50 hls: { enabled: true },
53 resolutions: { 51 webtorrent: { enabled: true },
54 '0p': false, 52 resolutions: {
55 '240p': true, 53 '0p': false,
56 '360p': true, 54 '240p': true,
57 '480p': true, 55 '360p': true,
58 '720p': true, 56 '480p': true,
59 '1080p': true, 57 '720p': true,
60 '1440p': true, 58 '1080p': true,
61 '2160p': true 59 '1440p': true,
60 '2160p': true
61 }
62 } 62 }
63 } 63 }
64 }) 64 })
@@ -363,19 +363,21 @@ describe('Test video transcoding', function () {
363 function runSuite (mode: 'legacy' | 'resumable') { 363 function runSuite (mode: 'legacy' | 'resumable') {
364 364
365 before(async function () { 365 before(async function () {
366 await updateCustomSubConfig(servers[1].url, servers[1].accessToken, { 366 await servers[1].configCommand.updateCustomSubConfig({
367 transcoding: { 367 newConfig: {
368 hls: { enabled: true }, 368 transcoding: {
369 webtorrent: { enabled: true }, 369 hls: { enabled: true },
370 resolutions: { 370 webtorrent: { enabled: true },
371 '0p': false, 371 resolutions: {
372 '240p': false, 372 '0p': false,
373 '360p': false, 373 '240p': false,
374 '480p': false, 374 '360p': false,
375 '720p': false, 375 '480p': false,
376 '1080p': false, 376 '720p': false,
377 '1440p': false, 377 '1080p': false,
378 '2160p': false 378 '1440p': false,
379 '2160p': false
380 }
379 } 381 }
380 } 382 }
381 }) 383 })
@@ -434,14 +436,16 @@ describe('Test video transcoding', function () {
434 it('Should upload an audio file and create an audio version only', async function () { 436 it('Should upload an audio file and create an audio version only', async function () {
435 this.timeout(60_000) 437 this.timeout(60_000)
436 438
437 await updateCustomSubConfig(servers[1].url, servers[1].accessToken, { 439 await servers[1].configCommand.updateCustomSubConfig({
438 transcoding: { 440 newConfig: {
439 hls: { enabled: true }, 441 transcoding: {
440 webtorrent: { enabled: true }, 442 hls: { enabled: true },
441 resolutions: { 443 webtorrent: { enabled: true },
442 '0p': true, 444 resolutions: {
443 '240p': false, 445 '0p': true,
444 '360p': false 446 '240p': false,
447 '360p': false
448 }
445 } 449 }
446 } 450 }
447 }) 451 })
@@ -601,7 +605,7 @@ describe('Test video transcoding', function () {
601 it('Should not transcode to an higher bitrate than the original file', async function () { 605 it('Should not transcode to an higher bitrate than the original file', async function () {
602 this.timeout(160_000) 606 this.timeout(160_000)
603 607
604 const config = { 608 const newConfig = {
605 transcoding: { 609 transcoding: {
606 enabled: true, 610 enabled: true,
607 resolutions: { 611 resolutions: {
@@ -617,7 +621,7 @@ describe('Test video transcoding', function () {
617 hls: { enabled: true } 621 hls: { enabled: true }
618 } 622 }
619 } 623 }
620 await updateCustomSubConfig(servers[1].url, servers[1].accessToken, config) 624 await servers[1].configCommand.updateCustomSubConfig({ newConfig })
621 625
622 const videoAttributes = { 626 const videoAttributes = {
623 name: 'low bitrate', 627 name: 'low bitrate',