aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/peertube-runner
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-05-23 10:49:45 +0200
committerChocobozzz <me@florianbigard.com>2023-05-23 10:49:45 +0200
commitf89189907bbdff6c4bc6d3460ed9ef4c49515f17 (patch)
treec55e50e3fc02ae9b3f2d1d19d95160af98cc7d7c /server/tests/peertube-runner
parent41cde76bbf5ac16a90b5f158672523069db74009 (diff)
downloadPeerTube-f89189907bbdff6c4bc6d3460ed9ef4c49515f17.tar.gz
PeerTube-f89189907bbdff6c4bc6d3460ed9ef4c49515f17.tar.zst
PeerTube-f89189907bbdff6c4bc6d3460ed9ef4c49515f17.zip
Prevent object storage mock conflicts
When running tests in parallel
Diffstat (limited to 'server/tests/peertube-runner')
-rw-r--r--server/tests/peertube-runner/live-transcoding.ts20
-rw-r--r--server/tests/peertube-runner/studio-transcoding.ts22
-rw-r--r--server/tests/peertube-runner/vod-transcoding.ts28
3 files changed, 44 insertions, 26 deletions
diff --git a/server/tests/peertube-runner/live-transcoding.ts b/server/tests/peertube-runner/live-transcoding.ts
index e7ef941c6..c2ca1de96 100644
--- a/server/tests/peertube-runner/live-transcoding.ts
+++ b/server/tests/peertube-runner/live-transcoding.ts
@@ -31,8 +31,8 @@ describe('Test Live transcoding in peertube-runner program', function () {
31 let sqlCommandServer1: SQLCommand 31 let sqlCommandServer1: SQLCommand
32 32
33 function runSuite (options: { 33 function runSuite (options: {
34 objectStorage: boolean 34 objectStorage?: ObjectStorageCommand
35 }) { 35 } = {}) {
36 const { objectStorage } = options 36 const { objectStorage } = options
37 37
38 it('Should enable transcoding without additional resolutions', async function () { 38 it('Should enable transcoding without additional resolutions', async function () {
@@ -117,7 +117,7 @@ describe('Test Live transcoding in peertube-runner program', function () {
117 117
118 for (const file of files) { 118 for (const file of files) {
119 if (objectStorage) { 119 if (objectStorage) {
120 expectStartWith(file.fileUrl, ObjectStorageCommand.getMockPlaylistBaseUrl()) 120 expectStartWith(file.fileUrl, objectStorage.getMockPlaylistBaseUrl())
121 } 121 }
122 122
123 await makeRawRequest({ url: file.fileUrl, expectedStatus: HttpStatusCode.OK_200 }) 123 await makeRawRequest({ url: file.fileUrl, expectedStatus: HttpStatusCode.OK_200 })
@@ -155,24 +155,30 @@ describe('Test Live transcoding in peertube-runner program', function () {
155 await servers[0].config.enableTranscoding(true, false, true) 155 await servers[0].config.enableTranscoding(true, false, true)
156 }) 156 })
157 157
158 runSuite({ objectStorage: false }) 158 runSuite()
159 }) 159 })
160 160
161 describe('With lives on object storage', function () { 161 describe('With lives on object storage', function () {
162 if (areMockObjectStorageTestsDisabled()) return 162 if (areMockObjectStorageTestsDisabled()) return
163 163
164 const objectStorage = new ObjectStorageCommand()
165
164 before(async function () { 166 before(async function () {
165 await ObjectStorageCommand.prepareDefaultMockBuckets() 167 await objectStorage.prepareDefaultMockBuckets()
166 168
167 await servers[0].kill() 169 await servers[0].kill()
168 170
169 await servers[0].run(ObjectStorageCommand.getDefaultMockConfig()) 171 await servers[0].run(objectStorage.getDefaultMockConfig())
170 172
171 // Wait for peertube runner socket reconnection 173 // Wait for peertube runner socket reconnection
172 await wait(1500) 174 await wait(1500)
173 }) 175 })
174 176
175 runSuite({ objectStorage: true }) 177 runSuite({ objectStorage })
178
179 after(async function () {
180 await objectStorage.cleanupMock()
181 })
176 }) 182 })
177 183
178 describe('Check cleanup', function () { 184 describe('Check cleanup', function () {
diff --git a/server/tests/peertube-runner/studio-transcoding.ts b/server/tests/peertube-runner/studio-transcoding.ts
index 400203eb3..69b38a536 100644
--- a/server/tests/peertube-runner/studio-transcoding.ts
+++ b/server/tests/peertube-runner/studio-transcoding.ts
@@ -19,8 +19,8 @@ describe('Test studio transcoding in peertube-runner program', function () {
19 let peertubeRunner: PeerTubeRunnerProcess 19 let peertubeRunner: PeerTubeRunnerProcess
20 20
21 function runSuite (options: { 21 function runSuite (options: {
22 objectStorage: boolean 22 objectStorage?: ObjectStorageCommand
23 }) { 23 } = {}) {
24 const { objectStorage } = options 24 const { objectStorage } = options
25 25
26 it('Should run a complex studio transcoding', async function () { 26 it('Should run a complex studio transcoding', async function () {
@@ -45,11 +45,11 @@ describe('Test studio transcoding in peertube-runner program', function () {
45 45
46 if (objectStorage) { 46 if (objectStorage) {
47 for (const webtorrentFile of video.files) { 47 for (const webtorrentFile of video.files) {
48 expectStartWith(webtorrentFile.fileUrl, ObjectStorageCommand.getMockWebTorrentBaseUrl()) 48 expectStartWith(webtorrentFile.fileUrl, objectStorage.getMockWebVideosBaseUrl())
49 } 49 }
50 50
51 for (const hlsFile of video.streamingPlaylists[0].files) { 51 for (const hlsFile of video.streamingPlaylists[0].files) {
52 expectStartWith(hlsFile.fileUrl, ObjectStorageCommand.getMockPlaylistBaseUrl()) 52 expectStartWith(hlsFile.fileUrl, objectStorage.getMockPlaylistBaseUrl())
53 } 53 }
54 } 54 }
55 55
@@ -80,24 +80,30 @@ describe('Test studio transcoding in peertube-runner program', function () {
80 }) 80 })
81 81
82 describe('With videos on local filesystem storage', function () { 82 describe('With videos on local filesystem storage', function () {
83 runSuite({ objectStorage: false }) 83 runSuite()
84 }) 84 })
85 85
86 describe('With videos on object storage', function () { 86 describe('With videos on object storage', function () {
87 if (areMockObjectStorageTestsDisabled()) return 87 if (areMockObjectStorageTestsDisabled()) return
88 88
89 const objectStorage = new ObjectStorageCommand()
90
89 before(async function () { 91 before(async function () {
90 await ObjectStorageCommand.prepareDefaultMockBuckets() 92 await objectStorage.prepareDefaultMockBuckets()
91 93
92 await servers[0].kill() 94 await servers[0].kill()
93 95
94 await servers[0].run(ObjectStorageCommand.getDefaultMockConfig()) 96 await servers[0].run(objectStorage.getDefaultMockConfig())
95 97
96 // Wait for peertube runner socket reconnection 98 // Wait for peertube runner socket reconnection
97 await wait(1500) 99 await wait(1500)
98 }) 100 })
99 101
100 runSuite({ objectStorage: true }) 102 runSuite({ objectStorage })
103
104 after(async function () {
105 await objectStorage.cleanupMock()
106 })
101 }) 107 })
102 108
103 describe('Check cleanup', function () { 109 describe('Check cleanup', function () {
diff --git a/server/tests/peertube-runner/vod-transcoding.ts b/server/tests/peertube-runner/vod-transcoding.ts
index dc505baab..aefec394d 100644
--- a/server/tests/peertube-runner/vod-transcoding.ts
+++ b/server/tests/peertube-runner/vod-transcoding.ts
@@ -26,16 +26,16 @@ describe('Test VOD transcoding in peertube-runner program', function () {
26 function runSuite (options: { 26 function runSuite (options: {
27 webtorrentEnabled: boolean 27 webtorrentEnabled: boolean
28 hlsEnabled: boolean 28 hlsEnabled: boolean
29 objectStorage: boolean 29 objectStorage?: ObjectStorageCommand
30 }) { 30 }) {
31 const { webtorrentEnabled, hlsEnabled, objectStorage } = options 31 const { webtorrentEnabled, hlsEnabled, objectStorage } = options
32 32
33 const objectStorageBaseUrlWebTorrent = objectStorage 33 const objectStorageBaseUrlWebTorrent = objectStorage
34 ? ObjectStorageCommand.getMockWebTorrentBaseUrl() 34 ? objectStorage.getMockWebVideosBaseUrl()
35 : undefined 35 : undefined
36 36
37 const objectStorageBaseUrlHLS = objectStorage 37 const objectStorageBaseUrlHLS = objectStorage
38 ? ObjectStorageCommand.getMockPlaylistBaseUrl() 38 ? objectStorage.getMockPlaylistBaseUrl()
39 : undefined 39 : undefined
40 40
41 it('Should upload a classic video mp4 and transcode it', async function () { 41 it('Should upload a classic video mp4 and transcode it', async function () {
@@ -262,7 +262,7 @@ describe('Test VOD transcoding in peertube-runner program', function () {
262 await servers[0].config.enableTranscoding(true, false, true) 262 await servers[0].config.enableTranscoding(true, false, true)
263 }) 263 })
264 264
265 runSuite({ webtorrentEnabled: true, hlsEnabled: false, objectStorage: false }) 265 runSuite({ webtorrentEnabled: true, hlsEnabled: false })
266 }) 266 })
267 267
268 describe('HLS videos only enabled', function () { 268 describe('HLS videos only enabled', function () {
@@ -271,7 +271,7 @@ describe('Test VOD transcoding in peertube-runner program', function () {
271 await servers[0].config.enableTranscoding(false, true, true) 271 await servers[0].config.enableTranscoding(false, true, true)
272 }) 272 })
273 273
274 runSuite({ webtorrentEnabled: false, hlsEnabled: true, objectStorage: false }) 274 runSuite({ webtorrentEnabled: false, hlsEnabled: true })
275 }) 275 })
276 276
277 describe('Web video & HLS enabled', function () { 277 describe('Web video & HLS enabled', function () {
@@ -280,19 +280,21 @@ describe('Test VOD transcoding in peertube-runner program', function () {
280 await servers[0].config.enableTranscoding(true, true, true) 280 await servers[0].config.enableTranscoding(true, true, true)
281 }) 281 })
282 282
283 runSuite({ webtorrentEnabled: true, hlsEnabled: true, objectStorage: false }) 283 runSuite({ webtorrentEnabled: true, hlsEnabled: true })
284 }) 284 })
285 }) 285 })
286 286
287 describe('With videos on object storage', function () { 287 describe('With videos on object storage', function () {
288 if (areMockObjectStorageTestsDisabled()) return 288 if (areMockObjectStorageTestsDisabled()) return
289 289
290 const objectStorage = new ObjectStorageCommand()
291
290 before(async function () { 292 before(async function () {
291 await ObjectStorageCommand.prepareDefaultMockBuckets() 293 await objectStorage.prepareDefaultMockBuckets()
292 294
293 await servers[0].kill() 295 await servers[0].kill()
294 296
295 await servers[0].run(ObjectStorageCommand.getDefaultMockConfig()) 297 await servers[0].run(objectStorage.getDefaultMockConfig())
296 298
297 // Wait for peertube runner socket reconnection 299 // Wait for peertube runner socket reconnection
298 await wait(1500) 300 await wait(1500)
@@ -304,7 +306,7 @@ describe('Test VOD transcoding in peertube-runner program', function () {
304 await servers[0].config.enableTranscoding(true, false, true) 306 await servers[0].config.enableTranscoding(true, false, true)
305 }) 307 })
306 308
307 runSuite({ webtorrentEnabled: true, hlsEnabled: false, objectStorage: true }) 309 runSuite({ webtorrentEnabled: true, hlsEnabled: false, objectStorage })
308 }) 310 })
309 311
310 describe('HLS videos only enabled', function () { 312 describe('HLS videos only enabled', function () {
@@ -313,7 +315,7 @@ describe('Test VOD transcoding in peertube-runner program', function () {
313 await servers[0].config.enableTranscoding(false, true, true) 315 await servers[0].config.enableTranscoding(false, true, true)
314 }) 316 })
315 317
316 runSuite({ webtorrentEnabled: false, hlsEnabled: true, objectStorage: true }) 318 runSuite({ webtorrentEnabled: false, hlsEnabled: true, objectStorage })
317 }) 319 })
318 320
319 describe('Web video & HLS enabled', function () { 321 describe('Web video & HLS enabled', function () {
@@ -322,7 +324,11 @@ describe('Test VOD transcoding in peertube-runner program', function () {
322 await servers[0].config.enableTranscoding(true, true, true) 324 await servers[0].config.enableTranscoding(true, true, true)
323 }) 325 })
324 326
325 runSuite({ webtorrentEnabled: true, hlsEnabled: true, objectStorage: true }) 327 runSuite({ webtorrentEnabled: true, hlsEnabled: true, objectStorage })
328 })
329
330 after(async function () {
331 await objectStorage.cleanupMock()
326 }) 332 })
327 }) 333 })
328 334