diff options
author | Chocobozzz <me@florianbigard.com> | 2022-10-25 14:18:59 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-10-25 14:18:59 +0200 |
commit | aa887096f9a305568dc3a846d0c9cdf7e45f1c67 (patch) | |
tree | 5dc455d680ebdd24644ebe29b2f129afb903b421 /server/tests/shared | |
parent | 508c1b1e9f3b26752a961e945b7fa59b72b30827 (diff) | |
download | PeerTube-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.ts | 17 |
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' | |||
7 | import { ObjectStorageCommand, PeerTubeServer } from '@shared/server-commands' | 7 | import { ObjectStorageCommand, PeerTubeServer } from '@shared/server-commands' |
8 | import { checkLiveSegmentHash, checkResolutionsInMasterPlaylist } from './streaming-playlists' | 8 | import { checkLiveSegmentHash, checkResolutionsInMasterPlaylist } from './streaming-playlists' |
9 | 9 | ||
10 | async function checkLiveCleanup (server: PeerTubeServer, videoUUID: string, savedResolutions: number[] = []) { | 10 | async 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 | } |