diff options
author | Chocobozzz <me@florianbigard.com> | 2023-05-23 10:49:45 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-05-23 10:49:45 +0200 |
commit | f89189907bbdff6c4bc6d3460ed9ef4c49515f17 (patch) | |
tree | c55e50e3fc02ae9b3f2d1d19d95160af98cc7d7c /server/tests/api | |
parent | 41cde76bbf5ac16a90b5f158672523069db74009 (diff) | |
download | PeerTube-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/api')
-rw-r--r-- | server/tests/api/live/live-fast-restream.ts | 3 | ||||
-rw-r--r-- | server/tests/api/live/live.ts | 8 | ||||
-rw-r--r-- | server/tests/api/object-storage/live.ts | 58 | ||||
-rw-r--r-- | server/tests/api/object-storage/video-imports.ts | 13 | ||||
-rw-r--r-- | server/tests/api/object-storage/videos.ts | 50 | ||||
-rw-r--r-- | server/tests/api/server/follows.ts | 2 | ||||
-rw-r--r-- | server/tests/api/server/proxy.ts | 16 | ||||
-rw-r--r-- | server/tests/api/transcoding/create-transcoding.ts | 35 | ||||
-rw-r--r-- | server/tests/api/transcoding/hls.ts | 12 | ||||
-rw-r--r-- | server/tests/api/transcoding/update-while-transcoding.ts | 12 | ||||
-rw-r--r-- | server/tests/api/transcoding/video-studio.ts | 14 |
11 files changed, 126 insertions, 97 deletions
diff --git a/server/tests/api/live/live-fast-restream.ts b/server/tests/api/live/live-fast-restream.ts index 2169393c2..d7085a957 100644 --- a/server/tests/api/live/live-fast-restream.ts +++ b/server/tests/api/live/live-fast-restream.ts | |||
@@ -65,8 +65,7 @@ describe('Fast restream in live', function () { | |||
65 | server, | 65 | server, |
66 | videoUUID: liveVideoUUID, | 66 | videoUUID: liveVideoUUID, |
67 | segment: 1, | 67 | segment: 1, |
68 | playlistNumber: 0, | 68 | playlistNumber: 0 |
69 | objectStorage: false | ||
70 | }) | 69 | }) |
71 | 70 | ||
72 | return { ffmpegCommand, liveVideoUUID } | 71 | return { ffmpegCommand, liveVideoUUID } |
diff --git a/server/tests/api/live/live.ts b/server/tests/api/live/live.ts index 65ebbc5f7..7ab67b126 100644 --- a/server/tests/api/live/live.ts +++ b/server/tests/api/live/live.ts | |||
@@ -423,7 +423,6 @@ describe('Test live', function () { | |||
423 | servers, | 423 | servers, |
424 | liveVideoId, | 424 | liveVideoId, |
425 | resolutions: [ 720 ], | 425 | resolutions: [ 720 ], |
426 | objectStorage: false, | ||
427 | transcoded: true | 426 | transcoded: true |
428 | }) | 427 | }) |
429 | 428 | ||
@@ -459,7 +458,6 @@ describe('Test live', function () { | |||
459 | servers, | 458 | servers, |
460 | liveVideoId, | 459 | liveVideoId, |
461 | resolutions: resolutions.concat([ 720 ]), | 460 | resolutions: resolutions.concat([ 720 ]), |
462 | objectStorage: false, | ||
463 | transcoded: true | 461 | transcoded: true |
464 | }) | 462 | }) |
465 | 463 | ||
@@ -512,7 +510,6 @@ describe('Test live', function () { | |||
512 | servers, | 510 | servers, |
513 | liveVideoId, | 511 | liveVideoId, |
514 | resolutions, | 512 | resolutions, |
515 | objectStorage: false, | ||
516 | transcoded: true | 513 | transcoded: true |
517 | }) | 514 | }) |
518 | 515 | ||
@@ -609,7 +606,6 @@ describe('Test live', function () { | |||
609 | servers, | 606 | servers, |
610 | liveVideoId, | 607 | liveVideoId, |
611 | resolutions, | 608 | resolutions, |
612 | objectStorage: false, | ||
613 | transcoded: true | 609 | transcoded: true |
614 | }) | 610 | }) |
615 | 611 | ||
@@ -646,7 +642,6 @@ describe('Test live', function () { | |||
646 | servers, | 642 | servers, |
647 | liveVideoId, | 643 | liveVideoId, |
648 | resolutions: [ 720 ], | 644 | resolutions: [ 720 ], |
649 | objectStorage: false, | ||
650 | transcoded: true | 645 | transcoded: true |
651 | }) | 646 | }) |
652 | 647 | ||
@@ -720,8 +715,7 @@ describe('Test live', function () { | |||
720 | server: servers[0], | 715 | server: servers[0], |
721 | videoUUID, | 716 | videoUUID, |
722 | playlistNumber: 0, | 717 | playlistNumber: 0, |
723 | segment: 2, | 718 | segment: 2 |
724 | objectStorage: false | ||
725 | }) | 719 | }) |
726 | } | 720 | } |
727 | 721 | ||
diff --git a/server/tests/api/object-storage/live.ts b/server/tests/api/object-storage/live.ts index 7f8db40e5..07ff4763b 100644 --- a/server/tests/api/object-storage/live.ts +++ b/server/tests/api/object-storage/live.ts | |||
@@ -36,7 +36,14 @@ async function createLive (server: PeerTubeServer, permanent: boolean) { | |||
36 | return uuid | 36 | return uuid |
37 | } | 37 | } |
38 | 38 | ||
39 | async function checkFilesExist (servers: PeerTubeServer[], videoUUID: string, numberOfFiles: number) { | 39 | async function checkFilesExist (options: { |
40 | servers: PeerTubeServer[] | ||
41 | videoUUID: string | ||
42 | numberOfFiles: number | ||
43 | objectStorage: ObjectStorageCommand | ||
44 | }) { | ||
45 | const { servers, videoUUID, numberOfFiles, objectStorage } = options | ||
46 | |||
40 | for (const server of servers) { | 47 | for (const server of servers) { |
41 | const video = await server.videos.get({ id: videoUUID }) | 48 | const video = await server.videos.get({ id: videoUUID }) |
42 | 49 | ||
@@ -47,14 +54,21 @@ async function checkFilesExist (servers: PeerTubeServer[], videoUUID: string, nu | |||
47 | expect(files).to.have.lengthOf(numberOfFiles) | 54 | expect(files).to.have.lengthOf(numberOfFiles) |
48 | 55 | ||
49 | for (const file of files) { | 56 | for (const file of files) { |
50 | expectStartWith(file.fileUrl, ObjectStorageCommand.getMockPlaylistBaseUrl()) | 57 | expectStartWith(file.fileUrl, objectStorage.getMockPlaylistBaseUrl()) |
51 | 58 | ||
52 | await makeRawRequest({ url: file.fileUrl, expectedStatus: HttpStatusCode.OK_200 }) | 59 | await makeRawRequest({ url: file.fileUrl, expectedStatus: HttpStatusCode.OK_200 }) |
53 | } | 60 | } |
54 | } | 61 | } |
55 | } | 62 | } |
56 | 63 | ||
57 | async function checkFilesCleanup (server: PeerTubeServer, videoUUID: string, resolutions: number[]) { | 64 | async function checkFilesCleanup (options: { |
65 | server: PeerTubeServer | ||
66 | videoUUID: string | ||
67 | resolutions: number[] | ||
68 | objectStorage: ObjectStorageCommand | ||
69 | }) { | ||
70 | const { server, videoUUID, resolutions, objectStorage } = options | ||
71 | |||
58 | const resolutionFiles = resolutions.map((_value, i) => `${i}.m3u8`) | 72 | const resolutionFiles = resolutions.map((_value, i) => `${i}.m3u8`) |
59 | 73 | ||
60 | for (const playlistName of [ 'master.m3u8' ].concat(resolutionFiles)) { | 74 | for (const playlistName of [ 'master.m3u8' ].concat(resolutionFiles)) { |
@@ -62,7 +76,7 @@ async function checkFilesCleanup (server: PeerTubeServer, videoUUID: string, res | |||
62 | videoUUID, | 76 | videoUUID, |
63 | playlistName, | 77 | playlistName, |
64 | expectedStatus: HttpStatusCode.NOT_FOUND_404, | 78 | expectedStatus: HttpStatusCode.NOT_FOUND_404, |
65 | objectStorage: true | 79 | objectStorage |
66 | }) | 80 | }) |
67 | } | 81 | } |
68 | 82 | ||
@@ -70,7 +84,7 @@ async function checkFilesCleanup (server: PeerTubeServer, videoUUID: string, res | |||
70 | videoUUID, | 84 | videoUUID, |
71 | playlistNumber: 0, | 85 | playlistNumber: 0, |
72 | segment: 0, | 86 | segment: 0, |
73 | objectStorage: true, | 87 | objectStorage, |
74 | expectedStatus: HttpStatusCode.NOT_FOUND_404 | 88 | expectedStatus: HttpStatusCode.NOT_FOUND_404 |
75 | }) | 89 | }) |
76 | } | 90 | } |
@@ -80,13 +94,13 @@ describe('Object storage for lives', function () { | |||
80 | 94 | ||
81 | let servers: PeerTubeServer[] | 95 | let servers: PeerTubeServer[] |
82 | let sqlCommandServer1: SQLCommand | 96 | let sqlCommandServer1: SQLCommand |
97 | const objectStorage = new ObjectStorageCommand() | ||
83 | 98 | ||
84 | before(async function () { | 99 | before(async function () { |
85 | this.timeout(120000) | 100 | this.timeout(120000) |
86 | 101 | ||
87 | await ObjectStorageCommand.prepareDefaultMockBuckets() | 102 | await objectStorage.prepareDefaultMockBuckets() |
88 | 103 | servers = await createMultipleServers(2, objectStorage.getDefaultMockConfig()) | |
89 | servers = await createMultipleServers(2, ObjectStorageCommand.getDefaultMockConfig()) | ||
90 | 104 | ||
91 | await setAccessTokensToServers(servers) | 105 | await setAccessTokensToServers(servers) |
92 | await setDefaultVideoChannel(servers) | 106 | await setDefaultVideoChannel(servers) |
@@ -119,7 +133,7 @@ describe('Object storage for lives', function () { | |||
119 | liveVideoId: videoUUID, | 133 | liveVideoId: videoUUID, |
120 | resolutions: [ 720 ], | 134 | resolutions: [ 720 ], |
121 | transcoded: false, | 135 | transcoded: false, |
122 | objectStorage: true | 136 | objectStorage |
123 | }) | 137 | }) |
124 | 138 | ||
125 | await stopFfmpeg(ffmpegCommand) | 139 | await stopFfmpeg(ffmpegCommand) |
@@ -131,11 +145,11 @@ describe('Object storage for lives', function () { | |||
131 | await waitUntilLiveReplacedByReplayOnAllServers(servers, videoUUID) | 145 | await waitUntilLiveReplacedByReplayOnAllServers(servers, videoUUID) |
132 | await waitJobs(servers) | 146 | await waitJobs(servers) |
133 | 147 | ||
134 | await checkFilesExist(servers, videoUUID, 1) | 148 | await checkFilesExist({ servers, videoUUID, numberOfFiles: 1, objectStorage }) |
135 | }) | 149 | }) |
136 | 150 | ||
137 | it('Should have cleaned up live files from object storage', async function () { | 151 | it('Should have cleaned up live files from object storage', async function () { |
138 | await checkFilesCleanup(servers[0], videoUUID, [ 720 ]) | 152 | await checkFilesCleanup({ server: servers[0], videoUUID, resolutions: [ 720 ], objectStorage }) |
139 | }) | 153 | }) |
140 | }) | 154 | }) |
141 | 155 | ||
@@ -166,7 +180,7 @@ describe('Object storage for lives', function () { | |||
166 | liveVideoId: videoUUIDNonPermanent, | 180 | liveVideoId: videoUUIDNonPermanent, |
167 | resolutions, | 181 | resolutions, |
168 | transcoded: true, | 182 | transcoded: true, |
169 | objectStorage: true | 183 | objectStorage |
170 | }) | 184 | }) |
171 | 185 | ||
172 | await stopFfmpeg(ffmpegCommand) | 186 | await stopFfmpeg(ffmpegCommand) |
@@ -178,11 +192,11 @@ describe('Object storage for lives', function () { | |||
178 | await waitUntilLiveReplacedByReplayOnAllServers(servers, videoUUIDNonPermanent) | 192 | await waitUntilLiveReplacedByReplayOnAllServers(servers, videoUUIDNonPermanent) |
179 | await waitJobs(servers) | 193 | await waitJobs(servers) |
180 | 194 | ||
181 | await checkFilesExist(servers, videoUUIDNonPermanent, 5) | 195 | await checkFilesExist({ servers, videoUUID: videoUUIDNonPermanent, numberOfFiles: 5, objectStorage }) |
182 | }) | 196 | }) |
183 | 197 | ||
184 | it('Should have cleaned up live files from object storage', async function () { | 198 | it('Should have cleaned up live files from object storage', async function () { |
185 | await checkFilesCleanup(servers[0], videoUUIDNonPermanent, resolutions) | 199 | await checkFilesCleanup({ server: servers[0], videoUUID: videoUUIDNonPermanent, resolutions, objectStorage }) |
186 | }) | 200 | }) |
187 | }) | 201 | }) |
188 | 202 | ||
@@ -206,7 +220,7 @@ describe('Object storage for lives', function () { | |||
206 | liveVideoId: videoUUIDPermanent, | 220 | liveVideoId: videoUUIDPermanent, |
207 | resolutions, | 221 | resolutions, |
208 | transcoded: true, | 222 | transcoded: true, |
209 | objectStorage: true | 223 | objectStorage |
210 | }) | 224 | }) |
211 | 225 | ||
212 | await stopFfmpeg(ffmpegCommand) | 226 | await stopFfmpeg(ffmpegCommand) |
@@ -221,11 +235,11 @@ describe('Object storage for lives', function () { | |||
221 | const videoLiveDetails = await servers[0].videos.get({ id: videoUUIDPermanent }) | 235 | const videoLiveDetails = await servers[0].videos.get({ id: videoUUIDPermanent }) |
222 | const replay = await findExternalSavedVideo(servers[0], videoLiveDetails) | 236 | const replay = await findExternalSavedVideo(servers[0], videoLiveDetails) |
223 | 237 | ||
224 | await checkFilesExist(servers, replay.uuid, 5) | 238 | await checkFilesExist({ servers, videoUUID: replay.uuid, numberOfFiles: 5, objectStorage }) |
225 | }) | 239 | }) |
226 | 240 | ||
227 | it('Should have cleaned up live files from object storage', async function () { | 241 | it('Should have cleaned up live files from object storage', async function () { |
228 | await checkFilesCleanup(servers[0], videoUUIDPermanent, resolutions) | 242 | await checkFilesCleanup({ server: servers[0], videoUUID: videoUUIDPermanent, resolutions, objectStorage }) |
229 | }) | 243 | }) |
230 | }) | 244 | }) |
231 | }) | 245 | }) |
@@ -238,9 +252,10 @@ describe('Object storage for lives', function () { | |||
238 | this.timeout(120000) | 252 | this.timeout(120000) |
239 | 253 | ||
240 | const port = await mockObjectStorageProxy.initialize() | 254 | const port = await mockObjectStorageProxy.initialize() |
241 | baseMockUrl = `http://127.0.0.1:${port}/streaming-playlists` | 255 | const bucketName = objectStorage.getMockStreamingPlaylistsBucketName() |
256 | baseMockUrl = `http://127.0.0.1:${port}/${bucketName}` | ||
242 | 257 | ||
243 | await ObjectStorageCommand.createMockBucket('streaming-playlists') | 258 | await objectStorage.prepareDefaultMockBuckets() |
244 | 259 | ||
245 | const config = { | 260 | const config = { |
246 | object_storage: { | 261 | object_storage: { |
@@ -251,7 +266,7 @@ describe('Object storage for lives', function () { | |||
251 | credentials: ObjectStorageCommand.getMockCredentialsConfig(), | 266 | credentials: ObjectStorageCommand.getMockCredentialsConfig(), |
252 | 267 | ||
253 | streaming_playlists: { | 268 | streaming_playlists: { |
254 | bucket_name: 'streaming-playlists', | 269 | bucket_name: bucketName, |
255 | prefix: '', | 270 | prefix: '', |
256 | base_url: baseMockUrl | 271 | base_url: baseMockUrl |
257 | } | 272 | } |
@@ -279,7 +294,7 @@ describe('Object storage for lives', function () { | |||
279 | liveVideoId: videoUUIDPermanent, | 294 | liveVideoId: videoUUIDPermanent, |
280 | resolutions: [ 720 ], | 295 | resolutions: [ 720 ], |
281 | transcoded: true, | 296 | transcoded: true, |
282 | objectStorage: true, | 297 | objectStorage, |
283 | objectStorageBaseUrl: baseMockUrl | 298 | objectStorageBaseUrl: baseMockUrl |
284 | }) | 299 | }) |
285 | 300 | ||
@@ -289,6 +304,7 @@ describe('Object storage for lives', function () { | |||
289 | 304 | ||
290 | after(async function () { | 305 | after(async function () { |
291 | await sqlCommandServer1.cleanup() | 306 | await sqlCommandServer1.cleanup() |
307 | await objectStorage.cleanupMock() | ||
292 | 308 | ||
293 | await cleanupTests(servers) | 309 | await cleanupTests(servers) |
294 | }) | 310 | }) |
diff --git a/server/tests/api/object-storage/video-imports.ts b/server/tests/api/object-storage/video-imports.ts index d5fd91b6a..57150e5a6 100644 --- a/server/tests/api/object-storage/video-imports.ts +++ b/server/tests/api/object-storage/video-imports.ts | |||
@@ -32,13 +32,14 @@ describe('Object storage for video import', function () { | |||
32 | if (areMockObjectStorageTestsDisabled()) return | 32 | if (areMockObjectStorageTestsDisabled()) return |
33 | 33 | ||
34 | let server: PeerTubeServer | 34 | let server: PeerTubeServer |
35 | const objectStorage = new ObjectStorageCommand() | ||
35 | 36 | ||
36 | before(async function () { | 37 | before(async function () { |
37 | this.timeout(120000) | 38 | this.timeout(120000) |
38 | 39 | ||
39 | await ObjectStorageCommand.prepareDefaultMockBuckets() | 40 | await objectStorage.prepareDefaultMockBuckets() |
40 | 41 | ||
41 | server = await createSingleServer(1, ObjectStorageCommand.getDefaultMockConfig()) | 42 | server = await createSingleServer(1, objectStorage.getDefaultMockConfig()) |
42 | 43 | ||
43 | await setAccessTokensToServers([ server ]) | 44 | await setAccessTokensToServers([ server ]) |
44 | await setDefaultVideoChannel([ server ]) | 45 | await setDefaultVideoChannel([ server ]) |
@@ -64,7 +65,7 @@ describe('Object storage for video import', function () { | |||
64 | expect(video.streamingPlaylists).to.have.lengthOf(0) | 65 | expect(video.streamingPlaylists).to.have.lengthOf(0) |
65 | 66 | ||
66 | const fileUrl = video.files[0].fileUrl | 67 | const fileUrl = video.files[0].fileUrl |
67 | expectStartWith(fileUrl, ObjectStorageCommand.getMockWebTorrentBaseUrl()) | 68 | expectStartWith(fileUrl, objectStorage.getMockWebVideosBaseUrl()) |
68 | 69 | ||
69 | await makeRawRequest({ url: fileUrl, expectedStatus: HttpStatusCode.OK_200 }) | 70 | await makeRawRequest({ url: fileUrl, expectedStatus: HttpStatusCode.OK_200 }) |
70 | }) | 71 | }) |
@@ -89,13 +90,13 @@ describe('Object storage for video import', function () { | |||
89 | expect(video.streamingPlaylists[0].files).to.have.lengthOf(5) | 90 | expect(video.streamingPlaylists[0].files).to.have.lengthOf(5) |
90 | 91 | ||
91 | for (const file of video.files) { | 92 | for (const file of video.files) { |
92 | expectStartWith(file.fileUrl, ObjectStorageCommand.getMockWebTorrentBaseUrl()) | 93 | expectStartWith(file.fileUrl, objectStorage.getMockWebVideosBaseUrl()) |
93 | 94 | ||
94 | await makeRawRequest({ url: file.fileUrl, expectedStatus: HttpStatusCode.OK_200 }) | 95 | await makeRawRequest({ url: file.fileUrl, expectedStatus: HttpStatusCode.OK_200 }) |
95 | } | 96 | } |
96 | 97 | ||
97 | for (const file of video.streamingPlaylists[0].files) { | 98 | for (const file of video.streamingPlaylists[0].files) { |
98 | expectStartWith(file.fileUrl, ObjectStorageCommand.getMockPlaylistBaseUrl()) | 99 | expectStartWith(file.fileUrl, objectStorage.getMockPlaylistBaseUrl()) |
99 | 100 | ||
100 | await makeRawRequest({ url: file.fileUrl, expectedStatus: HttpStatusCode.OK_200 }) | 101 | await makeRawRequest({ url: file.fileUrl, expectedStatus: HttpStatusCode.OK_200 }) |
101 | } | 102 | } |
@@ -103,6 +104,8 @@ describe('Object storage for video import', function () { | |||
103 | }) | 104 | }) |
104 | 105 | ||
105 | after(async function () { | 106 | after(async function () { |
107 | await objectStorage.cleanupMock() | ||
108 | |||
106 | await cleanupTests([ server ]) | 109 | await cleanupTests([ server ]) |
107 | }) | 110 | }) |
108 | }) | 111 | }) |
diff --git a/server/tests/api/object-storage/videos.ts b/server/tests/api/object-storage/videos.ts index 77ed78ae1..f837d9966 100644 --- a/server/tests/api/object-storage/videos.ts +++ b/server/tests/api/object-storage/videos.ts | |||
@@ -145,6 +145,7 @@ function runTestSuite (options: { | |||
145 | 145 | ||
146 | let servers: PeerTubeServer[] | 146 | let servers: PeerTubeServer[] |
147 | let sqlCommands: SQLCommand[] = [] | 147 | let sqlCommands: SQLCommand[] = [] |
148 | const objectStorage = new ObjectStorageCommand() | ||
148 | 149 | ||
149 | let keptUrls: string[] = [] | 150 | let keptUrls: string[] = [] |
150 | 151 | ||
@@ -159,8 +160,8 @@ function runTestSuite (options: { | |||
159 | ? `http://127.0.0.1:${port}` | 160 | ? `http://127.0.0.1:${port}` |
160 | : undefined | 161 | : undefined |
161 | 162 | ||
162 | await ObjectStorageCommand.createMockBucket(options.playlistBucket) | 163 | await objectStorage.createMockBucket(options.playlistBucket) |
163 | await ObjectStorageCommand.createMockBucket(options.webtorrentBucket) | 164 | await objectStorage.createMockBucket(options.webtorrentBucket) |
164 | 165 | ||
165 | const config = { | 166 | const config = { |
166 | object_storage: { | 167 | object_storage: { |
@@ -275,6 +276,7 @@ function runTestSuite (options: { | |||
275 | 276 | ||
276 | after(async function () { | 277 | after(async function () { |
277 | await mockObjectStorageProxy.terminate() | 278 | await mockObjectStorageProxy.terminate() |
279 | await objectStorage.cleanupMock() | ||
278 | 280 | ||
279 | for (const sqlCommand of sqlCommands) { | 281 | for (const sqlCommand of sqlCommands) { |
280 | await sqlCommand.cleanup() | 282 | await sqlCommand.cleanup() |
@@ -287,26 +289,12 @@ function runTestSuite (options: { | |||
287 | describe('Object storage for videos', function () { | 289 | describe('Object storage for videos', function () { |
288 | if (areMockObjectStorageTestsDisabled()) return | 290 | if (areMockObjectStorageTestsDisabled()) return |
289 | 291 | ||
292 | const objectStorage = new ObjectStorageCommand() | ||
293 | |||
290 | describe('Test config', function () { | 294 | describe('Test config', function () { |
291 | let server: PeerTubeServer | 295 | let server: PeerTubeServer |
292 | 296 | ||
293 | const baseConfig = { | 297 | const baseConfig = objectStorage.getDefaultMockConfig() |
294 | object_storage: { | ||
295 | enabled: true, | ||
296 | endpoint: 'http://' + ObjectStorageCommand.getMockEndpointHost(), | ||
297 | region: ObjectStorageCommand.getMockRegion(), | ||
298 | |||
299 | credentials: ObjectStorageCommand.getMockCredentialsConfig(), | ||
300 | |||
301 | streaming_playlists: { | ||
302 | bucket_name: ObjectStorageCommand.DEFAULT_PLAYLIST_MOCK_BUCKET | ||
303 | }, | ||
304 | |||
305 | videos: { | ||
306 | bucket_name: ObjectStorageCommand.DEFAULT_WEBTORRENT_MOCK_BUCKET | ||
307 | } | ||
308 | } | ||
309 | } | ||
310 | 298 | ||
311 | const badCredentials = { | 299 | const badCredentials = { |
312 | access_key_id: 'AKIAIOSFODNN7EXAMPLE', | 300 | access_key_id: 'AKIAIOSFODNN7EXAMPLE', |
@@ -334,7 +322,7 @@ describe('Object storage for videos', function () { | |||
334 | it('Should fail with bad credentials', async function () { | 322 | it('Should fail with bad credentials', async function () { |
335 | this.timeout(60000) | 323 | this.timeout(60000) |
336 | 324 | ||
337 | await ObjectStorageCommand.prepareDefaultMockBuckets() | 325 | await objectStorage.prepareDefaultMockBuckets() |
338 | 326 | ||
339 | const config = merge({}, baseConfig, { | 327 | const config = merge({}, baseConfig, { |
340 | object_storage: { | 328 | object_storage: { |
@@ -358,7 +346,7 @@ describe('Object storage for videos', function () { | |||
358 | it('Should succeed with credentials from env', async function () { | 346 | it('Should succeed with credentials from env', async function () { |
359 | this.timeout(60000) | 347 | this.timeout(60000) |
360 | 348 | ||
361 | await ObjectStorageCommand.prepareDefaultMockBuckets() | 349 | await objectStorage.prepareDefaultMockBuckets() |
362 | 350 | ||
363 | const config = merge({}, baseConfig, { | 351 | const config = merge({}, baseConfig, { |
364 | object_storage: { | 352 | object_storage: { |
@@ -385,25 +373,27 @@ describe('Object storage for videos', function () { | |||
385 | await waitJobs([ server ], { skipDelayed: true }) | 373 | await waitJobs([ server ], { skipDelayed: true }) |
386 | const video = await server.videos.get({ id: uuid }) | 374 | const video = await server.videos.get({ id: uuid }) |
387 | 375 | ||
388 | expectStartWith(video.files[0].fileUrl, ObjectStorageCommand.getMockWebTorrentBaseUrl()) | 376 | expectStartWith(video.files[0].fileUrl, objectStorage.getMockWebVideosBaseUrl()) |
389 | }) | 377 | }) |
390 | 378 | ||
391 | after(async function () { | 379 | after(async function () { |
380 | await objectStorage.cleanupMock() | ||
381 | |||
392 | await cleanupTests([ server ]) | 382 | await cleanupTests([ server ]) |
393 | }) | 383 | }) |
394 | }) | 384 | }) |
395 | 385 | ||
396 | describe('Test simple object storage', function () { | 386 | describe('Test simple object storage', function () { |
397 | runTestSuite({ | 387 | runTestSuite({ |
398 | playlistBucket: 'streaming-playlists', | 388 | playlistBucket: objectStorage.getMockBucketName('streaming-playlists'), |
399 | webtorrentBucket: 'videos' | 389 | webtorrentBucket: objectStorage.getMockBucketName('videos') |
400 | }) | 390 | }) |
401 | }) | 391 | }) |
402 | 392 | ||
403 | describe('Test object storage with prefix', function () { | 393 | describe('Test object storage with prefix', function () { |
404 | runTestSuite({ | 394 | runTestSuite({ |
405 | playlistBucket: 'mybucket', | 395 | playlistBucket: objectStorage.getMockBucketName('mybucket'), |
406 | webtorrentBucket: 'mybucket', | 396 | webtorrentBucket: objectStorage.getMockBucketName('mybucket'), |
407 | 397 | ||
408 | playlistPrefix: 'streaming-playlists_', | 398 | playlistPrefix: 'streaming-playlists_', |
409 | webtorrentPrefix: 'webtorrent_' | 399 | webtorrentPrefix: 'webtorrent_' |
@@ -412,8 +402,8 @@ describe('Object storage for videos', function () { | |||
412 | 402 | ||
413 | describe('Test object storage with prefix and base URL', function () { | 403 | describe('Test object storage with prefix and base URL', function () { |
414 | runTestSuite({ | 404 | runTestSuite({ |
415 | playlistBucket: 'mybucket', | 405 | playlistBucket: objectStorage.getMockBucketName('mybucket'), |
416 | webtorrentBucket: 'mybucket', | 406 | webtorrentBucket: objectStorage.getMockBucketName('mybucket'), |
417 | 407 | ||
418 | playlistPrefix: 'streaming-playlists/', | 408 | playlistPrefix: 'streaming-playlists/', |
419 | webtorrentPrefix: 'webtorrent/', | 409 | webtorrentPrefix: 'webtorrent/', |
@@ -440,8 +430,8 @@ describe('Object storage for videos', function () { | |||
440 | 430 | ||
441 | runTestSuite({ | 431 | runTestSuite({ |
442 | maxUploadPart, | 432 | maxUploadPart, |
443 | playlistBucket: 'streaming-playlists', | 433 | playlistBucket: objectStorage.getMockBucketName('streaming-playlists'), |
444 | webtorrentBucket: 'videos', | 434 | webtorrentBucket: objectStorage.getMockBucketName('videos'), |
445 | fixture | 435 | fixture |
446 | }) | 436 | }) |
447 | }) | 437 | }) |
diff --git a/server/tests/api/server/follows.ts b/server/tests/api/server/follows.ts index dba9e107c..2a5fff82b 100644 --- a/server/tests/api/server/follows.ts +++ b/server/tests/api/server/follows.ts | |||
@@ -279,7 +279,7 @@ describe('Test follows', function () { | |||
279 | }) | 279 | }) |
280 | 280 | ||
281 | it('Should upload a video on server 2 and 3 and propagate only the video of server 2', async function () { | 281 | it('Should upload a video on server 2 and 3 and propagate only the video of server 2', async function () { |
282 | this.timeout(120000) | 282 | this.timeout(160000) |
283 | 283 | ||
284 | await servers[1].videos.upload({ attributes: { name: 'server2' } }) | 284 | await servers[1].videos.upload({ attributes: { name: 'server2' } }) |
285 | await servers[2].videos.upload({ attributes: { name: 'server3' } }) | 285 | await servers[2].videos.upload({ attributes: { name: 'server3' } }) |
diff --git a/server/tests/api/server/proxy.ts b/server/tests/api/server/proxy.ts index 4bf89410e..9337468d5 100644 --- a/server/tests/api/server/proxy.ts +++ b/server/tests/api/server/proxy.ts | |||
@@ -122,38 +122,44 @@ describe('Test proxy', function () { | |||
122 | describe('Object storage', function () { | 122 | describe('Object storage', function () { |
123 | if (areMockObjectStorageTestsDisabled()) return | 123 | if (areMockObjectStorageTestsDisabled()) return |
124 | 124 | ||
125 | const objectStorage = new ObjectStorageCommand() | ||
126 | |||
125 | before(async function () { | 127 | before(async function () { |
126 | this.timeout(30000) | 128 | this.timeout(30000) |
127 | 129 | ||
128 | await ObjectStorageCommand.prepareDefaultMockBuckets() | 130 | await objectStorage.prepareDefaultMockBuckets() |
129 | }) | 131 | }) |
130 | 132 | ||
131 | it('Should succeed to upload to object storage with the appropriate proxy config', async function () { | 133 | it('Should succeed to upload to object storage with the appropriate proxy config', async function () { |
132 | this.timeout(120000) | 134 | this.timeout(120000) |
133 | 135 | ||
134 | await servers[0].kill() | 136 | await servers[0].kill() |
135 | await servers[0].run(ObjectStorageCommand.getDefaultMockConfig(), { env: goodEnv }) | 137 | await servers[0].run(objectStorage.getDefaultMockConfig(), { env: goodEnv }) |
136 | 138 | ||
137 | const { uuid } = await servers[0].videos.quickUpload({ name: 'video' }) | 139 | const { uuid } = await servers[0].videos.quickUpload({ name: 'video' }) |
138 | await waitJobs(servers) | 140 | await waitJobs(servers) |
139 | 141 | ||
140 | const video = await servers[0].videos.get({ id: uuid }) | 142 | const video = await servers[0].videos.get({ id: uuid }) |
141 | 143 | ||
142 | expectStartWith(video.files[0].fileUrl, ObjectStorageCommand.getMockWebTorrentBaseUrl()) | 144 | expectStartWith(video.files[0].fileUrl, objectStorage.getMockWebVideosBaseUrl()) |
143 | }) | 145 | }) |
144 | 146 | ||
145 | it('Should fail to upload to object storage with a wrong proxy config', async function () { | 147 | it('Should fail to upload to object storage with a wrong proxy config', async function () { |
146 | this.timeout(120000) | 148 | this.timeout(120000) |
147 | 149 | ||
148 | await servers[0].kill() | 150 | await servers[0].kill() |
149 | await servers[0].run(ObjectStorageCommand.getDefaultMockConfig(), { env: badEnv }) | 151 | await servers[0].run(objectStorage.getDefaultMockConfig(), { env: badEnv }) |
150 | 152 | ||
151 | const { uuid } = await servers[0].videos.quickUpload({ name: 'video' }) | 153 | const { uuid } = await servers[0].videos.quickUpload({ name: 'video' }) |
152 | await waitJobs(servers, { skipDelayed: true }) | 154 | await waitJobs(servers, { skipDelayed: true }) |
153 | 155 | ||
154 | const video = await servers[0].videos.get({ id: uuid }) | 156 | const video = await servers[0].videos.get({ id: uuid }) |
155 | 157 | ||
156 | expectNotStartWith(video.files[0].fileUrl, ObjectStorageCommand.getMockWebTorrentBaseUrl()) | 158 | expectNotStartWith(video.files[0].fileUrl, objectStorage.getMockWebVideosBaseUrl()) |
159 | }) | ||
160 | |||
161 | after(async function () { | ||
162 | await objectStorage.cleanupMock() | ||
157 | }) | 163 | }) |
158 | }) | 164 | }) |
159 | 165 | ||
diff --git a/server/tests/api/transcoding/create-transcoding.ts b/server/tests/api/transcoding/create-transcoding.ts index 5483c8dba..d6f5b01dc 100644 --- a/server/tests/api/transcoding/create-transcoding.ts +++ b/server/tests/api/transcoding/create-transcoding.ts | |||
@@ -17,9 +17,9 @@ import { | |||
17 | waitJobs | 17 | waitJobs |
18 | } from '@shared/server-commands' | 18 | } from '@shared/server-commands' |
19 | 19 | ||
20 | async function checkFilesInObjectStorage (video: VideoDetails) { | 20 | async function checkFilesInObjectStorage (objectStorage: ObjectStorageCommand, video: VideoDetails) { |
21 | for (const file of video.files) { | 21 | for (const file of video.files) { |
22 | expectStartWith(file.fileUrl, ObjectStorageCommand.getMockWebTorrentBaseUrl()) | 22 | expectStartWith(file.fileUrl, objectStorage.getMockWebVideosBaseUrl()) |
23 | await makeRawRequest({ url: file.fileUrl, expectedStatus: HttpStatusCode.OK_200 }) | 23 | await makeRawRequest({ url: file.fileUrl, expectedStatus: HttpStatusCode.OK_200 }) |
24 | } | 24 | } |
25 | 25 | ||
@@ -27,29 +27,30 @@ async function checkFilesInObjectStorage (video: VideoDetails) { | |||
27 | 27 | ||
28 | const hlsPlaylist = video.streamingPlaylists[0] | 28 | const hlsPlaylist = video.streamingPlaylists[0] |
29 | for (const file of hlsPlaylist.files) { | 29 | for (const file of hlsPlaylist.files) { |
30 | expectStartWith(file.fileUrl, ObjectStorageCommand.getMockPlaylistBaseUrl()) | 30 | expectStartWith(file.fileUrl, objectStorage.getMockPlaylistBaseUrl()) |
31 | await makeRawRequest({ url: file.fileUrl, expectedStatus: HttpStatusCode.OK_200 }) | 31 | await makeRawRequest({ url: file.fileUrl, expectedStatus: HttpStatusCode.OK_200 }) |
32 | } | 32 | } |
33 | 33 | ||
34 | expectStartWith(hlsPlaylist.playlistUrl, ObjectStorageCommand.getMockPlaylistBaseUrl()) | 34 | expectStartWith(hlsPlaylist.playlistUrl, objectStorage.getMockPlaylistBaseUrl()) |
35 | await makeRawRequest({ url: hlsPlaylist.playlistUrl, expectedStatus: HttpStatusCode.OK_200 }) | 35 | await makeRawRequest({ url: hlsPlaylist.playlistUrl, expectedStatus: HttpStatusCode.OK_200 }) |
36 | 36 | ||
37 | expectStartWith(hlsPlaylist.segmentsSha256Url, ObjectStorageCommand.getMockPlaylistBaseUrl()) | 37 | expectStartWith(hlsPlaylist.segmentsSha256Url, objectStorage.getMockPlaylistBaseUrl()) |
38 | await makeRawRequest({ url: hlsPlaylist.segmentsSha256Url, expectedStatus: HttpStatusCode.OK_200 }) | 38 | await makeRawRequest({ url: hlsPlaylist.segmentsSha256Url, expectedStatus: HttpStatusCode.OK_200 }) |
39 | } | 39 | } |
40 | 40 | ||
41 | function runTests (objectStorage: boolean) { | 41 | function runTests (enableObjectStorage: boolean) { |
42 | let servers: PeerTubeServer[] = [] | 42 | let servers: PeerTubeServer[] = [] |
43 | let videoUUID: string | 43 | let videoUUID: string |
44 | let publishedAt: string | 44 | let publishedAt: string |
45 | 45 | ||
46 | let shouldBeDeleted: string[] | 46 | let shouldBeDeleted: string[] |
47 | const objectStorage = new ObjectStorageCommand() | ||
47 | 48 | ||
48 | before(async function () { | 49 | before(async function () { |
49 | this.timeout(120000) | 50 | this.timeout(120000) |
50 | 51 | ||
51 | const config = objectStorage | 52 | const config = enableObjectStorage |
52 | ? ObjectStorageCommand.getDefaultMockConfig() | 53 | ? objectStorage.getDefaultMockConfig() |
53 | : {} | 54 | : {} |
54 | 55 | ||
55 | // Run server 2 to have transcoding enabled | 56 | // Run server 2 to have transcoding enabled |
@@ -60,7 +61,7 @@ function runTests (objectStorage: boolean) { | |||
60 | 61 | ||
61 | await doubleFollow(servers[0], servers[1]) | 62 | await doubleFollow(servers[0], servers[1]) |
62 | 63 | ||
63 | if (objectStorage) await ObjectStorageCommand.prepareDefaultMockBuckets() | 64 | if (enableObjectStorage) await objectStorage.prepareDefaultMockBuckets() |
64 | 65 | ||
65 | const { shortUUID } = await servers[0].videos.quickUpload({ name: 'video' }) | 66 | const { shortUUID } = await servers[0].videos.quickUpload({ name: 'video' }) |
66 | videoUUID = shortUUID | 67 | videoUUID = shortUUID |
@@ -91,7 +92,7 @@ function runTests (objectStorage: boolean) { | |||
91 | expect(videoDetails.streamingPlaylists).to.have.lengthOf(1) | 92 | expect(videoDetails.streamingPlaylists).to.have.lengthOf(1) |
92 | expect(videoDetails.streamingPlaylists[0].files).to.have.lengthOf(5) | 93 | expect(videoDetails.streamingPlaylists[0].files).to.have.lengthOf(5) |
93 | 94 | ||
94 | if (objectStorage) await checkFilesInObjectStorage(videoDetails) | 95 | if (enableObjectStorage) await checkFilesInObjectStorage(objectStorage, videoDetails) |
95 | } | 96 | } |
96 | }) | 97 | }) |
97 | 98 | ||
@@ -112,7 +113,7 @@ function runTests (objectStorage: boolean) { | |||
112 | expect(videoDetails.streamingPlaylists).to.have.lengthOf(1) | 113 | expect(videoDetails.streamingPlaylists).to.have.lengthOf(1) |
113 | expect(videoDetails.streamingPlaylists[0].files).to.have.lengthOf(5) | 114 | expect(videoDetails.streamingPlaylists[0].files).to.have.lengthOf(5) |
114 | 115 | ||
115 | if (objectStorage) await checkFilesInObjectStorage(videoDetails) | 116 | if (enableObjectStorage) await checkFilesInObjectStorage(objectStorage, videoDetails) |
116 | } | 117 | } |
117 | }) | 118 | }) |
118 | 119 | ||
@@ -132,7 +133,7 @@ function runTests (objectStorage: boolean) { | |||
132 | expect(videoDetails.streamingPlaylists).to.have.lengthOf(1) | 133 | expect(videoDetails.streamingPlaylists).to.have.lengthOf(1) |
133 | expect(videoDetails.streamingPlaylists[0].files).to.have.lengthOf(5) | 134 | expect(videoDetails.streamingPlaylists[0].files).to.have.lengthOf(5) |
134 | 135 | ||
135 | if (objectStorage) await checkFilesInObjectStorage(videoDetails) | 136 | if (enableObjectStorage) await checkFilesInObjectStorage(objectStorage, videoDetails) |
136 | } | 137 | } |
137 | }) | 138 | }) |
138 | 139 | ||
@@ -151,7 +152,7 @@ function runTests (objectStorage: boolean) { | |||
151 | expect(videoDetails.files).to.have.lengthOf(5) | 152 | expect(videoDetails.files).to.have.lengthOf(5) |
152 | expect(videoDetails.streamingPlaylists).to.have.lengthOf(0) | 153 | expect(videoDetails.streamingPlaylists).to.have.lengthOf(0) |
153 | 154 | ||
154 | if (objectStorage) await checkFilesInObjectStorage(videoDetails) | 155 | if (enableObjectStorage) await checkFilesInObjectStorage(objectStorage, videoDetails) |
155 | } | 156 | } |
156 | }) | 157 | }) |
157 | 158 | ||
@@ -185,7 +186,7 @@ function runTests (objectStorage: boolean) { | |||
185 | expect(videoDetails.streamingPlaylists).to.have.lengthOf(1) | 186 | expect(videoDetails.streamingPlaylists).to.have.lengthOf(1) |
186 | expect(videoDetails.streamingPlaylists[0].files).to.have.lengthOf(1) | 187 | expect(videoDetails.streamingPlaylists[0].files).to.have.lengthOf(1) |
187 | 188 | ||
188 | if (objectStorage) await checkFilesInObjectStorage(videoDetails) | 189 | if (enableObjectStorage) await checkFilesInObjectStorage(objectStorage, videoDetails) |
189 | 190 | ||
190 | shouldBeDeleted = [ | 191 | shouldBeDeleted = [ |
191 | videoDetails.streamingPlaylists[0].files[0].fileUrl, | 192 | videoDetails.streamingPlaylists[0].files[0].fileUrl, |
@@ -219,8 +220,8 @@ function runTests (objectStorage: boolean) { | |||
219 | expect(videoDetails.streamingPlaylists).to.have.lengthOf(1) | 220 | expect(videoDetails.streamingPlaylists).to.have.lengthOf(1) |
220 | expect(videoDetails.streamingPlaylists[0].files).to.have.lengthOf(5) | 221 | expect(videoDetails.streamingPlaylists[0].files).to.have.lengthOf(5) |
221 | 222 | ||
222 | if (objectStorage) { | 223 | if (enableObjectStorage) { |
223 | await checkFilesInObjectStorage(videoDetails) | 224 | await checkFilesInObjectStorage(objectStorage, videoDetails) |
224 | 225 | ||
225 | const hlsPlaylist = videoDetails.streamingPlaylists[0] | 226 | const hlsPlaylist = videoDetails.streamingPlaylists[0] |
226 | const resolutions = hlsPlaylist.files.map(f => f.resolution.id) | 227 | const resolutions = hlsPlaylist.files.map(f => f.resolution.id) |
@@ -245,6 +246,8 @@ function runTests (objectStorage: boolean) { | |||
245 | }) | 246 | }) |
246 | 247 | ||
247 | after(async function () { | 248 | after(async function () { |
249 | if (objectStorage) await objectStorage.cleanupMock() | ||
250 | |||
248 | await cleanupTests(servers) | 251 | await cleanupTests(servers) |
249 | }) | 252 | }) |
250 | } | 253 | } |
diff --git a/server/tests/api/transcoding/hls.ts b/server/tests/api/transcoding/hls.ts index b6e4fe8e5..c668d7e0b 100644 --- a/server/tests/api/transcoding/hls.ts +++ b/server/tests/api/transcoding/hls.ts | |||
@@ -150,17 +150,23 @@ describe('Test HLS videos', function () { | |||
150 | describe('With object storage enabled', function () { | 150 | describe('With object storage enabled', function () { |
151 | if (areMockObjectStorageTestsDisabled()) return | 151 | if (areMockObjectStorageTestsDisabled()) return |
152 | 152 | ||
153 | const objectStorage = new ObjectStorageCommand() | ||
154 | |||
153 | before(async function () { | 155 | before(async function () { |
154 | this.timeout(120000) | 156 | this.timeout(120000) |
155 | 157 | ||
156 | const configOverride = ObjectStorageCommand.getDefaultMockConfig() | 158 | const configOverride = objectStorage.getDefaultMockConfig() |
157 | await ObjectStorageCommand.prepareDefaultMockBuckets() | 159 | await objectStorage.prepareDefaultMockBuckets() |
158 | 160 | ||
159 | await servers[0].kill() | 161 | await servers[0].kill() |
160 | await servers[0].run(configOverride) | 162 | await servers[0].run(configOverride) |
161 | }) | 163 | }) |
162 | 164 | ||
163 | runTestSuite(true, ObjectStorageCommand.getMockPlaylistBaseUrl()) | 165 | runTestSuite(true, objectStorage.getMockPlaylistBaseUrl()) |
166 | |||
167 | after(async function () { | ||
168 | await objectStorage.cleanupMock() | ||
169 | }) | ||
164 | }) | 170 | }) |
165 | 171 | ||
166 | after(async function () { | 172 | after(async function () { |
diff --git a/server/tests/api/transcoding/update-while-transcoding.ts b/server/tests/api/transcoding/update-while-transcoding.ts index f4d728118..61655f102 100644 --- a/server/tests/api/transcoding/update-while-transcoding.ts +++ b/server/tests/api/transcoding/update-while-transcoding.ts | |||
@@ -135,17 +135,23 @@ describe('Test update video privacy while transcoding', function () { | |||
135 | describe('With object storage enabled', function () { | 135 | describe('With object storage enabled', function () { |
136 | if (areMockObjectStorageTestsDisabled()) return | 136 | if (areMockObjectStorageTestsDisabled()) return |
137 | 137 | ||
138 | const objectStorage = new ObjectStorageCommand() | ||
139 | |||
138 | before(async function () { | 140 | before(async function () { |
139 | this.timeout(120000) | 141 | this.timeout(120000) |
140 | 142 | ||
141 | const configOverride = ObjectStorageCommand.getDefaultMockConfig() | 143 | const configOverride = objectStorage.getDefaultMockConfig() |
142 | await ObjectStorageCommand.prepareDefaultMockBuckets() | 144 | await objectStorage.prepareDefaultMockBuckets() |
143 | 145 | ||
144 | await servers[0].kill() | 146 | await servers[0].kill() |
145 | await servers[0].run(configOverride) | 147 | await servers[0].run(configOverride) |
146 | }) | 148 | }) |
147 | 149 | ||
148 | runTestSuite(true, ObjectStorageCommand.getMockPlaylistBaseUrl()) | 150 | runTestSuite(true, objectStorage.getMockPlaylistBaseUrl()) |
151 | |||
152 | after(async function () { | ||
153 | await objectStorage.cleanupMock() | ||
154 | }) | ||
149 | }) | 155 | }) |
150 | 156 | ||
151 | after(async function () { | 157 | after(async function () { |
diff --git a/server/tests/api/transcoding/video-studio.ts b/server/tests/api/transcoding/video-studio.ts index 35efc3d49..d1298caf7 100644 --- a/server/tests/api/transcoding/video-studio.ts +++ b/server/tests/api/transcoding/video-studio.ts | |||
@@ -326,11 +326,13 @@ describe('Test video studio', function () { | |||
326 | describe('Object storage studio edition', function () { | 326 | describe('Object storage studio edition', function () { |
327 | if (areMockObjectStorageTestsDisabled()) return | 327 | if (areMockObjectStorageTestsDisabled()) return |
328 | 328 | ||
329 | const objectStorage = new ObjectStorageCommand() | ||
330 | |||
329 | before(async function () { | 331 | before(async function () { |
330 | await ObjectStorageCommand.prepareDefaultMockBuckets() | 332 | await objectStorage.prepareDefaultMockBuckets() |
331 | 333 | ||
332 | await servers[0].kill() | 334 | await servers[0].kill() |
333 | await servers[0].run(ObjectStorageCommand.getDefaultMockConfig()) | 335 | await servers[0].run(objectStorage.getDefaultMockConfig()) |
334 | 336 | ||
335 | await servers[0].config.enableMinimumTranscoding() | 337 | await servers[0].config.enableMinimumTranscoding() |
336 | }) | 338 | }) |
@@ -353,16 +355,20 @@ describe('Test video studio', function () { | |||
353 | } | 355 | } |
354 | 356 | ||
355 | for (const webtorrentFile of video.files) { | 357 | for (const webtorrentFile of video.files) { |
356 | expectStartWith(webtorrentFile.fileUrl, ObjectStorageCommand.getMockWebTorrentBaseUrl()) | 358 | expectStartWith(webtorrentFile.fileUrl, objectStorage.getMockWebVideosBaseUrl()) |
357 | } | 359 | } |
358 | 360 | ||
359 | for (const hlsFile of video.streamingPlaylists[0].files) { | 361 | for (const hlsFile of video.streamingPlaylists[0].files) { |
360 | expectStartWith(hlsFile.fileUrl, ObjectStorageCommand.getMockPlaylistBaseUrl()) | 362 | expectStartWith(hlsFile.fileUrl, objectStorage.getMockPlaylistBaseUrl()) |
361 | } | 363 | } |
362 | 364 | ||
363 | await checkVideoDuration(server, videoUUID, 9) | 365 | await checkVideoDuration(server, videoUUID, 9) |
364 | } | 366 | } |
365 | }) | 367 | }) |
368 | |||
369 | after(async function () { | ||
370 | await objectStorage.cleanupMock() | ||
371 | }) | ||
366 | }) | 372 | }) |
367 | 373 | ||
368 | after(async function () { | 374 | after(async function () { |