diff options
author | Chocobozzz <me@florianbigard.com> | 2023-04-21 15:00:01 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2023-05-09 08:57:34 +0200 |
commit | d102de1b38f2877463529c3b27bd35ffef4fd8bf (patch) | |
tree | 31fa0bdf26ad7a2ee46d600d804a6f03260266c8 /server/tests/api/transcoding/transcoder.ts | |
parent | 2fe978744e5b74eb824e4d79c1bb9b840169f125 (diff) | |
download | PeerTube-d102de1b38f2877463529c3b27bd35ffef4fd8bf.tar.gz PeerTube-d102de1b38f2877463529c3b27bd35ffef4fd8bf.tar.zst PeerTube-d102de1b38f2877463529c3b27bd35ffef4fd8bf.zip |
Add runner server tests
Diffstat (limited to 'server/tests/api/transcoding/transcoder.ts')
-rw-r--r-- | server/tests/api/transcoding/transcoder.ts | 27 |
1 files changed, 11 insertions, 16 deletions
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 | ||
3 | import { expect } from 'chai' | 3 | import { expect } from 'chai' |
4 | import { canDoQuickTranscode } from '@server/helpers/ffmpeg' | 4 | import { canDoQuickTranscode } from '@server/lib/transcoding/transcoding-quick-transcode' |
5 | import { generateHighBitrateVideo, generateVideoWithFramerate } from '@server/tests/shared' | 5 | import { checkWebTorrentWorks, generateHighBitrateVideo, generateVideoWithFramerate } from '@server/tests/shared' |
6 | import { buildAbsoluteFixturePath, getAllFiles, getMaxBitrate, getMinLimitBitrate, omit } from '@shared/core-utils' | 6 | import { buildAbsoluteFixturePath, getAllFiles, getMaxBitrate, getMinLimitBitrate, omit } from '@shared/core-utils' |
7 | import { | 7 | import { |
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' |
15 | import { HttpStatusCode, VideoState } from '@shared/models' | 15 | import { HttpStatusCode, VideoFileMetadata, VideoState } from '@shared/models' |
16 | import { | 16 | import { |
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 | ||
27 | function updateConfigForTranscoding (server: PeerTubeServer) { | 26 | function 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 [ |