aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/cli
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-08-17 10:33:36 +0200
committerChocobozzz <me@florianbigard.com>2021-08-17 10:33:36 +0200
commit66a7fc947321b923fa1e7182202e03d0e21ffb3e (patch)
tree5cb913531d3b84d0f2d4bbcc0d34f0a9a6435bc5 /server/tests/cli
parent0305db28c98fd6cf43a3c50ba92c76215e99d512 (diff)
downloadPeerTube-66a7fc947321b923fa1e7182202e03d0e21ffb3e.tar.gz
PeerTube-66a7fc947321b923fa1e7182202e03d0e21ffb3e.tar.zst
PeerTube-66a7fc947321b923fa1e7182202e03d0e21ffb3e.zip
Remove optimize old videos script
It is not compatible with HLS and I don't have time to maintain it
Diffstat (limited to 'server/tests/cli')
-rw-r--r--server/tests/cli/index.ts1
-rw-r--r--server/tests/cli/optimize-old-videos.ts96
2 files changed, 0 insertions, 97 deletions
diff --git a/server/tests/cli/index.ts b/server/tests/cli/index.ts
index 7e6eebd17..c6dd0581a 100644
--- a/server/tests/cli/index.ts
+++ b/server/tests/cli/index.ts
@@ -1,7 +1,6 @@
1// Order of the tests we want to execute 1// Order of the tests we want to execute
2import './create-import-video-file-job' 2import './create-import-video-file-job'
3import './create-transcoding-job' 3import './create-transcoding-job'
4import './optimize-old-videos'
5import './peertube' 4import './peertube'
6import './plugins' 5import './plugins'
7import './print-transcode-command' 6import './print-transcode-command'
diff --git a/server/tests/cli/optimize-old-videos.ts b/server/tests/cli/optimize-old-videos.ts
deleted file mode 100644
index 9b75ae164..000000000
--- a/server/tests/cli/optimize-old-videos.ts
+++ /dev/null
@@ -1,96 +0,0 @@
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2
3import 'mocha'
4import * as chai from 'chai'
5import { getMaxBitrate } from '@shared/core-utils'
6import {
7 cleanupTests,
8 createMultipleServers,
9 doubleFollow,
10 generateHighBitrateVideo,
11 PeerTubeServer,
12 setAccessTokensToServers,
13 wait,
14 waitJobs
15} from '@shared/extra-utils'
16import { getVideoFileBitrate, getVideoFileFPS, getVideoFileResolution } from '../../helpers/ffprobe-utils'
17
18const expect = chai.expect
19
20describe('Test optimize old videos', function () {
21 let servers: PeerTubeServer[] = []
22
23 before(async function () {
24 this.timeout(200000)
25
26 // Run server 2 to have transcoding enabled
27 servers = await createMultipleServers(2)
28 await setAccessTokensToServers(servers)
29
30 await doubleFollow(servers[0], servers[1])
31
32 const tempFixturePath = await generateHighBitrateVideo()
33
34 // Upload two videos for our needs
35 await servers[0].videos.upload({ attributes: { name: 'video1', fixture: tempFixturePath } })
36 await servers[0].videos.upload({ attributes: { name: 'video2', fixture: tempFixturePath } })
37
38 await waitJobs(servers)
39 })
40
41 it('Should have two video files on each server', async function () {
42 this.timeout(30000)
43
44 for (const server of servers) {
45 const { data } = await server.videos.list()
46 expect(data).to.have.lengthOf(2)
47
48 for (const video of data) {
49 const videoDetails = await server.videos.get({ id: video.uuid })
50 expect(videoDetails.files).to.have.lengthOf(1)
51 }
52 }
53 })
54
55 it('Should run optimize script', async function () {
56 this.timeout(200000)
57
58 await servers[0].cli.execWithEnv('npm run optimize-old-videos')
59 await waitJobs(servers)
60
61 for (const server of servers) {
62 const { data } = await server.videos.list()
63 expect(data).to.have.lengthOf(2)
64
65 for (const video of data) {
66 await server.videos.view({ id: video.uuid })
67
68 // Refresh video
69 await waitJobs(servers)
70 await wait(5000)
71 await waitJobs(servers)
72
73 const videoDetails = await server.videos.get({ id: video.uuid })
74
75 expect(videoDetails.files).to.have.lengthOf(1)
76 const file = videoDetails.files[0]
77
78 expect(file.size).to.be.below(8000000)
79
80 const path = servers[0].servers.buildWebTorrentFilePath(file.fileUrl)
81 const bitrate = await getVideoFileBitrate(path)
82 const fps = await getVideoFileFPS(path)
83 const data = await getVideoFileResolution(path)
84
85 expect(data.resolution).to.equal(file.resolution.id)
86
87 const maxBitrate = getMaxBitrate({ ...data, fps })
88 expect(bitrate).to.be.below(maxBitrate)
89 }
90 }
91 })
92
93 after(async function () {
94 await cleanupTests(servers)
95 })
96})