aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/redundancy/redundancy.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/redundancy/redundancy.ts')
-rw-r--r--server/tests/api/redundancy/redundancy.ts27
1 files changed, 14 insertions, 13 deletions
diff --git a/server/tests/api/redundancy/redundancy.ts b/server/tests/api/redundancy/redundancy.ts
index 8da0ba72a..811dc8c55 100644
--- a/server/tests/api/redundancy/redundancy.ts
+++ b/server/tests/api/redundancy/redundancy.ts
@@ -1,8 +1,11 @@
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 * as chai from 'chai'
4import 'mocha' 3import 'mocha'
5import { VideoDetails } from '../../../../shared/models/videos' 4import * as chai from 'chai'
5import { readdir } from 'fs-extra'
6import * as magnetUtil from 'magnet-uri'
7import { join } from 'path'
8import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
6import { 9import {
7 checkSegmentHash, 10 checkSegmentHash,
8 checkVideoFilesWereRemoved, 11 checkVideoFilesWereRemoved,
@@ -21,29 +24,23 @@ import {
21 ServerInfo, 24 ServerInfo,
22 setAccessTokensToServers, 25 setAccessTokensToServers,
23 unfollow, 26 unfollow,
24 updateCustomConfig,
25 updateCustomSubConfig,
26 uploadVideo, 27 uploadVideo,
27 viewVideo, 28 viewVideo,
28 wait, 29 wait,
29 waitUntilLog 30 waitUntilLog
30} from '../../../../shared/extra-utils' 31} from '../../../../shared/extra-utils'
31import { waitJobs } from '../../../../shared/extra-utils/server/jobs' 32import { waitJobs } from '../../../../shared/extra-utils/server/jobs'
32
33import * as magnetUtil from 'magnet-uri'
34import { 33import {
35 addVideoRedundancy, 34 addVideoRedundancy,
36 listVideoRedundancies, 35 listVideoRedundancies,
37 removeVideoRedundancy, 36 removeVideoRedundancy,
38 updateRedundancy 37 updateRedundancy
39} from '../../../../shared/extra-utils/server/redundancy' 38} from '../../../../shared/extra-utils/server/redundancy'
39import { getStats } from '../../../../shared/extra-utils/server/stats'
40import { ActorFollow } from '../../../../shared/models/actors' 40import { ActorFollow } from '../../../../shared/models/actors'
41import { readdir } from 'fs-extra'
42import { join } from 'path'
43import { VideoRedundancy, VideoRedundancyStrategy, VideoRedundancyStrategyWithManual } from '../../../../shared/models/redundancy' 41import { VideoRedundancy, VideoRedundancyStrategy, VideoRedundancyStrategyWithManual } from '../../../../shared/models/redundancy'
44import { getStats } from '../../../../shared/extra-utils/server/stats'
45import { ServerStats } from '../../../../shared/models/server/server-stats.model' 42import { ServerStats } from '../../../../shared/models/server/server-stats.model'
46import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' 43import { VideoDetails } from '../../../../shared/models/videos'
47 44
48const expect = chai.expect 45const expect = chai.expect
49 46
@@ -258,11 +255,11 @@ async function checkStatsGlobal (strategy: VideoRedundancyStrategyWithManual) {
258 return stat 255 return stat
259} 256}
260 257
261async function checkStatsWith1Redundancy (strategy: VideoRedundancyStrategyWithManual) { 258async function checkStatsWith1Redundancy (strategy: VideoRedundancyStrategyWithManual, onlyHls = false) {
262 const stat = await checkStatsGlobal(strategy) 259 const stat = await checkStatsGlobal(strategy)
263 260
264 expect(stat.totalUsed).to.be.at.least(1).and.below(409601) 261 expect(stat.totalUsed).to.be.at.least(1).and.below(409601)
265 expect(stat.totalVideoFiles).to.equal(4) 262 expect(stat.totalVideoFiles).to.equal(onlyHls ? 4 : 8)
266 expect(stat.totalVideos).to.equal(1) 263 expect(stat.totalVideos).to.equal(1)
267} 264}
268 265
@@ -519,7 +516,7 @@ describe('Test videos redundancy', function () {
519 await waitJobs(servers) 516 await waitJobs(servers)
520 517
521 await check1PlaylistRedundancies() 518 await check1PlaylistRedundancies()
522 await checkStatsWith1Redundancy(strategy) 519 await checkStatsWith1Redundancy(strategy, true)
523 }) 520 })
524 521
525 it('Should remove the video and the redundancy files', async function () { 522 it('Should remove the video and the redundancy files', async function () {
@@ -533,6 +530,10 @@ describe('Test videos redundancy', function () {
533 await checkVideoFilesWereRemoved(video1Server2UUID, server.internalServerNumber) 530 await checkVideoFilesWereRemoved(video1Server2UUID, server.internalServerNumber)
534 } 531 }
535 }) 532 })
533
534 after(async function () {
535 await cleanupTests(servers)
536 })
536 }) 537 })
537 538
538 describe('With manual strategy', function () { 539 describe('With manual strategy', function () {