import { expect } from 'chai'
import { pathExists, readdir } from 'fs-extra'
import { join } from 'path'
+import { sha1 } from '@shared/extra-utils'
import { LiveVideo, VideoStreamingPlaylistType } from '@shared/models'
import { ObjectStorageCommand, PeerTubeServer } from '@shared/server-commands'
import { checkLiveSegmentHash, checkResolutionsInMasterPlaylist } from './streaming-playlists'
-import { sha1 } from '@shared/extra-utils'
async function checkLiveCleanup (options: {
server: PeerTubeServer
liveVideoId: string
resolutions: number[]
transcoded: boolean
+
objectStorage: boolean
+ objectStorageBaseUrl?: string
}) {
- const { originServer, servers, liveVideoId, resolutions, transcoded, objectStorage } = options
+ const {
+ originServer,
+ servers,
+ liveVideoId,
+ resolutions,
+ transcoded,
+ objectStorage,
+ objectStorageBaseUrl = ObjectStorageCommand.getMockPlaylistBaseUrl()
+ } = options
for (const server of servers) {
const { data } = await server.videos.list()
})
if (objectStorage) {
- expect(hlsPlaylist.playlistUrl).to.contain(ObjectStorageCommand.getMockPlaylistBaseUrl())
+ expect(hlsPlaylist.playlistUrl).to.contain(objectStorageBaseUrl)
}
for (let i = 0; i < resolutions.length; i++) {
videoUUID: video.uuid,
playlistNumber: i,
segment: segmentNum,
- objectStorage
+ objectStorage,
+ objectStorageBaseUrl
})
const baseUrl = objectStorage
- ? ObjectStorageCommand.getMockPlaylistBaseUrl() + 'hls'
+ ? join(objectStorageBaseUrl, 'hls')
: originServer.url + '/static/streaming-playlists/hls'
if (objectStorage) {
- expect(hlsPlaylist.segmentsSha256Url).to.contain(ObjectStorageCommand.getMockPlaylistBaseUrl())
+ expect(hlsPlaylist.segmentsSha256Url).to.contain(objectStorageBaseUrl)
}
const subPlaylist = await originServer.streamingPlaylists.get({