aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/shared
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-10-25 14:18:59 +0200
committerChocobozzz <me@florianbigard.com>2022-10-25 14:18:59 +0200
commitaa887096f9a305568dc3a846d0c9cdf7e45f1c67 (patch)
tree5dc455d680ebdd24644ebe29b2f129afb903b421 /server/tests/shared
parent508c1b1e9f3b26752a961e945b7fa59b72b30827 (diff)
downloadPeerTube-aa887096f9a305568dc3a846d0c9cdf7e45f1c67.tar.gz
PeerTube-aa887096f9a305568dc3a846d0c9cdf7e45f1c67.tar.zst
PeerTube-aa887096f9a305568dc3a846d0c9cdf7e45f1c67.zip
Correctly delete live files from object storage
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 }