]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Fix runner cleanup test
authorChocobozzz <me@florianbigard.com>
Fri, 19 May 2023 12:35:03 +0000 (14:35 +0200)
committerChocobozzz <me@florianbigard.com>
Fri, 19 May 2023 12:35:03 +0000 (14:35 +0200)
server/tests/peertube-runner/live-transcoding.ts
server/tests/peertube-runner/studio-transcoding.ts
server/tests/peertube-runner/vod-transcoding.ts
server/tests/shared/directories.ts
server/tests/shared/peertube-runner-process.ts

index c56f4cd84f676f1a48d348f770ad2ad16d0c0540..17e1f3078080d704e38d3ad1eb226de1e7f77180 100644 (file)
@@ -178,7 +178,7 @@ describe('Test Live transcoding in peertube-runner program', function () {
   describe('Check cleanup', function () {
 
     it('Should have an empty cache directory', async function () {
-      await checkPeerTubeRunnerCacheIsEmpty()
+      await checkPeerTubeRunnerCacheIsEmpty(peertubeRunner)
     })
   })
 
index f60b83dbd6a7a32e5c4601d15f39239cd39dd7a0..400203eb33b2a3f6be827648a0bc2def22814698 100644 (file)
@@ -103,7 +103,7 @@ describe('Test studio transcoding in peertube-runner program', function () {
   describe('Check cleanup', function () {
 
     it('Should have an empty cache directory', async function () {
-      await checkPeerTubeRunnerCacheIsEmpty()
+      await checkPeerTubeRunnerCacheIsEmpty(peertubeRunner)
     })
   })
 
index 02d839339ac5b4a08949523aa235f165cce96a46..f1670c1fb4943b4177c5aec6b67a2c8de8c3a56e 100644 (file)
@@ -189,7 +189,7 @@ describe('Test VOD transcoding in peertube-runner program', function () {
     })
 
     it('Should transcode videos on manual run', async function () {
-      this.timeout(240000)
+      this.timeout(360000)
 
       await servers[0].config.disableTranscoding()
 
@@ -329,7 +329,7 @@ describe('Test VOD transcoding in peertube-runner program', function () {
   describe('Check cleanup', function () {
 
     it('Should have an empty cache directory', async function () {
-      await checkPeerTubeRunnerCacheIsEmpty()
+      await checkPeerTubeRunnerCacheIsEmpty(peertubeRunner)
     })
   })
 
index 4f42825541c6d844afbe0843acbf2508fdaa6c9c..22578bc0e855d13d75cf27e4f79adc9ef4f14724 100644 (file)
@@ -5,6 +5,7 @@ import { pathExists, readdir } from 'fs-extra'
 import { homedir } from 'os'
 import { join } from 'path'
 import { PeerTubeServer } from '@shared/server-commands'
+import { PeerTubeRunnerProcess } from './peertube-runner-process'
 
 export async function checkTmpIsEmpty (server: PeerTubeServer) {
   await checkDirectoryIsEmpty(server, 'tmp', [ 'plugins-global.css', 'hls', 'resumable-uploads' ])
@@ -30,8 +31,8 @@ export async function checkDirectoryIsEmpty (server: PeerTubeServer, directory:
   expect(filtered).to.have.lengthOf(0)
 }
 
-export async function checkPeerTubeRunnerCacheIsEmpty () {
-  const directoryPath = join(homedir(), '.cache', 'peertube-runner-nodejs', 'test', 'transcoding')
+export async function checkPeerTubeRunnerCacheIsEmpty (runner: PeerTubeRunnerProcess) {
+  const directoryPath = join(homedir(), '.cache', 'peertube-runner-nodejs', runner.getId(), 'transcoding')
 
   const directoryExists = await pathExists(directoryPath)
   expect(directoryExists).to.be.true
index 6ad2cd1160829daa8128891185a82e7632346ba0..b3c8dfe0e8698a25e0aeb288d1e3441186ecf88c 100644 (file)
@@ -80,11 +80,15 @@ export class PeerTubeRunnerProcess {
     this.app = null
   }
 
+  getId () {
+    return 'test-' + this.server.internalServerNumber
+  }
+
   private getRunnerPath () {
     return join(root(), 'packages', 'peertube-runner', 'dist', 'peertube-runner.js')
   }
 
   private buildIdArg () {
-    return [ '--id', 'test-' + this.server.internalServerNumber ]
+    return [ '--id', this.getId() ]
   }
 }