diff options
author | Chocobozzz <me@florianbigard.com> | 2020-11-24 15:22:56 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-11-25 10:07:51 +0100 |
commit | ca5c612bfdd225433bcc6ace01c8024df3f674ba (patch) | |
tree | 1b722cc346c9079c65338f0792ce7bcd2a20f8a0 /server/tests/cli | |
parent | 5a547f69d5dc5867e253f7721513479c754b4f15 (diff) | |
download | PeerTube-ca5c612bfdd225433bcc6ace01c8024df3f674ba.tar.gz PeerTube-ca5c612bfdd225433bcc6ace01c8024df3f674ba.tar.zst PeerTube-ca5c612bfdd225433bcc6ace01c8024df3f674ba.zip |
Add live transcoding bit rate tests
Diffstat (limited to 'server/tests/cli')
-rw-r--r-- | server/tests/cli/optimize-old-videos.ts | 4 | ||||
-rw-r--r-- | server/tests/cli/prune-storage.ts | 14 |
2 files changed, 9 insertions, 9 deletions
diff --git a/server/tests/cli/optimize-old-videos.ts b/server/tests/cli/optimize-old-videos.ts index 420fb8049..91a1c9cc4 100644 --- a/server/tests/cli/optimize-old-videos.ts +++ b/server/tests/cli/optimize-old-videos.ts | |||
@@ -4,6 +4,7 @@ import 'mocha' | |||
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { join } from 'path' | 5 | import { join } from 'path' |
6 | import { | 6 | import { |
7 | buildServerDirectory, | ||
7 | cleanupTests, | 8 | cleanupTests, |
8 | doubleFollow, | 9 | doubleFollow, |
9 | execCLI, | 10 | execCLI, |
@@ -12,7 +13,6 @@ import { | |||
12 | getEnvCli, | 13 | getEnvCli, |
13 | getVideo, | 14 | getVideo, |
14 | getVideosList, | 15 | getVideosList, |
15 | root, | ||
16 | ServerInfo, | 16 | ServerInfo, |
17 | setAccessTokensToServers, | 17 | setAccessTokensToServers, |
18 | uploadVideo, | 18 | uploadVideo, |
@@ -100,7 +100,7 @@ describe('Test optimize old videos', function () { | |||
100 | 100 | ||
101 | expect(file.size).to.be.below(8000000) | 101 | expect(file.size).to.be.below(8000000) |
102 | 102 | ||
103 | const path = join(root(), 'test' + servers[0].internalServerNumber, 'videos', video.uuid + '-' + file.resolution.id + '.mp4') | 103 | const path = buildServerDirectory(servers[0], join('videos', video.uuid + '-' + file.resolution.id + '.mp4')) |
104 | const bitrate = await getVideoFileBitrate(path) | 104 | const bitrate = await getVideoFileBitrate(path) |
105 | const fps = await getVideoFileFPS(path) | 105 | const fps = await getVideoFileFPS(path) |
106 | const resolution = await getVideoFileResolution(path) | 106 | const resolution = await getVideoFileResolution(path) |
diff --git a/server/tests/cli/prune-storage.ts b/server/tests/cli/prune-storage.ts index 6cda80070..052a5f91e 100644 --- a/server/tests/cli/prune-storage.ts +++ b/server/tests/cli/prune-storage.ts | |||
@@ -28,13 +28,13 @@ import { join } from 'path' | |||
28 | const expect = chai.expect | 28 | const expect = chai.expect |
29 | 29 | ||
30 | async function countFiles (internalServerNumber: number, directory: string) { | 30 | async function countFiles (internalServerNumber: number, directory: string) { |
31 | const files = await readdir(buildServerDirectory(internalServerNumber, directory)) | 31 | const files = await readdir(buildServerDirectory({ internalServerNumber }, directory)) |
32 | 32 | ||
33 | return files.length | 33 | return files.length |
34 | } | 34 | } |
35 | 35 | ||
36 | async function assertNotExists (internalServerNumber: number, directory: string, substring: string) { | 36 | async function assertNotExists (internalServerNumber: number, directory: string, substring: string) { |
37 | const files = await readdir(buildServerDirectory(internalServerNumber, directory)) | 37 | const files = await readdir(buildServerDirectory({ internalServerNumber }, directory)) |
38 | 38 | ||
39 | for (const f of files) { | 39 | for (const f of files) { |
40 | expect(f).to.not.contain(substring) | 40 | expect(f).to.not.contain(substring) |
@@ -124,7 +124,7 @@ describe('Test prune storage scripts', function () { | |||
124 | it('Should create some dirty files', async function () { | 124 | it('Should create some dirty files', async function () { |
125 | for (let i = 0; i < 2; i++) { | 125 | for (let i = 0; i < 2; i++) { |
126 | { | 126 | { |
127 | const base = buildServerDirectory(servers[0].internalServerNumber, 'videos') | 127 | const base = buildServerDirectory(servers[0], 'videos') |
128 | 128 | ||
129 | const n1 = uuidv4() + '.mp4' | 129 | const n1 = uuidv4() + '.mp4' |
130 | const n2 = uuidv4() + '.webm' | 130 | const n2 = uuidv4() + '.webm' |
@@ -136,7 +136,7 @@ describe('Test prune storage scripts', function () { | |||
136 | } | 136 | } |
137 | 137 | ||
138 | { | 138 | { |
139 | const base = buildServerDirectory(servers[0].internalServerNumber, 'torrents') | 139 | const base = buildServerDirectory(servers[0], 'torrents') |
140 | 140 | ||
141 | const n1 = uuidv4() + '-240.torrent' | 141 | const n1 = uuidv4() + '-240.torrent' |
142 | const n2 = uuidv4() + '-480.torrent' | 142 | const n2 = uuidv4() + '-480.torrent' |
@@ -148,7 +148,7 @@ describe('Test prune storage scripts', function () { | |||
148 | } | 148 | } |
149 | 149 | ||
150 | { | 150 | { |
151 | const base = buildServerDirectory(servers[0].internalServerNumber, 'thumbnails') | 151 | const base = buildServerDirectory(servers[0], 'thumbnails') |
152 | 152 | ||
153 | const n1 = uuidv4() + '.jpg' | 153 | const n1 = uuidv4() + '.jpg' |
154 | const n2 = uuidv4() + '.jpg' | 154 | const n2 = uuidv4() + '.jpg' |
@@ -160,7 +160,7 @@ describe('Test prune storage scripts', function () { | |||
160 | } | 160 | } |
161 | 161 | ||
162 | { | 162 | { |
163 | const base = buildServerDirectory(servers[0].internalServerNumber, 'previews') | 163 | const base = buildServerDirectory(servers[0], 'previews') |
164 | 164 | ||
165 | const n1 = uuidv4() + '.jpg' | 165 | const n1 = uuidv4() + '.jpg' |
166 | const n2 = uuidv4() + '.jpg' | 166 | const n2 = uuidv4() + '.jpg' |
@@ -172,7 +172,7 @@ describe('Test prune storage scripts', function () { | |||
172 | } | 172 | } |
173 | 173 | ||
174 | { | 174 | { |
175 | const base = buildServerDirectory(servers[0].internalServerNumber, 'avatars') | 175 | const base = buildServerDirectory(servers[0], 'avatars') |
176 | 176 | ||
177 | const n1 = uuidv4() + '.png' | 177 | const n1 = uuidv4() + '.png' |
178 | const n2 = uuidv4() + '.jpg' | 178 | const n2 = uuidv4() + '.jpg' |