mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-04 18:29:27 +02:00
Fix live tests
This commit is contained in:
parent
8c13fd744f
commit
bbae45c32e
5 changed files with 62 additions and 22 deletions
|
@ -15,7 +15,7 @@ import {
|
|||
VideoState
|
||||
} from '@shared/models'
|
||||
import { unwrapBody } from '../requests'
|
||||
import { ObjectStorageCommand } from '../server'
|
||||
import { ObjectStorageCommand, PeerTubeServer } from '../server'
|
||||
import { AbstractCommand, OverrideCommandOptions } from '../shared'
|
||||
import { sendRTMPStream, testFfmpegStreamError } from './live'
|
||||
|
||||
|
@ -160,27 +160,38 @@ export class LiveCommand extends AbstractCommand {
|
|||
return this.waitUntilState({ videoId, state: VideoState.LIVE_ENDED })
|
||||
}
|
||||
|
||||
waitUntilSegmentGeneration (options: OverrideCommandOptions & {
|
||||
async waitUntilSegmentGeneration (options: OverrideCommandOptions & {
|
||||
server: PeerTubeServer
|
||||
videoUUID: string
|
||||
playlistNumber: number
|
||||
segment: number
|
||||
totalSessions?: number
|
||||
objectStorage: boolean
|
||||
}) {
|
||||
const { playlistNumber, segment, videoUUID, totalSessions = 1 } = options
|
||||
const { server, objectStorage, playlistNumber, segment, videoUUID } = options
|
||||
|
||||
const segmentName = `${playlistNumber}-00000${segment}.ts`
|
||||
const baseUrl = objectStorage
|
||||
? ObjectStorageCommand.getPlaylistBaseUrl() + 'hls'
|
||||
: server.url + '/static/streaming-playlists/hls'
|
||||
|
||||
return this.server.servers.waitUntilLog(`${videoUUID}/${segmentName}`, totalSessions * 2, false)
|
||||
}
|
||||
let error = true
|
||||
|
||||
waitUntilSegmentUpload (options: OverrideCommandOptions & {
|
||||
playlistNumber: number
|
||||
segment: number
|
||||
totalSessions?: number
|
||||
}) {
|
||||
const { playlistNumber, segment, totalSessions = 1 } = options
|
||||
const segmentName = `${playlistNumber}-00000${segment}.ts`
|
||||
while (error) {
|
||||
try {
|
||||
await this.getRawRequest({
|
||||
...options,
|
||||
|
||||
return this.server.servers.waitUntilLog(`${segmentName} in bucket `, totalSessions * 2, false)
|
||||
url: `${baseUrl}/${videoUUID}/${segmentName}`,
|
||||
implicitToken: false,
|
||||
defaultExpectedStatus: HttpStatusCode.OK_200
|
||||
})
|
||||
|
||||
error = false
|
||||
} catch {
|
||||
error = true
|
||||
await wait(100)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async waitUntilReplacedByReplay (options: OverrideCommandOptions & {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue