aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/server-commands/videos/live.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-12-17 11:58:15 +0100
committerChocobozzz <me@florianbigard.com>2021-12-17 12:24:03 +0100
commitc55e3d7227fe1453869e309025996b9d75256d5d (patch)
tree08e9b0ca210d75c82c8606fef0852eca020e8e0e /shared/server-commands/videos/live.ts
parentbf54587a3e2ad9c2c186828f2a5682b91ee2cc00 (diff)
downloadPeerTube-c55e3d7227fe1453869e309025996b9d75256d5d.tar.gz
PeerTube-c55e3d7227fe1453869e309025996b9d75256d5d.tar.zst
PeerTube-c55e3d7227fe1453869e309025996b9d75256d5d.zip
Move test functions outside extra-utils
Diffstat (limited to 'shared/server-commands/videos/live.ts')
-rw-r--r--shared/server-commands/videos/live.ts41
1 files changed, 2 insertions, 39 deletions
diff --git a/shared/server-commands/videos/live.ts b/shared/server-commands/videos/live.ts
index d3665bc90..7a7faa911 100644
--- a/shared/server-commands/videos/live.ts
+++ b/shared/server-commands/videos/live.ts
@@ -1,10 +1,5 @@
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2
3import { expect } from 'chai'
4import ffmpeg, { FfmpegCommand } from 'fluent-ffmpeg' 1import ffmpeg, { FfmpegCommand } from 'fluent-ffmpeg'
5import { pathExists, readdir } from 'fs-extra' 2import { buildAbsoluteFixturePath, wait } from '@shared/core-utils'
6import { join } from 'path'
7import { buildAbsoluteFixturePath, wait } from '../miscs'
8import { PeerTubeServer } from '../server/server' 3import { PeerTubeServer } from '../server/server'
9 4
10function sendRTMPStream (options: { 5function sendRTMPStream (options: {
@@ -95,43 +90,11 @@ async function waitUntilLiveSavedOnAllServers (servers: PeerTubeServer[], videoI
95 } 90 }
96} 91}
97 92
98async function checkLiveCleanupAfterSave (server: PeerTubeServer, videoUUID: string, resolutions: number[] = []) {
99 const basePath = server.servers.buildDirectory('streaming-playlists')
100 const hlsPath = join(basePath, 'hls', videoUUID)
101
102 if (resolutions.length === 0) {
103 const result = await pathExists(hlsPath)
104 expect(result).to.be.false
105
106 return
107 }
108
109 const files = await readdir(hlsPath)
110
111 // fragmented file and playlist per resolution + master playlist + segments sha256 json file
112 expect(files).to.have.lengthOf(resolutions.length * 2 + 2)
113
114 for (const resolution of resolutions) {
115 const fragmentedFile = files.find(f => f.endsWith(`-${resolution}-fragmented.mp4`))
116 expect(fragmentedFile).to.exist
117
118 const playlistFile = files.find(f => f.endsWith(`${resolution}.m3u8`))
119 expect(playlistFile).to.exist
120 }
121
122 const masterPlaylistFile = files.find(f => f.endsWith('-master.m3u8'))
123 expect(masterPlaylistFile).to.exist
124
125 const shaFile = files.find(f => f.endsWith('-segments-sha256.json'))
126 expect(shaFile).to.exist
127}
128
129export { 93export {
130 sendRTMPStream, 94 sendRTMPStream,
131 waitFfmpegUntilError, 95 waitFfmpegUntilError,
132 testFfmpegStreamError, 96 testFfmpegStreamError,
133 stopFfmpeg, 97 stopFfmpeg,
134 waitUntilLivePublishedOnAllServers, 98 waitUntilLivePublishedOnAllServers,
135 waitUntilLiveSavedOnAllServers, 99 waitUntilLiveSavedOnAllServers
136 checkLiveCleanupAfterSave
137} 100}