aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-11-10 08:07:21 +0100
committerChocobozzz <me@florianbigard.com>2020-11-10 08:07:21 +0100
commit0b84383d488facc321b100f3280a872ee53e888b (patch)
tree8d6676ca07851adb35311597ee2b1bb6978f6c00 /server/tests/api
parentc1961762b31567057e32eb7432a6995a4a81075c (diff)
downloadPeerTube-0b84383d488facc321b100f3280a872ee53e888b.tar.gz
PeerTube-0b84383d488facc321b100f3280a872ee53e888b.tar.zst
PeerTube-0b84383d488facc321b100f3280a872ee53e888b.zip
Fix stat file size with HLS
Diffstat (limited to 'server/tests/api')
-rw-r--r--server/tests/api/server/stats.ts58
1 files changed, 52 insertions, 6 deletions
diff --git a/server/tests/api/server/stats.ts b/server/tests/api/server/stats.ts
index 637525ff8..0e77712cf 100644
--- a/server/tests/api/server/stats.ts
+++ b/server/tests/api/server/stats.ts
@@ -1,24 +1,26 @@
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 { ServerStats } from '../../../../shared/models/server/server-stats.model' 4import * as chai from 'chai'
6import { 5import {
7 cleanupTests, 6 cleanupTests,
8 createUser, 7 createUser,
9 doubleFollow, 8 doubleFollow,
10 flushAndRunMultipleServers, 9 flushAndRunMultipleServers,
11 follow, 10 follow,
12 ServerInfo, unfollow, 11 ServerInfo,
12 unfollow,
13 updateCustomSubConfig,
13 uploadVideo, 14 uploadVideo,
15 userLogin,
14 viewVideo, 16 viewVideo,
15 wait, 17 wait
16 userLogin
17} from '../../../../shared/extra-utils' 18} from '../../../../shared/extra-utils'
18import { setAccessTokensToServers } from '../../../../shared/extra-utils/index' 19import { setAccessTokensToServers } from '../../../../shared/extra-utils/index'
20import { waitJobs } from '../../../../shared/extra-utils/server/jobs'
19import { getStats } from '../../../../shared/extra-utils/server/stats' 21import { getStats } from '../../../../shared/extra-utils/server/stats'
20import { addVideoCommentThread } from '../../../../shared/extra-utils/videos/video-comments' 22import { addVideoCommentThread } from '../../../../shared/extra-utils/videos/video-comments'
21import { waitJobs } from '../../../../shared/extra-utils/server/jobs' 23import { ServerStats } from '../../../../shared/models/server/server-stats.model'
22 24
23const expect = chai.expect 25const expect = chai.expect
24 26
@@ -31,7 +33,9 @@ describe('Test stats (excluding redundancy)', function () {
31 33
32 before(async function () { 34 before(async function () {
33 this.timeout(60000) 35 this.timeout(60000)
36
34 servers = await flushAndRunMultipleServers(3) 37 servers = await flushAndRunMultipleServers(3)
38
35 await setAccessTokensToServers(servers) 39 await setAccessTokensToServers(servers)
36 40
37 await doubleFollow(servers[0], servers[1]) 41 await doubleFollow(servers[0], servers[1])
@@ -130,6 +134,48 @@ describe('Test stats (excluding redundancy)', function () {
130 } 134 }
131 }) 135 })
132 136
137 it('Should correctly count video file sizes if transcoding is enabled', async function () {
138 this.timeout(20000)
139
140 await updateCustomSubConfig(servers[0].url, servers[0].accessToken, {
141 transcoding: {
142 enabled: true,
143 webtorrent: {
144 enabled: true
145 },
146 hls: {
147 enabled: true
148 },
149 resolutions: {
150 '0p': false,
151 '240p': false,
152 '360p': false,
153 '480p': false,
154 '720p': false,
155 '1080p': false,
156 '2160p': false
157 }
158 }
159 })
160
161 await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'video', fixture: 'video_short.webm' })
162
163 await waitJobs(servers)
164
165 {
166 const res = await getStats(servers[1].url)
167 const data: ServerStats = res.body
168 expect(data.totalLocalVideoFilesSize).to.equal(0)
169 }
170
171 {
172 const res = await getStats(servers[0].url)
173 const data: ServerStats = res.body
174 expect(data.totalLocalVideoFilesSize).to.be.greaterThan(300000)
175 expect(data.totalLocalVideoFilesSize).to.be.lessThan(400000)
176 }
177 })
178
133 after(async function () { 179 after(async function () {
134 await cleanupTests(servers) 180 await cleanupTests(servers)
135 }) 181 })