mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-02-25 18:55:32 -06:00
Fix live with base url object storage
This commit is contained in:
@@ -3,10 +3,10 @@
|
||||
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
|
||||
@@ -42,9 +42,19 @@ async function testVideoResolutions (options: {
|
||||
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()
|
||||
@@ -66,7 +76,7 @@ async function testVideoResolutions (options: {
|
||||
})
|
||||
|
||||
if (objectStorage) {
|
||||
expect(hlsPlaylist.playlistUrl).to.contain(ObjectStorageCommand.getMockPlaylistBaseUrl())
|
||||
expect(hlsPlaylist.playlistUrl).to.contain(objectStorageBaseUrl)
|
||||
}
|
||||
|
||||
for (let i = 0; i < resolutions.length; i++) {
|
||||
@@ -77,15 +87,16 @@ async function testVideoResolutions (options: {
|
||||
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({
|
||||
|
||||
@@ -5,7 +5,7 @@ import { pipeline } from 'stream'
|
||||
import { ObjectStorageCommand } from '@shared/server-commands'
|
||||
import { getPort, randomListen, terminateServer } from './shared'
|
||||
|
||||
export class MockObjectStorage {
|
||||
export class MockObjectStorageProxy {
|
||||
private server: Server
|
||||
|
||||
async initialize () {
|
||||
|
||||
Reference in New Issue
Block a user