aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/transcoding
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-04-21 15:00:01 +0200
committerChocobozzz <chocobozzz@cpy.re>2023-05-09 08:57:34 +0200
commitd102de1b38f2877463529c3b27bd35ffef4fd8bf (patch)
tree31fa0bdf26ad7a2ee46d600d804a6f03260266c8 /server/tests/api/transcoding
parent2fe978744e5b74eb824e4d79c1bb9b840169f125 (diff)
downloadPeerTube-d102de1b38f2877463529c3b27bd35ffef4fd8bf.tar.gz
PeerTube-d102de1b38f2877463529c3b27bd35ffef4fd8bf.tar.zst
PeerTube-d102de1b38f2877463529c3b27bd35ffef4fd8bf.zip
Add runner server tests
Diffstat (limited to 'server/tests/api/transcoding')
-rw-r--r--server/tests/api/transcoding/audio-only.ts2
-rw-r--r--server/tests/api/transcoding/transcoder.ts27
2 files changed, 12 insertions, 17 deletions
diff --git a/server/tests/api/transcoding/audio-only.ts b/server/tests/api/transcoding/audio-only.ts
index b72f5fdbe..1e31418e7 100644
--- a/server/tests/api/transcoding/audio-only.ts
+++ b/server/tests/api/transcoding/audio-only.ts
@@ -1,7 +1,7 @@
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ 1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2 2
3import { expect } from 'chai' 3import { expect } from 'chai'
4import { getAudioStream, getVideoStreamDimensionsInfo } from '@server/helpers/ffmpeg' 4import { getAudioStream, getVideoStreamDimensionsInfo } from '@shared/ffmpeg'
5import { 5import {
6 cleanupTests, 6 cleanupTests,
7 createMultipleServers, 7 createMultipleServers,
diff --git a/server/tests/api/transcoding/transcoder.ts b/server/tests/api/transcoding/transcoder.ts
index c591f5f6f..fa78b58bb 100644
--- a/server/tests/api/transcoding/transcoder.ts
+++ b/server/tests/api/transcoding/transcoder.ts
@@ -1,18 +1,18 @@
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ 1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2 2
3import { expect } from 'chai' 3import { expect } from 'chai'
4import { canDoQuickTranscode } from '@server/helpers/ffmpeg' 4import { canDoQuickTranscode } from '@server/lib/transcoding/transcoding-quick-transcode'
5import { generateHighBitrateVideo, generateVideoWithFramerate } from '@server/tests/shared' 5import { checkWebTorrentWorks, generateHighBitrateVideo, generateVideoWithFramerate } from '@server/tests/shared'
6import { buildAbsoluteFixturePath, getAllFiles, getMaxBitrate, getMinLimitBitrate, omit } from '@shared/core-utils' 6import { buildAbsoluteFixturePath, getAllFiles, getMaxBitrate, getMinLimitBitrate, omit } from '@shared/core-utils'
7import { 7import {
8 buildFileMetadata, 8 ffprobePromise,
9 getAudioStream, 9 getAudioStream,
10 getVideoStreamBitrate, 10 getVideoStreamBitrate,
11 getVideoStreamDimensionsInfo, 11 getVideoStreamDimensionsInfo,
12 getVideoStreamFPS, 12 getVideoStreamFPS,
13 hasAudioStream 13 hasAudioStream
14} from '@shared/extra-utils' 14} from '@shared/ffmpeg'
15import { HttpStatusCode, VideoState } from '@shared/models' 15import { HttpStatusCode, VideoFileMetadata, VideoState } from '@shared/models'
16import { 16import {
17 cleanupTests, 17 cleanupTests,
18 createMultipleServers, 18 createMultipleServers,
@@ -20,8 +20,7 @@ import {
20 makeGetRequest, 20 makeGetRequest,
21 PeerTubeServer, 21 PeerTubeServer,
22 setAccessTokensToServers, 22 setAccessTokensToServers,
23 waitJobs, 23 waitJobs
24 webtorrentAdd
25} from '@shared/server-commands' 24} from '@shared/server-commands'
26 25
27function updateConfigForTranscoding (server: PeerTubeServer) { 26function updateConfigForTranscoding (server: PeerTubeServer) {
@@ -90,10 +89,7 @@ describe('Test video transcoding', function () {
90 const magnetUri = videoDetails.files[0].magnetUri 89 const magnetUri = videoDetails.files[0].magnetUri
91 expect(magnetUri).to.match(/\.webm/) 90 expect(magnetUri).to.match(/\.webm/)
92 91
93 const torrent = await webtorrentAdd(magnetUri, true) 92 await checkWebTorrentWorks(magnetUri, /\.webm$/)
94 expect(torrent.files).to.be.an('array')
95 expect(torrent.files.length).to.equal(1)
96 expect(torrent.files[0].path).match(/\.webm$/)
97 } 93 }
98 }) 94 })
99 95
@@ -120,10 +116,7 @@ describe('Test video transcoding', function () {
120 const magnetUri = videoDetails.files[0].magnetUri 116 const magnetUri = videoDetails.files[0].magnetUri
121 expect(magnetUri).to.match(/\.mp4/) 117 expect(magnetUri).to.match(/\.mp4/)
122 118
123 const torrent = await webtorrentAdd(magnetUri, true) 119 await checkWebTorrentWorks(magnetUri, /\.mp4$/)
124 expect(torrent.files).to.be.an('array')
125 expect(torrent.files.length).to.equal(1)
126 expect(torrent.files[0].path).match(/\.mp4$/)
127 } 120 }
128 }) 121 })
129 122
@@ -639,7 +632,9 @@ describe('Test video transcoding', function () {
639 const video = await servers[1].videos.get({ id: videoUUID }) 632 const video = await servers[1].videos.get({ id: videoUUID })
640 const file = video.files.find(f => f.resolution.id === 240) 633 const file = video.files.find(f => f.resolution.id === 240)
641 const path = servers[1].servers.buildWebTorrentFilePath(file.fileUrl) 634 const path = servers[1].servers.buildWebTorrentFilePath(file.fileUrl)
642 const metadata = await buildFileMetadata(path) 635
636 const probe = await ffprobePromise(path)
637 const metadata = new VideoFileMetadata(probe)
643 638
644 // expected format properties 639 // expected format properties
645 for (const p of [ 640 for (const p of [