]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/cli/optimize-old-videos.ts
Correctly notify on auto blacklist
[github/Chocobozzz/PeerTube.git] / server / tests / cli / optimize-old-videos.ts
index 6f6bc25a635393cfd87a2c78bdb470234ff45640..fa82f962cbda794104de050da77c00f7a2d8dc4e 100644 (file)
@@ -4,21 +4,24 @@ import 'mocha'
 import * as chai from 'chai'
 import { getMaxBitrate, Video, VideoDetails, VideoResolution } from '../../../shared/models/videos'
 import {
+  cleanupTests,
   doubleFollow,
   execCLI,
   flushAndRunMultipleServers,
-  flushTests, generateHighBitrateVideo,
+  generateHighBitrateVideo,
   getEnvCli,
   getVideo,
   getVideosList,
-  killallServers, root,
+  root,
   ServerInfo,
   setAccessTokensToServers,
-  uploadVideo, viewVideo, wait
-} from '../../../shared/utils'
-import { waitJobs } from '../../../shared/utils/server/jobs'
+  uploadVideo,
+  viewVideo,
+  wait
+} from '../../../shared/extra-utils'
+import { waitJobs } from '../../../shared/extra-utils/server/jobs'
 import { getVideoFileBitrate, getVideoFileFPS, getVideoFileResolution } from '../../helpers/ffmpeg-utils'
-import { VIDEO_TRANSCODING_FPS } from '../../initializers'
+import { VIDEO_TRANSCODING_FPS } from '../../initializers/constants'
 import { join } from 'path'
 
 const expect = chai.expect
@@ -31,8 +34,6 @@ describe('Test optimize old videos', function () {
   before(async function () {
     this.timeout(200000)
 
-    await flushTests()
-
     // Run server 2 to have transcoding enabled
     servers = await flushAndRunMultipleServers(2)
     await setAccessTokensToServers(servers)
@@ -74,7 +75,7 @@ describe('Test optimize old videos', function () {
   })
 
   it('Should run optimize script', async function () {
-    this.timeout(120000)
+    this.timeout(200000)
 
     const env = getEnvCli(servers[0])
     await execCLI(`${env} npm run optimize-old-videos`)
@@ -103,7 +104,7 @@ describe('Test optimize old videos', function () {
 
         expect(file.size).to.be.below(5000000)
 
-        const path = join(root(), 'test1', 'videos', video.uuid + '-' + file.resolution.id + '.mp4')
+        const path = join(root(), 'test' + servers[0].internalServerNumber, 'videos', video.uuid + '-' + file.resolution.id + '.mp4')
         const bitrate = await getVideoFileBitrate(path)
         const fps = await getVideoFileFPS(path)
         const resolution = await getVideoFileResolution(path)
@@ -115,6 +116,6 @@ describe('Test optimize old videos', function () {
   })
 
   after(async function () {
-    killallServers(servers)
+    await cleanupTests(servers)
   })
 })