diff options
author | Chocobozzz <me@florianbigard.com> | 2021-11-10 14:25:33 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-11-10 14:25:33 +0100 |
commit | d78b51aa4ed74bd2e6598b771fcff6391d7d9a3e (patch) | |
tree | 3d99cad8d7defde4bae179f1e32d56335dbf0fe2 /server/tests/api/videos/video-transcoder.ts | |
parent | 67eeec8b955339120ff5d3c8286fdf0715e6270c (diff) | |
download | PeerTube-d78b51aa4ed74bd2e6598b771fcff6391d7d9a3e.tar.gz PeerTube-d78b51aa4ed74bd2e6598b771fcff6391d7d9a3e.tar.zst PeerTube-d78b51aa4ed74bd2e6598b771fcff6391d7d9a3e.zip |
Fix tests
Diffstat (limited to 'server/tests/api/videos/video-transcoder.ts')
-rw-r--r-- | server/tests/api/videos/video-transcoder.ts | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/server/tests/api/videos/video-transcoder.ts b/server/tests/api/videos/video-transcoder.ts index b3226dbf7..7ed55b8e8 100644 --- a/server/tests/api/videos/video-transcoder.ts +++ b/server/tests/api/videos/video-transcoder.ts | |||
@@ -3,7 +3,7 @@ | |||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { omit } from 'lodash' | 5 | import { omit } from 'lodash' |
6 | import { getMaxBitrate } from '@shared/core-utils' | 6 | import { getMaxBitrate, getMinLimitBitrate } from '@shared/core-utils' |
7 | import { | 7 | import { |
8 | buildAbsoluteFixturePath, | 8 | buildAbsoluteFixturePath, |
9 | cleanupTests, | 9 | cleanupTests, |
@@ -583,7 +583,7 @@ describe('Test video transcoding', function () { | |||
583 | } | 583 | } |
584 | }) | 584 | }) |
585 | 585 | ||
586 | it('Should not transcode to an higher bitrate than the original file', async function () { | 586 | it('Should not transcode to an higher bitrate than the original file but above our low limit', async function () { |
587 | this.timeout(160_000) | 587 | this.timeout(160_000) |
588 | 588 | ||
589 | const newConfig = { | 589 | const newConfig = { |
@@ -622,7 +622,13 @@ describe('Test video transcoding', function () { | |||
622 | 622 | ||
623 | const path = servers[1].servers.buildWebTorrentFilePath(file.fileUrl) | 623 | const path = servers[1].servers.buildWebTorrentFilePath(file.fileUrl) |
624 | const bitrate = await getVideoFileBitrate(path) | 624 | const bitrate = await getVideoFileBitrate(path) |
625 | expect(bitrate, `${path} not below ${60_000}`).to.be.below(60_000) | 625 | |
626 | const inputBitrate = 60_000 | ||
627 | const limit = getMinLimitBitrate({ fps: 10, ratio: 1, resolution: r }) | ||
628 | let belowValue = Math.max(inputBitrate, limit) | ||
629 | belowValue += belowValue * 0.20 // Apply 20% margin because bitrate control is not very precise | ||
630 | |||
631 | expect(bitrate, `${path} not below ${limit}`).to.be.below(belowValue) | ||
626 | } | 632 | } |
627 | }) | 633 | }) |
628 | }) | 634 | }) |