From ca5c612bfdd225433bcc6ace01c8024df3f674ba Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 24 Nov 2020 15:22:56 +0100 Subject: Add live transcoding bit rate tests --- server/tests/cli/optimize-old-videos.ts | 4 ++-- server/tests/cli/prune-storage.ts | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'server/tests/cli') 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' import * as chai from 'chai' import { join } from 'path' import { + buildServerDirectory, cleanupTests, doubleFollow, execCLI, @@ -12,7 +13,6 @@ import { getEnvCli, getVideo, getVideosList, - root, ServerInfo, setAccessTokensToServers, uploadVideo, @@ -100,7 +100,7 @@ describe('Test optimize old videos', function () { expect(file.size).to.be.below(8000000) - const path = join(root(), 'test' + servers[0].internalServerNumber, 'videos', video.uuid + '-' + file.resolution.id + '.mp4') + const path = buildServerDirectory(servers[0], join('videos', video.uuid + '-' + file.resolution.id + '.mp4')) const bitrate = await getVideoFileBitrate(path) const fps = await getVideoFileFPS(path) 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' const expect = chai.expect async function countFiles (internalServerNumber: number, directory: string) { - const files = await readdir(buildServerDirectory(internalServerNumber, directory)) + const files = await readdir(buildServerDirectory({ internalServerNumber }, directory)) return files.length } async function assertNotExists (internalServerNumber: number, directory: string, substring: string) { - const files = await readdir(buildServerDirectory(internalServerNumber, directory)) + const files = await readdir(buildServerDirectory({ internalServerNumber }, directory)) for (const f of files) { expect(f).to.not.contain(substring) @@ -124,7 +124,7 @@ describe('Test prune storage scripts', function () { it('Should create some dirty files', async function () { for (let i = 0; i < 2; i++) { { - const base = buildServerDirectory(servers[0].internalServerNumber, 'videos') + const base = buildServerDirectory(servers[0], 'videos') const n1 = uuidv4() + '.mp4' const n2 = uuidv4() + '.webm' @@ -136,7 +136,7 @@ describe('Test prune storage scripts', function () { } { - const base = buildServerDirectory(servers[0].internalServerNumber, 'torrents') + const base = buildServerDirectory(servers[0], 'torrents') const n1 = uuidv4() + '-240.torrent' const n2 = uuidv4() + '-480.torrent' @@ -148,7 +148,7 @@ describe('Test prune storage scripts', function () { } { - const base = buildServerDirectory(servers[0].internalServerNumber, 'thumbnails') + const base = buildServerDirectory(servers[0], 'thumbnails') const n1 = uuidv4() + '.jpg' const n2 = uuidv4() + '.jpg' @@ -160,7 +160,7 @@ describe('Test prune storage scripts', function () { } { - const base = buildServerDirectory(servers[0].internalServerNumber, 'previews') + const base = buildServerDirectory(servers[0], 'previews') const n1 = uuidv4() + '.jpg' const n2 = uuidv4() + '.jpg' @@ -172,7 +172,7 @@ describe('Test prune storage scripts', function () { } { - const base = buildServerDirectory(servers[0].internalServerNumber, 'avatars') + const base = buildServerDirectory(servers[0], 'avatars') const n1 = uuidv4() + '.png' const n2 = uuidv4() + '.jpg' -- cgit v1.2.3