aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/videos
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/videos')
-rw-r--r--server/tests/api/videos/multiple-servers.ts13
-rw-r--r--server/tests/api/videos/video-transcoder.ts12
2 files changed, 18 insertions, 7 deletions
diff --git a/server/tests/api/videos/multiple-servers.ts b/server/tests/api/videos/multiple-servers.ts
index 9c255c1c5..470bee45b 100644
--- a/server/tests/api/videos/multiple-servers.ts
+++ b/server/tests/api/videos/multiple-servers.ts
@@ -591,7 +591,9 @@ describe('Test multiple servers', function () {
591 }) 591 })
592 592
593 describe('Should manipulate these videos', function () { 593 describe('Should manipulate these videos', function () {
594 it('Should update the video 3 by asking server 3', async function () { 594 let updatedAtMin: Date
595
596 it('Should update video 3', async function () {
595 this.timeout(10000) 597 this.timeout(10000)
596 598
597 const attributes = { 599 const attributes = {
@@ -608,6 +610,7 @@ describe('Test multiple servers', function () {
608 previewfile: 'preview.jpg' 610 previewfile: 'preview.jpg'
609 } 611 }
610 612
613 updatedAtMin = new Date()
611 await servers[2].videos.update({ id: toRemove[0].id, attributes }) 614 await servers[2].videos.update({ id: toRemove[0].id, attributes })
612 615
613 await waitJobs(servers) 616 await waitJobs(servers)
@@ -622,6 +625,8 @@ describe('Test multiple servers', function () {
622 const videoUpdated = data.find(video => video.name === 'my super video updated') 625 const videoUpdated = data.find(video => video.name === 'my super video updated')
623 expect(!!videoUpdated).to.be.true 626 expect(!!videoUpdated).to.be.true
624 627
628 expect(new Date(videoUpdated.updatedAt)).to.be.greaterThan(updatedAtMin)
629
625 const isLocal = server.url === 'http://localhost:' + servers[2].port 630 const isLocal = server.url === 'http://localhost:' + servers[2].port
626 const checkAttributes = { 631 const checkAttributes = {
627 name: 'my super video updated', 632 name: 'my super video updated',
@@ -1024,15 +1029,15 @@ describe('Test multiple servers', function () {
1024 files: [ 1029 files: [
1025 { 1030 {
1026 resolution: 720, 1031 resolution: 720,
1027 size: 59000 1032 size: 61000
1028 }, 1033 },
1029 { 1034 {
1030 resolution: 480, 1035 resolution: 480,
1031 size: 34000 1036 size: 40000
1032 }, 1037 },
1033 { 1038 {
1034 resolution: 360, 1039 resolution: 360,
1035 size: 31000 1040 size: 32000
1036 }, 1041 },
1037 { 1042 {
1038 resolution: 240, 1043 resolution: 240,
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 @@
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { omit } from 'lodash' 5import { omit } from 'lodash'
6import { getMaxBitrate } from '@shared/core-utils' 6import { getMaxBitrate, getMinLimitBitrate } from '@shared/core-utils'
7import { 7import {
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 })