aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-01-27 08:30:56 +0100
committerChocobozzz <me@florianbigard.com>2023-01-27 08:30:56 +0100
commit8059e050ef4e800c95851ac97abbb2330fe17882 (patch)
tree6cd6cc94cea7d5234e95ddb86aed5be206c4f81c /server/tests/api
parent2e5dd0bef8797dad82e5a908c30bc126cb924033 (diff)
downloadPeerTube-8059e050ef4e800c95851ac97abbb2330fe17882.tar.gz
PeerTube-8059e050ef4e800c95851ac97abbb2330fe17882.tar.zst
PeerTube-8059e050ef4e800c95851ac97abbb2330fe17882.zip
Fix live with base url object storage
Diffstat (limited to 'server/tests/api')
-rw-r--r--server/tests/api/object-storage/live.ts62
-rw-r--r--server/tests/api/object-storage/videos.ts12
2 files changed, 66 insertions, 8 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
3import { expect } from 'chai' 3import { expect } from 'chai'
4import { expectStartWith, testVideoResolutions } from '@server/tests/shared' 4import { expectStartWith, MockObjectStorageProxy, testVideoResolutions } from '@server/tests/shared'
5import { areMockObjectStorageTestsDisabled } from '@shared/core-utils' 5import { areMockObjectStorageTestsDisabled } from '@shared/core-utils'
6import { HttpStatusCode, LiveVideoCreate, VideoPrivacy } from '@shared/models' 6import { HttpStatusCode, LiveVideoCreate, VideoPrivacy } from '@shared/models'
7import { 7import {
@@ -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 })
diff --git a/server/tests/api/object-storage/videos.ts b/server/tests/api/object-storage/videos.ts
index 1b3c389d7..6862658cc 100644
--- a/server/tests/api/object-storage/videos.ts
+++ b/server/tests/api/object-storage/videos.ts
@@ -9,7 +9,7 @@ import {
9 expectLogDoesNotContain, 9 expectLogDoesNotContain,
10 expectStartWith, 10 expectStartWith,
11 generateHighBitrateVideo, 11 generateHighBitrateVideo,
12 MockObjectStorage 12 MockObjectStorageProxy
13} from '@server/tests/shared' 13} from '@server/tests/shared'
14import { areMockObjectStorageTestsDisabled } from '@shared/core-utils' 14import { areMockObjectStorageTestsDisabled } from '@shared/core-utils'
15import { HttpStatusCode, VideoDetails } from '@shared/models' 15import { HttpStatusCode, VideoDetails } from '@shared/models'
@@ -124,7 +124,7 @@ function runTestSuite (options: {
124 124
125 useMockBaseUrl?: boolean 125 useMockBaseUrl?: boolean
126}) { 126}) {
127 const mockObjectStorage = new MockObjectStorage() 127 const mockObjectStorageProxy = new MockObjectStorageProxy()
128 const { fixture } = options 128 const { fixture } = options
129 let baseMockUrl: string 129 let baseMockUrl: string
130 130
@@ -138,8 +138,10 @@ function runTestSuite (options: {
138 before(async function () { 138 before(async function () {
139 this.timeout(120000) 139 this.timeout(120000)
140 140
141 const port = await mockObjectStorage.initialize() 141 const port = await mockObjectStorageProxy.initialize()
142 baseMockUrl = options.useMockBaseUrl ? `http://127.0.0.1:${port}` : undefined 142 baseMockUrl = options.useMockBaseUrl
143 ? `http://127.0.0.1:${port}`
144 : undefined
143 145
144 await ObjectStorageCommand.createMockBucket(options.playlistBucket) 146 await ObjectStorageCommand.createMockBucket(options.playlistBucket)
145 await ObjectStorageCommand.createMockBucket(options.webtorrentBucket) 147 await ObjectStorageCommand.createMockBucket(options.webtorrentBucket)
@@ -254,7 +256,7 @@ function runTestSuite (options: {
254 }) 256 })
255 257
256 after(async function () { 258 after(async function () {
257 await mockObjectStorage.terminate() 259 await mockObjectStorageProxy.terminate()
258 260
259 await cleanupTests(servers) 261 await cleanupTests(servers)
260 }) 262 })