diff options
author | Chocobozzz <me@florianbigard.com> | 2021-12-17 11:58:15 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-12-17 12:24:03 +0100 |
commit | c55e3d7227fe1453869e309025996b9d75256d5d (patch) | |
tree | 08e9b0ca210d75c82c8606fef0852eca020e8e0e /shared/server-commands/videos/live.ts | |
parent | bf54587a3e2ad9c2c186828f2a5682b91ee2cc00 (diff) | |
download | PeerTube-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.ts | 41 |
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 | |||
3 | import { expect } from 'chai' | ||
4 | import ffmpeg, { FfmpegCommand } from 'fluent-ffmpeg' | 1 | import ffmpeg, { FfmpegCommand } from 'fluent-ffmpeg' |
5 | import { pathExists, readdir } from 'fs-extra' | 2 | import { buildAbsoluteFixturePath, wait } from '@shared/core-utils' |
6 | import { join } from 'path' | ||
7 | import { buildAbsoluteFixturePath, wait } from '../miscs' | ||
8 | import { PeerTubeServer } from '../server/server' | 3 | import { PeerTubeServer } from '../server/server' |
9 | 4 | ||
10 | function sendRTMPStream (options: { | 5 | function sendRTMPStream (options: { |
@@ -95,43 +90,11 @@ async function waitUntilLiveSavedOnAllServers (servers: PeerTubeServer[], videoI | |||
95 | } | 90 | } |
96 | } | 91 | } |
97 | 92 | ||
98 | async 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 | |||
129 | export { | 93 | export { |
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 | } |