aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/shared/live.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/shared/live.ts')
-rw-r--r--server/tests/shared/live.ts23
1 files changed, 17 insertions, 6 deletions
diff --git a/server/tests/shared/live.ts b/server/tests/shared/live.ts
index 1c868eb5b..ff0b2f226 100644
--- a/server/tests/shared/live.ts
+++ b/server/tests/shared/live.ts
@@ -3,10 +3,10 @@
3import { expect } from 'chai' 3import { expect } from 'chai'
4import { pathExists, readdir } from 'fs-extra' 4import { pathExists, readdir } from 'fs-extra'
5import { join } from 'path' 5import { join } from 'path'
6import { sha1 } from '@shared/extra-utils'
6import { LiveVideo, VideoStreamingPlaylistType } from '@shared/models' 7import { LiveVideo, VideoStreamingPlaylistType } from '@shared/models'
7import { ObjectStorageCommand, PeerTubeServer } from '@shared/server-commands' 8import { ObjectStorageCommand, PeerTubeServer } from '@shared/server-commands'
8import { checkLiveSegmentHash, checkResolutionsInMasterPlaylist } from './streaming-playlists' 9import { checkLiveSegmentHash, checkResolutionsInMasterPlaylist } from './streaming-playlists'
9import { sha1 } from '@shared/extra-utils'
10 10
11async function checkLiveCleanup (options: { 11async function checkLiveCleanup (options: {
12 server: PeerTubeServer 12 server: PeerTubeServer
@@ -42,9 +42,19 @@ async function testVideoResolutions (options: {
42 liveVideoId: string 42 liveVideoId: string
43 resolutions: number[] 43 resolutions: number[]
44 transcoded: boolean 44 transcoded: boolean
45
45 objectStorage: boolean 46 objectStorage: boolean
47 objectStorageBaseUrl?: string
46}) { 48}) {
47 const { originServer, servers, liveVideoId, resolutions, transcoded, objectStorage } = options 49 const {
50 originServer,
51 servers,
52 liveVideoId,
53 resolutions,
54 transcoded,
55 objectStorage,
56 objectStorageBaseUrl = ObjectStorageCommand.getMockPlaylistBaseUrl()
57 } = options
48 58
49 for (const server of servers) { 59 for (const server of servers) {
50 const { data } = await server.videos.list() 60 const { data } = await server.videos.list()
@@ -66,7 +76,7 @@ async function testVideoResolutions (options: {
66 }) 76 })
67 77
68 if (objectStorage) { 78 if (objectStorage) {
69 expect(hlsPlaylist.playlistUrl).to.contain(ObjectStorageCommand.getMockPlaylistBaseUrl()) 79 expect(hlsPlaylist.playlistUrl).to.contain(objectStorageBaseUrl)
70 } 80 }
71 81
72 for (let i = 0; i < resolutions.length; i++) { 82 for (let i = 0; i < resolutions.length; i++) {
@@ -77,15 +87,16 @@ async function testVideoResolutions (options: {
77 videoUUID: video.uuid, 87 videoUUID: video.uuid,
78 playlistNumber: i, 88 playlistNumber: i,
79 segment: segmentNum, 89 segment: segmentNum,
80 objectStorage 90 objectStorage,
91 objectStorageBaseUrl
81 }) 92 })
82 93
83 const baseUrl = objectStorage 94 const baseUrl = objectStorage
84 ? ObjectStorageCommand.getMockPlaylistBaseUrl() + 'hls' 95 ? join(objectStorageBaseUrl, 'hls')
85 : originServer.url + '/static/streaming-playlists/hls' 96 : originServer.url + '/static/streaming-playlists/hls'
86 97
87 if (objectStorage) { 98 if (objectStorage) {
88 expect(hlsPlaylist.segmentsSha256Url).to.contain(ObjectStorageCommand.getMockPlaylistBaseUrl()) 99 expect(hlsPlaylist.segmentsSha256Url).to.contain(objectStorageBaseUrl)
89 } 100 }
90 101
91 const subPlaylist = await originServer.streamingPlaylists.get({ 102 const subPlaylist = await originServer.streamingPlaylists.get({