diff options
Diffstat (limited to 'server/tests/api/object-storage/live.ts')
-rw-r--r-- | server/tests/api/object-storage/live.ts | 62 |
1 files changed, 59 insertions, 3 deletions
diff --git a/server/tests/api/object-storage/live.ts b/server/tests/api/object-storage/live.ts index ad2b554b7..2a3fc4779 100644 --- a/server/tests/api/object-storage/live.ts +++ b/server/tests/api/object-storage/live.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ | 1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ |
2 | 2 | ||
3 | import { expect } from 'chai' | 3 | import { expect } from 'chai' |
4 | import { expectStartWith, testVideoResolutions } from '@server/tests/shared' | 4 | import { expectStartWith, MockObjectStorageProxy, testVideoResolutions } from '@server/tests/shared' |
5 | import { areMockObjectStorageTestsDisabled } from '@shared/core-utils' | 5 | import { areMockObjectStorageTestsDisabled } from '@shared/core-utils' |
6 | import { HttpStatusCode, LiveVideoCreate, VideoPrivacy } from '@shared/models' | 6 | import { HttpStatusCode, LiveVideoCreate, VideoPrivacy } from '@shared/models' |
7 | import { | 7 | import { |
@@ -93,7 +93,7 @@ describe('Object storage for lives', function () { | |||
93 | await servers[0].config.enableTranscoding() | 93 | await servers[0].config.enableTranscoding() |
94 | }) | 94 | }) |
95 | 95 | ||
96 | describe('Without live transcoding', async function () { | 96 | describe('Without live transcoding', function () { |
97 | let videoUUID: string | 97 | let videoUUID: string |
98 | 98 | ||
99 | before(async function () { | 99 | before(async function () { |
@@ -134,7 +134,7 @@ describe('Object storage for lives', function () { | |||
134 | }) | 134 | }) |
135 | }) | 135 | }) |
136 | 136 | ||
137 | describe('With live transcoding', async function () { | 137 | describe('With live transcoding', function () { |
138 | const resolutions = [ 720, 480, 360, 240, 144 ] | 138 | const resolutions = [ 720, 480, 360, 240, 144 ] |
139 | 139 | ||
140 | before(async function () { | 140 | before(async function () { |
@@ -223,6 +223,62 @@ describe('Object storage for lives', function () { | |||
223 | }) | 223 | }) |
224 | }) | 224 | }) |
225 | 225 | ||
226 | describe('With object storage base url', function () { | ||
227 | const mockObjectStorageProxy = new MockObjectStorageProxy() | ||
228 | let baseMockUrl: string | ||
229 | |||
230 | before(async function () { | ||
231 | this.timeout(120000) | ||
232 | |||
233 | const port = await mockObjectStorageProxy.initialize() | ||
234 | baseMockUrl = `http://127.0.0.1:${port}/streaming-playlists` | ||
235 | |||
236 | await ObjectStorageCommand.createMockBucket('streaming-playlists') | ||
237 | |||
238 | const config = { | ||
239 | object_storage: { | ||
240 | enabled: true, | ||
241 | endpoint: 'http://' + ObjectStorageCommand.getMockEndpointHost(), | ||
242 | region: ObjectStorageCommand.getMockRegion(), | ||
243 | |||
244 | credentials: ObjectStorageCommand.getMockCredentialsConfig(), | ||
245 | |||
246 | streaming_playlists: { | ||
247 | bucket_name: 'streaming-playlists', | ||
248 | prefix: '', | ||
249 | base_url: baseMockUrl | ||
250 | } | ||
251 | } | ||
252 | } | ||
253 | |||
254 | await servers[0].kill() | ||
255 | await servers[0].run(config) | ||
256 | |||
257 | await servers[0].config.enableLive({ transcoding: true, resolutions: 'min' }) | ||
258 | }) | ||
259 | |||
260 | it('Should publish a live and replace the base url', async function () { | ||
261 | this.timeout(240000) | ||
262 | |||
263 | const videoUUIDPermanent = await createLive(servers[0], true) | ||
264 | |||
265 | const ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: videoUUIDPermanent }) | ||
266 | await waitUntilLivePublishedOnAllServers(servers, videoUUIDPermanent) | ||
267 | |||
268 | await testVideoResolutions({ | ||
269 | originServer: servers[0], | ||
270 | servers, | ||
271 | liveVideoId: videoUUIDPermanent, | ||
272 | resolutions: [ 720 ], | ||
273 | transcoded: true, | ||
274 | objectStorage: true, | ||
275 | objectStorageBaseUrl: baseMockUrl | ||
276 | }) | ||
277 | |||
278 | await stopFfmpeg(ffmpegCommand) | ||
279 | }) | ||
280 | }) | ||
281 | |||
226 | after(async function () { | 282 | after(async function () { |
227 | await killallServers(servers) | 283 | await killallServers(servers) |
228 | }) | 284 | }) |