aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/shared
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/shared')
-rw-r--r--server/tests/shared/live.ts17
1 files changed, 16 insertions, 1 deletions
diff --git a/server/tests/shared/live.ts b/server/tests/shared/live.ts
index 78e29f575..47e0dc481 100644
--- a/server/tests/shared/live.ts
+++ b/server/tests/shared/live.ts
@@ -7,10 +7,25 @@ import { LiveVideo, VideoStreamingPlaylistType } from '@shared/models'
7import { ObjectStorageCommand, PeerTubeServer } from '@shared/server-commands' 7import { ObjectStorageCommand, PeerTubeServer } from '@shared/server-commands'
8import { checkLiveSegmentHash, checkResolutionsInMasterPlaylist } from './streaming-playlists' 8import { checkLiveSegmentHash, checkResolutionsInMasterPlaylist } from './streaming-playlists'
9 9
10async function checkLiveCleanup (server: PeerTubeServer, videoUUID: string, savedResolutions: number[] = []) { 10async function checkLiveCleanup (options: {
11 server: PeerTubeServer
12 videoUUID: string
13 permanent: boolean
14 savedResolutions?: number[]
15}) {
16 const { server, videoUUID, permanent, savedResolutions = [] } = options
17
11 const basePath = server.servers.buildDirectory('streaming-playlists') 18 const basePath = server.servers.buildDirectory('streaming-playlists')
12 const hlsPath = join(basePath, 'hls', videoUUID) 19 const hlsPath = join(basePath, 'hls', videoUUID)
13 20
21 if (permanent) {
22 if (!await pathExists(hlsPath)) return
23
24 const files = await readdir(hlsPath)
25 expect(files).to.have.lengthOf(0)
26 return
27 }
28
14 if (savedResolutions.length === 0) { 29 if (savedResolutions.length === 0) {
15 return checkUnsavedLiveCleanup(server, videoUUID, hlsPath) 30 return checkUnsavedLiveCleanup(server, videoUUID, hlsPath)
16 } 31 }