diff options
Diffstat (limited to 'server/tests')
-rw-r--r-- | server/tests/api/object-storage/index.ts | 1 | ||||
-rw-r--r-- | server/tests/api/object-storage/live.ts | 10 | ||||
-rw-r--r-- | server/tests/api/object-storage/video-imports.ts | 14 | ||||
-rw-r--r-- | server/tests/api/object-storage/video-static-file-privacy.ts | 336 | ||||
-rw-r--r-- | server/tests/api/object-storage/videos.ts | 36 | ||||
-rw-r--r-- | server/tests/api/server/proxy.ts | 14 | ||||
-rw-r--r-- | server/tests/api/transcoding/create-transcoding.ts | 16 | ||||
-rw-r--r-- | server/tests/api/transcoding/hls.ts | 10 | ||||
-rw-r--r-- | server/tests/api/transcoding/update-while-transcoding.ts | 10 | ||||
-rw-r--r-- | server/tests/api/transcoding/video-studio.ts | 12 | ||||
-rw-r--r-- | server/tests/api/videos/video-static-file-privacy.ts | 14 | ||||
-rw-r--r-- | server/tests/cli/create-import-video-file-job.ts | 10 | ||||
-rw-r--r-- | server/tests/cli/create-move-video-storage-job.ts | 16 | ||||
-rw-r--r-- | server/tests/cli/create-transcoding-job.ts | 12 | ||||
-rw-r--r-- | server/tests/shared/live.ts | 6 | ||||
-rw-r--r-- | server/tests/shared/mock-servers/mock-object-storage.ts | 2 |
16 files changed, 428 insertions, 91 deletions
diff --git a/server/tests/api/object-storage/index.ts b/server/tests/api/object-storage/index.ts index f319d6ef5..1f4489fa3 100644 --- a/server/tests/api/object-storage/index.ts +++ b/server/tests/api/object-storage/index.ts | |||
@@ -1,3 +1,4 @@ | |||
1 | export * from './live' | 1 | export * from './live' |
2 | export * from './video-imports' | 2 | export * from './video-imports' |
3 | export * from './video-static-file-privacy' | ||
3 | export * from './videos' | 4 | export * from './videos' |
diff --git a/server/tests/api/object-storage/live.ts b/server/tests/api/object-storage/live.ts index 77f3a8066..ad2b554b7 100644 --- a/server/tests/api/object-storage/live.ts +++ b/server/tests/api/object-storage/live.ts | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | import { expect } from 'chai' | 3 | import { expect } from 'chai' |
4 | import { expectStartWith, testVideoResolutions } from '@server/tests/shared' | 4 | import { expectStartWith, testVideoResolutions } from '@server/tests/shared' |
5 | import { areObjectStorageTestsDisabled } 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 { |
8 | createMultipleServers, | 8 | createMultipleServers, |
@@ -46,7 +46,7 @@ async function checkFilesExist (servers: PeerTubeServer[], videoUUID: string, nu | |||
46 | expect(files).to.have.lengthOf(numberOfFiles) | 46 | expect(files).to.have.lengthOf(numberOfFiles) |
47 | 47 | ||
48 | for (const file of files) { | 48 | for (const file of files) { |
49 | expectStartWith(file.fileUrl, ObjectStorageCommand.getPlaylistBaseUrl()) | 49 | expectStartWith(file.fileUrl, ObjectStorageCommand.getMockPlaylistBaseUrl()) |
50 | 50 | ||
51 | await makeRawRequest({ url: file.fileUrl, expectedStatus: HttpStatusCode.OK_200 }) | 51 | await makeRawRequest({ url: file.fileUrl, expectedStatus: HttpStatusCode.OK_200 }) |
52 | } | 52 | } |
@@ -75,16 +75,16 @@ async function checkFilesCleanup (server: PeerTubeServer, videoUUID: string, res | |||
75 | } | 75 | } |
76 | 76 | ||
77 | describe('Object storage for lives', function () { | 77 | describe('Object storage for lives', function () { |
78 | if (areObjectStorageTestsDisabled()) return | 78 | if (areMockObjectStorageTestsDisabled()) return |
79 | 79 | ||
80 | let servers: PeerTubeServer[] | 80 | let servers: PeerTubeServer[] |
81 | 81 | ||
82 | before(async function () { | 82 | before(async function () { |
83 | this.timeout(120000) | 83 | this.timeout(120000) |
84 | 84 | ||
85 | await ObjectStorageCommand.prepareDefaultBuckets() | 85 | await ObjectStorageCommand.prepareDefaultMockBuckets() |
86 | 86 | ||
87 | servers = await createMultipleServers(2, ObjectStorageCommand.getDefaultConfig()) | 87 | servers = await createMultipleServers(2, ObjectStorageCommand.getDefaultMockConfig()) |
88 | 88 | ||
89 | await setAccessTokensToServers(servers) | 89 | await setAccessTokensToServers(servers) |
90 | await setDefaultVideoChannel(servers) | 90 | await setDefaultVideoChannel(servers) |
diff --git a/server/tests/api/object-storage/video-imports.ts b/server/tests/api/object-storage/video-imports.ts index 90988ea9a..11c866411 100644 --- a/server/tests/api/object-storage/video-imports.ts +++ b/server/tests/api/object-storage/video-imports.ts | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | import { expect } from 'chai' | 3 | import { expect } from 'chai' |
4 | import { expectStartWith, FIXTURE_URLS } from '@server/tests/shared' | 4 | import { expectStartWith, FIXTURE_URLS } from '@server/tests/shared' |
5 | import { areObjectStorageTestsDisabled } from '@shared/core-utils' | 5 | import { areMockObjectStorageTestsDisabled } from '@shared/core-utils' |
6 | import { HttpStatusCode, VideoPrivacy } from '@shared/models' | 6 | import { HttpStatusCode, VideoPrivacy } from '@shared/models' |
7 | import { | 7 | import { |
8 | createSingleServer, | 8 | createSingleServer, |
@@ -29,16 +29,16 @@ async function importVideo (server: PeerTubeServer) { | |||
29 | } | 29 | } |
30 | 30 | ||
31 | describe('Object storage for video import', function () { | 31 | describe('Object storage for video import', function () { |
32 | if (areObjectStorageTestsDisabled()) return | 32 | if (areMockObjectStorageTestsDisabled()) return |
33 | 33 | ||
34 | let server: PeerTubeServer | 34 | let server: PeerTubeServer |
35 | 35 | ||
36 | before(async function () { | 36 | before(async function () { |
37 | this.timeout(120000) | 37 | this.timeout(120000) |
38 | 38 | ||
39 | await ObjectStorageCommand.prepareDefaultBuckets() | 39 | await ObjectStorageCommand.prepareDefaultMockBuckets() |
40 | 40 | ||
41 | server = await createSingleServer(1, ObjectStorageCommand.getDefaultConfig()) | 41 | server = await createSingleServer(1, ObjectStorageCommand.getDefaultMockConfig()) |
42 | 42 | ||
43 | await setAccessTokensToServers([ server ]) | 43 | await setAccessTokensToServers([ server ]) |
44 | await setDefaultVideoChannel([ server ]) | 44 | await setDefaultVideoChannel([ server ]) |
@@ -64,7 +64,7 @@ describe('Object storage for video import', function () { | |||
64 | expect(video.streamingPlaylists).to.have.lengthOf(0) | 64 | expect(video.streamingPlaylists).to.have.lengthOf(0) |
65 | 65 | ||
66 | const fileUrl = video.files[0].fileUrl | 66 | const fileUrl = video.files[0].fileUrl |
67 | expectStartWith(fileUrl, ObjectStorageCommand.getWebTorrentBaseUrl()) | 67 | expectStartWith(fileUrl, ObjectStorageCommand.getMockWebTorrentBaseUrl()) |
68 | 68 | ||
69 | await makeRawRequest({ url: fileUrl, expectedStatus: HttpStatusCode.OK_200 }) | 69 | await makeRawRequest({ url: fileUrl, expectedStatus: HttpStatusCode.OK_200 }) |
70 | }) | 70 | }) |
@@ -89,13 +89,13 @@ describe('Object storage for video import', function () { | |||
89 | expect(video.streamingPlaylists[0].files).to.have.lengthOf(5) | 89 | expect(video.streamingPlaylists[0].files).to.have.lengthOf(5) |
90 | 90 | ||
91 | for (const file of video.files) { | 91 | for (const file of video.files) { |
92 | expectStartWith(file.fileUrl, ObjectStorageCommand.getWebTorrentBaseUrl()) | 92 | expectStartWith(file.fileUrl, ObjectStorageCommand.getMockWebTorrentBaseUrl()) |
93 | 93 | ||
94 | await makeRawRequest({ url: file.fileUrl, expectedStatus: HttpStatusCode.OK_200 }) | 94 | await makeRawRequest({ url: file.fileUrl, expectedStatus: HttpStatusCode.OK_200 }) |
95 | } | 95 | } |
96 | 96 | ||
97 | for (const file of video.streamingPlaylists[0].files) { | 97 | for (const file of video.streamingPlaylists[0].files) { |
98 | expectStartWith(file.fileUrl, ObjectStorageCommand.getPlaylistBaseUrl()) | 98 | expectStartWith(file.fileUrl, ObjectStorageCommand.getMockPlaylistBaseUrl()) |
99 | 99 | ||
100 | await makeRawRequest({ url: file.fileUrl, expectedStatus: HttpStatusCode.OK_200 }) | 100 | await makeRawRequest({ url: file.fileUrl, expectedStatus: HttpStatusCode.OK_200 }) |
101 | } | 101 | } |
diff --git a/server/tests/api/object-storage/video-static-file-privacy.ts b/server/tests/api/object-storage/video-static-file-privacy.ts new file mode 100644 index 000000000..981bbaa16 --- /dev/null +++ b/server/tests/api/object-storage/video-static-file-privacy.ts | |||
@@ -0,0 +1,336 @@ | |||
1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ | ||
2 | |||
3 | import { expect } from 'chai' | ||
4 | import { basename } from 'path' | ||
5 | import { expectStartWith } from '@server/tests/shared' | ||
6 | import { areScalewayObjectStorageTestsDisabled, getAllFiles, getHLS } from '@shared/core-utils' | ||
7 | import { HttpStatusCode, LiveVideo, VideoDetails, VideoPrivacy } from '@shared/models' | ||
8 | import { | ||
9 | cleanupTests, | ||
10 | createSingleServer, | ||
11 | findExternalSavedVideo, | ||
12 | makeRawRequest, | ||
13 | ObjectStorageCommand, | ||
14 | PeerTubeServer, | ||
15 | sendRTMPStream, | ||
16 | setAccessTokensToServers, | ||
17 | setDefaultVideoChannel, | ||
18 | stopFfmpeg, | ||
19 | waitJobs | ||
20 | } from '@shared/server-commands' | ||
21 | |||
22 | describe('Object storage for video static file privacy', function () { | ||
23 | // We need real world object storage to check ACL | ||
24 | if (areScalewayObjectStorageTestsDisabled()) return | ||
25 | |||
26 | let server: PeerTubeServer | ||
27 | let userToken: string | ||
28 | |||
29 | before(async function () { | ||
30 | this.timeout(120000) | ||
31 | |||
32 | server = await createSingleServer(1, ObjectStorageCommand.getDefaultScalewayConfig(1)) | ||
33 | await setAccessTokensToServers([ server ]) | ||
34 | await setDefaultVideoChannel([ server ]) | ||
35 | |||
36 | await server.config.enableMinimumTranscoding() | ||
37 | |||
38 | userToken = await server.users.generateUserAndToken('user1') | ||
39 | }) | ||
40 | |||
41 | describe('VOD', function () { | ||
42 | let privateVideoUUID: string | ||
43 | let publicVideoUUID: string | ||
44 | let userPrivateVideoUUID: string | ||
45 | |||
46 | async function checkPrivateFiles (uuid: string) { | ||
47 | const video = await server.videos.getWithToken({ id: uuid }) | ||
48 | |||
49 | for (const file of video.files) { | ||
50 | expectStartWith(file.fileUrl, server.url + '/object-storage-proxy/webseed/private/') | ||
51 | |||
52 | await makeRawRequest({ url: file.fileUrl, token: server.accessToken, expectedStatus: HttpStatusCode.OK_200 }) | ||
53 | } | ||
54 | |||
55 | for (const file of getAllFiles(video)) { | ||
56 | const internalFileUrl = await server.sql.getInternalFileUrl(file.id) | ||
57 | expectStartWith(internalFileUrl, ObjectStorageCommand.getScalewayBaseUrl()) | ||
58 | await makeRawRequest({ url: internalFileUrl, token: server.accessToken, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) | ||
59 | } | ||
60 | |||
61 | const hls = getHLS(video) | ||
62 | |||
63 | if (hls) { | ||
64 | for (const url of [ hls.playlistUrl, hls.segmentsSha256Url ]) { | ||
65 | expectStartWith(url, server.url + '/object-storage-proxy/streaming-playlists/hls/private/') | ||
66 | } | ||
67 | |||
68 | await makeRawRequest({ url: hls.playlistUrl, token: server.accessToken, expectedStatus: HttpStatusCode.OK_200 }) | ||
69 | await makeRawRequest({ url: hls.segmentsSha256Url, token: server.accessToken, expectedStatus: HttpStatusCode.OK_200 }) | ||
70 | |||
71 | for (const file of hls.files) { | ||
72 | expectStartWith(file.fileUrl, server.url + '/object-storage-proxy/streaming-playlists/hls/private/') | ||
73 | |||
74 | await makeRawRequest({ url: file.fileUrl, token: server.accessToken, expectedStatus: HttpStatusCode.OK_200 }) | ||
75 | } | ||
76 | } | ||
77 | } | ||
78 | |||
79 | async function checkPublicFiles (uuid: string) { | ||
80 | const video = await server.videos.getWithToken({ id: uuid }) | ||
81 | |||
82 | for (const file of getAllFiles(video)) { | ||
83 | expectStartWith(file.fileUrl, ObjectStorageCommand.getScalewayBaseUrl()) | ||
84 | |||
85 | await makeRawRequest({ url: file.fileUrl, expectedStatus: HttpStatusCode.OK_200 }) | ||
86 | } | ||
87 | |||
88 | const hls = getHLS(video) | ||
89 | |||
90 | if (hls) { | ||
91 | expectStartWith(hls.playlistUrl, ObjectStorageCommand.getScalewayBaseUrl()) | ||
92 | expectStartWith(hls.segmentsSha256Url, ObjectStorageCommand.getScalewayBaseUrl()) | ||
93 | |||
94 | await makeRawRequest({ url: hls.playlistUrl, expectedStatus: HttpStatusCode.OK_200 }) | ||
95 | await makeRawRequest({ url: hls.segmentsSha256Url, expectedStatus: HttpStatusCode.OK_200 }) | ||
96 | } | ||
97 | } | ||
98 | |||
99 | async function getSampleFileUrls (videoId: string) { | ||
100 | const video = await server.videos.getWithToken({ id: videoId }) | ||
101 | |||
102 | return { | ||
103 | webTorrentFile: video.files[0].fileUrl, | ||
104 | hlsFile: getHLS(video).files[0].fileUrl | ||
105 | } | ||
106 | } | ||
107 | |||
108 | it('Should upload a private video and have appropriate object storage ACL', async function () { | ||
109 | this.timeout(60000) | ||
110 | |||
111 | { | ||
112 | const { uuid } = await server.videos.quickUpload({ name: 'video', privacy: VideoPrivacy.PRIVATE }) | ||
113 | privateVideoUUID = uuid | ||
114 | } | ||
115 | |||
116 | { | ||
117 | const { uuid } = await server.videos.quickUpload({ name: 'user video', token: userToken, privacy: VideoPrivacy.PRIVATE }) | ||
118 | userPrivateVideoUUID = uuid | ||
119 | } | ||
120 | |||
121 | await waitJobs([ server ]) | ||
122 | |||
123 | await checkPrivateFiles(privateVideoUUID) | ||
124 | }) | ||
125 | |||
126 | it('Should upload a public video and have appropriate object storage ACL', async function () { | ||
127 | this.timeout(60000) | ||
128 | |||
129 | const { uuid } = await server.videos.quickUpload({ name: 'video', privacy: VideoPrivacy.UNLISTED }) | ||
130 | await waitJobs([ server ]) | ||
131 | |||
132 | publicVideoUUID = uuid | ||
133 | |||
134 | await checkPublicFiles(publicVideoUUID) | ||
135 | }) | ||
136 | |||
137 | it('Should not get files without appropriate OAuth token', async function () { | ||
138 | this.timeout(60000) | ||
139 | |||
140 | const { webTorrentFile, hlsFile } = await getSampleFileUrls(privateVideoUUID) | ||
141 | |||
142 | await makeRawRequest({ url: webTorrentFile, token: userToken, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) | ||
143 | await makeRawRequest({ url: webTorrentFile, token: server.accessToken, expectedStatus: HttpStatusCode.OK_200 }) | ||
144 | |||
145 | await makeRawRequest({ url: hlsFile, token: userToken, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) | ||
146 | await makeRawRequest({ url: hlsFile, token: server.accessToken, expectedStatus: HttpStatusCode.OK_200 }) | ||
147 | }) | ||
148 | |||
149 | it('Should not get HLS file of another video', async function () { | ||
150 | this.timeout(60000) | ||
151 | |||
152 | const privateVideo = await server.videos.getWithToken({ id: privateVideoUUID }) | ||
153 | const hlsFilename = basename(getHLS(privateVideo).files[0].fileUrl) | ||
154 | |||
155 | const badUrl = server.url + '/object-storage-proxy/streaming-playlists/hls/private/' + userPrivateVideoUUID + '/' + hlsFilename | ||
156 | const goodUrl = server.url + '/object-storage-proxy/streaming-playlists/hls/private/' + privateVideoUUID + '/' + hlsFilename | ||
157 | |||
158 | await makeRawRequest({ url: badUrl, token: server.accessToken, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) | ||
159 | await makeRawRequest({ url: goodUrl, token: server.accessToken, expectedStatus: HttpStatusCode.OK_200 }) | ||
160 | }) | ||
161 | |||
162 | it('Should correctly check OAuth or video file token', async function () { | ||
163 | this.timeout(60000) | ||
164 | |||
165 | const badVideoFileToken = await server.videoToken.getVideoFileToken({ token: userToken, videoId: userPrivateVideoUUID }) | ||
166 | const goodVideoFileToken = await server.videoToken.getVideoFileToken({ videoId: privateVideoUUID }) | ||
167 | |||
168 | const { webTorrentFile, hlsFile } = await getSampleFileUrls(privateVideoUUID) | ||
169 | |||
170 | for (const url of [ webTorrentFile, hlsFile ]) { | ||
171 | await makeRawRequest({ url, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) | ||
172 | await makeRawRequest({ url, token: userToken, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) | ||
173 | await makeRawRequest({ url, token: server.accessToken, expectedStatus: HttpStatusCode.OK_200 }) | ||
174 | |||
175 | await makeRawRequest({ url, query: { videoFileToken: badVideoFileToken }, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) | ||
176 | await makeRawRequest({ url, query: { videoFileToken: goodVideoFileToken }, expectedStatus: HttpStatusCode.OK_200 }) | ||
177 | } | ||
178 | }) | ||
179 | |||
180 | it('Should update public video to private', async function () { | ||
181 | this.timeout(60000) | ||
182 | |||
183 | await server.videos.update({ id: publicVideoUUID, attributes: { privacy: VideoPrivacy.INTERNAL } }) | ||
184 | |||
185 | await checkPrivateFiles(publicVideoUUID) | ||
186 | }) | ||
187 | |||
188 | it('Should update private video to public', async function () { | ||
189 | this.timeout(60000) | ||
190 | |||
191 | await server.videos.update({ id: publicVideoUUID, attributes: { privacy: VideoPrivacy.PUBLIC } }) | ||
192 | |||
193 | await checkPublicFiles(publicVideoUUID) | ||
194 | }) | ||
195 | |||
196 | after(async function () { | ||
197 | this.timeout(30000) | ||
198 | |||
199 | if (privateVideoUUID) await server.videos.remove({ id: privateVideoUUID }) | ||
200 | if (publicVideoUUID) await server.videos.remove({ id: publicVideoUUID }) | ||
201 | if (userPrivateVideoUUID) await server.videos.remove({ id: userPrivateVideoUUID }) | ||
202 | |||
203 | await waitJobs([ server ]) | ||
204 | }) | ||
205 | }) | ||
206 | |||
207 | describe('Live', function () { | ||
208 | let normalLiveId: string | ||
209 | let normalLive: LiveVideo | ||
210 | |||
211 | let permanentLiveId: string | ||
212 | let permanentLive: LiveVideo | ||
213 | |||
214 | let unrelatedFileToken: string | ||
215 | |||
216 | async function checkLiveFiles (live: LiveVideo, liveId: string) { | ||
217 | const ffmpegCommand = sendRTMPStream({ rtmpBaseUrl: live.rtmpUrl, streamKey: live.streamKey }) | ||
218 | await server.live.waitUntilPublished({ videoId: liveId }) | ||
219 | |||
220 | const video = await server.videos.getWithToken({ id: liveId }) | ||
221 | const fileToken = await server.videoToken.getVideoFileToken({ videoId: video.uuid }) | ||
222 | |||
223 | const hls = video.streamingPlaylists[0] | ||
224 | |||
225 | for (const url of [ hls.playlistUrl, hls.segmentsSha256Url ]) { | ||
226 | expectStartWith(url, server.url + '/object-storage-proxy/streaming-playlists/hls/private/') | ||
227 | |||
228 | await makeRawRequest({ url: hls.playlistUrl, token: server.accessToken, expectedStatus: HttpStatusCode.OK_200 }) | ||
229 | await makeRawRequest({ url: hls.segmentsSha256Url, token: server.accessToken, expectedStatus: HttpStatusCode.OK_200 }) | ||
230 | |||
231 | await makeRawRequest({ url, token: server.accessToken, expectedStatus: HttpStatusCode.OK_200 }) | ||
232 | await makeRawRequest({ url, query: { videoFileToken: fileToken }, expectedStatus: HttpStatusCode.OK_200 }) | ||
233 | |||
234 | await makeRawRequest({ url, token: userToken, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) | ||
235 | await makeRawRequest({ url, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) | ||
236 | await makeRawRequest({ url, query: { videoFileToken: unrelatedFileToken }, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) | ||
237 | } | ||
238 | |||
239 | await stopFfmpeg(ffmpegCommand) | ||
240 | } | ||
241 | |||
242 | async function checkReplay (replay: VideoDetails) { | ||
243 | const fileToken = await server.videoToken.getVideoFileToken({ videoId: replay.uuid }) | ||
244 | |||
245 | const hls = replay.streamingPlaylists[0] | ||
246 | expect(hls.files).to.not.have.lengthOf(0) | ||
247 | |||
248 | for (const file of hls.files) { | ||
249 | await makeRawRequest({ url: file.fileUrl, token: server.accessToken, expectedStatus: HttpStatusCode.OK_200 }) | ||
250 | await makeRawRequest({ url: file.fileUrl, query: { videoFileToken: fileToken }, expectedStatus: HttpStatusCode.OK_200 }) | ||
251 | |||
252 | await makeRawRequest({ url: file.fileUrl, token: userToken, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) | ||
253 | await makeRawRequest({ url: file.fileUrl, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) | ||
254 | await makeRawRequest({ | ||
255 | url: file.fileUrl, | ||
256 | query: { videoFileToken: unrelatedFileToken }, | ||
257 | expectedStatus: HttpStatusCode.FORBIDDEN_403 | ||
258 | }) | ||
259 | } | ||
260 | |||
261 | for (const url of [ hls.playlistUrl, hls.segmentsSha256Url ]) { | ||
262 | expectStartWith(url, server.url + '/object-storage-proxy/streaming-playlists/hls/private/') | ||
263 | |||
264 | await makeRawRequest({ url, token: server.accessToken, expectedStatus: HttpStatusCode.OK_200 }) | ||
265 | await makeRawRequest({ url, query: { videoFileToken: fileToken }, expectedStatus: HttpStatusCode.OK_200 }) | ||
266 | |||
267 | await makeRawRequest({ url, token: userToken, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) | ||
268 | await makeRawRequest({ url, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) | ||
269 | await makeRawRequest({ url, query: { videoFileToken: unrelatedFileToken }, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) | ||
270 | } | ||
271 | } | ||
272 | |||
273 | before(async function () { | ||
274 | await server.config.enableMinimumTranscoding() | ||
275 | |||
276 | const { uuid } = await server.videos.quickUpload({ name: 'another video' }) | ||
277 | unrelatedFileToken = await server.videoToken.getVideoFileToken({ videoId: uuid }) | ||
278 | |||
279 | await server.config.enableLive({ | ||
280 | allowReplay: true, | ||
281 | transcoding: true, | ||
282 | resolutions: 'min' | ||
283 | }) | ||
284 | |||
285 | { | ||
286 | const { video, live } = await server.live.quickCreate({ saveReplay: true, permanentLive: false, privacy: VideoPrivacy.PRIVATE }) | ||
287 | normalLiveId = video.uuid | ||
288 | normalLive = live | ||
289 | } | ||
290 | |||
291 | { | ||
292 | const { video, live } = await server.live.quickCreate({ saveReplay: true, permanentLive: true, privacy: VideoPrivacy.PRIVATE }) | ||
293 | permanentLiveId = video.uuid | ||
294 | permanentLive = live | ||
295 | } | ||
296 | }) | ||
297 | |||
298 | it('Should create a private normal live and have a private static path', async function () { | ||
299 | this.timeout(240000) | ||
300 | |||
301 | await checkLiveFiles(normalLive, normalLiveId) | ||
302 | }) | ||
303 | |||
304 | it('Should create a private permanent live and have a private static path', async function () { | ||
305 | this.timeout(240000) | ||
306 | |||
307 | await checkLiveFiles(permanentLive, permanentLiveId) | ||
308 | }) | ||
309 | |||
310 | it('Should have created a replay of the normal live with a private static path', async function () { | ||
311 | this.timeout(240000) | ||
312 | |||
313 | await server.live.waitUntilReplacedByReplay({ videoId: normalLiveId }) | ||
314 | |||
315 | const replay = await server.videos.getWithToken({ id: normalLiveId }) | ||
316 | await checkReplay(replay) | ||
317 | }) | ||
318 | |||
319 | it('Should have created a replay of the permanent live with a private static path', async function () { | ||
320 | this.timeout(240000) | ||
321 | |||
322 | await server.live.waitUntilWaiting({ videoId: permanentLiveId }) | ||
323 | await waitJobs([ server ]) | ||
324 | |||
325 | const live = await server.videos.getWithToken({ id: permanentLiveId }) | ||
326 | const replayFromList = await findExternalSavedVideo(server, live) | ||
327 | const replay = await server.videos.getWithToken({ id: replayFromList.id }) | ||
328 | |||
329 | await checkReplay(replay) | ||
330 | }) | ||
331 | }) | ||
332 | |||
333 | after(async function () { | ||
334 | await cleanupTests([ server ]) | ||
335 | }) | ||
336 | }) | ||
diff --git a/server/tests/api/object-storage/videos.ts b/server/tests/api/object-storage/videos.ts index 63f5179c7..af3db9334 100644 --- a/server/tests/api/object-storage/videos.ts +++ b/server/tests/api/object-storage/videos.ts | |||
@@ -11,7 +11,7 @@ import { | |||
11 | generateHighBitrateVideo, | 11 | generateHighBitrateVideo, |
12 | MockObjectStorage | 12 | MockObjectStorage |
13 | } from '@server/tests/shared' | 13 | } from '@server/tests/shared' |
14 | import { areObjectStorageTestsDisabled } from '@shared/core-utils' | 14 | import { areMockObjectStorageTestsDisabled } from '@shared/core-utils' |
15 | import { HttpStatusCode, VideoDetails } from '@shared/models' | 15 | import { HttpStatusCode, VideoDetails } from '@shared/models' |
16 | import { | 16 | import { |
17 | cleanupTests, | 17 | cleanupTests, |
@@ -52,7 +52,7 @@ async function checkFiles (options: { | |||
52 | for (const file of video.files) { | 52 | for (const file of video.files) { |
53 | const baseUrl = baseMockUrl | 53 | const baseUrl = baseMockUrl |
54 | ? `${baseMockUrl}/${webtorrentBucket}/` | 54 | ? `${baseMockUrl}/${webtorrentBucket}/` |
55 | : `http://${webtorrentBucket}.${ObjectStorageCommand.getEndpointHost()}/` | 55 | : `http://${webtorrentBucket}.${ObjectStorageCommand.getMockEndpointHost()}/` |
56 | 56 | ||
57 | const prefix = webtorrentPrefix || '' | 57 | const prefix = webtorrentPrefix || '' |
58 | const start = baseUrl + prefix | 58 | const start = baseUrl + prefix |
@@ -73,7 +73,7 @@ async function checkFiles (options: { | |||
73 | 73 | ||
74 | const baseUrl = baseMockUrl | 74 | const baseUrl = baseMockUrl |
75 | ? `${baseMockUrl}/${playlistBucket}/` | 75 | ? `${baseMockUrl}/${playlistBucket}/` |
76 | : `http://${playlistBucket}.${ObjectStorageCommand.getEndpointHost()}/` | 76 | : `http://${playlistBucket}.${ObjectStorageCommand.getMockEndpointHost()}/` |
77 | 77 | ||
78 | const prefix = playlistPrefix || '' | 78 | const prefix = playlistPrefix || '' |
79 | const start = baseUrl + prefix | 79 | const start = baseUrl + prefix |
@@ -141,16 +141,16 @@ function runTestSuite (options: { | |||
141 | const port = await mockObjectStorage.initialize() | 141 | const port = await mockObjectStorage.initialize() |
142 | baseMockUrl = options.useMockBaseUrl ? `http://localhost:${port}` : undefined | 142 | baseMockUrl = options.useMockBaseUrl ? `http://localhost:${port}` : undefined |
143 | 143 | ||
144 | await ObjectStorageCommand.createBucket(options.playlistBucket) | 144 | await ObjectStorageCommand.createMockBucket(options.playlistBucket) |
145 | await ObjectStorageCommand.createBucket(options.webtorrentBucket) | 145 | await ObjectStorageCommand.createMockBucket(options.webtorrentBucket) |
146 | 146 | ||
147 | const config = { | 147 | const config = { |
148 | object_storage: { | 148 | object_storage: { |
149 | enabled: true, | 149 | enabled: true, |
150 | endpoint: 'http://' + ObjectStorageCommand.getEndpointHost(), | 150 | endpoint: 'http://' + ObjectStorageCommand.getMockEndpointHost(), |
151 | region: ObjectStorageCommand.getRegion(), | 151 | region: ObjectStorageCommand.getMockRegion(), |
152 | 152 | ||
153 | credentials: ObjectStorageCommand.getCredentialsConfig(), | 153 | credentials: ObjectStorageCommand.getMockCredentialsConfig(), |
154 | 154 | ||
155 | max_upload_part: options.maxUploadPart || '5MB', | 155 | max_upload_part: options.maxUploadPart || '5MB', |
156 | 156 | ||
@@ -261,7 +261,7 @@ function runTestSuite (options: { | |||
261 | } | 261 | } |
262 | 262 | ||
263 | describe('Object storage for videos', function () { | 263 | describe('Object storage for videos', function () { |
264 | if (areObjectStorageTestsDisabled()) return | 264 | if (areMockObjectStorageTestsDisabled()) return |
265 | 265 | ||
266 | describe('Test config', function () { | 266 | describe('Test config', function () { |
267 | let server: PeerTubeServer | 267 | let server: PeerTubeServer |
@@ -269,17 +269,17 @@ describe('Object storage for videos', function () { | |||
269 | const baseConfig = { | 269 | const baseConfig = { |
270 | object_storage: { | 270 | object_storage: { |
271 | enabled: true, | 271 | enabled: true, |
272 | endpoint: 'http://' + ObjectStorageCommand.getEndpointHost(), | 272 | endpoint: 'http://' + ObjectStorageCommand.getMockEndpointHost(), |
273 | region: ObjectStorageCommand.getRegion(), | 273 | region: ObjectStorageCommand.getMockRegion(), |
274 | 274 | ||
275 | credentials: ObjectStorageCommand.getCredentialsConfig(), | 275 | credentials: ObjectStorageCommand.getMockCredentialsConfig(), |
276 | 276 | ||
277 | streaming_playlists: { | 277 | streaming_playlists: { |
278 | bucket_name: ObjectStorageCommand.DEFAULT_PLAYLIST_BUCKET | 278 | bucket_name: ObjectStorageCommand.DEFAULT_PLAYLIST_MOCK_BUCKET |
279 | }, | 279 | }, |
280 | 280 | ||
281 | videos: { | 281 | videos: { |
282 | bucket_name: ObjectStorageCommand.DEFAULT_WEBTORRENT_BUCKET | 282 | bucket_name: ObjectStorageCommand.DEFAULT_WEBTORRENT_MOCK_BUCKET |
283 | } | 283 | } |
284 | } | 284 | } |
285 | } | 285 | } |
@@ -310,7 +310,7 @@ describe('Object storage for videos', function () { | |||
310 | it('Should fail with bad credentials', async function () { | 310 | it('Should fail with bad credentials', async function () { |
311 | this.timeout(60000) | 311 | this.timeout(60000) |
312 | 312 | ||
313 | await ObjectStorageCommand.prepareDefaultBuckets() | 313 | await ObjectStorageCommand.prepareDefaultMockBuckets() |
314 | 314 | ||
315 | const config = merge({}, baseConfig, { | 315 | const config = merge({}, baseConfig, { |
316 | object_storage: { | 316 | object_storage: { |
@@ -334,7 +334,7 @@ describe('Object storage for videos', function () { | |||
334 | it('Should succeed with credentials from env', async function () { | 334 | it('Should succeed with credentials from env', async function () { |
335 | this.timeout(60000) | 335 | this.timeout(60000) |
336 | 336 | ||
337 | await ObjectStorageCommand.prepareDefaultBuckets() | 337 | await ObjectStorageCommand.prepareDefaultMockBuckets() |
338 | 338 | ||
339 | const config = merge({}, baseConfig, { | 339 | const config = merge({}, baseConfig, { |
340 | object_storage: { | 340 | object_storage: { |
@@ -345,7 +345,7 @@ describe('Object storage for videos', function () { | |||
345 | } | 345 | } |
346 | }) | 346 | }) |
347 | 347 | ||
348 | const goodCredentials = ObjectStorageCommand.getCredentialsConfig() | 348 | const goodCredentials = ObjectStorageCommand.getMockCredentialsConfig() |
349 | 349 | ||
350 | server = await createSingleServer(1, config, { | 350 | server = await createSingleServer(1, config, { |
351 | env: { | 351 | env: { |
@@ -361,7 +361,7 @@ describe('Object storage for videos', function () { | |||
361 | await waitJobs([ server ], true) | 361 | await waitJobs([ server ], true) |
362 | const video = await server.videos.get({ id: uuid }) | 362 | const video = await server.videos.get({ id: uuid }) |
363 | 363 | ||
364 | expectStartWith(video.files[0].fileUrl, ObjectStorageCommand.getWebTorrentBaseUrl()) | 364 | expectStartWith(video.files[0].fileUrl, ObjectStorageCommand.getMockWebTorrentBaseUrl()) |
365 | }) | 365 | }) |
366 | 366 | ||
367 | after(async function () { | 367 | after(async function () { |
diff --git a/server/tests/api/server/proxy.ts b/server/tests/api/server/proxy.ts index a4151ebdd..3700b0746 100644 --- a/server/tests/api/server/proxy.ts +++ b/server/tests/api/server/proxy.ts | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | import { expect } from 'chai' | 3 | import { expect } from 'chai' |
4 | import { expectNotStartWith, expectStartWith, FIXTURE_URLS, MockProxy } from '@server/tests/shared' | 4 | import { expectNotStartWith, expectStartWith, FIXTURE_URLS, MockProxy } from '@server/tests/shared' |
5 | import { areObjectStorageTestsDisabled } from '@shared/core-utils' | 5 | import { areMockObjectStorageTestsDisabled } from '@shared/core-utils' |
6 | import { HttpStatusCode, VideoPrivacy } from '@shared/models' | 6 | import { HttpStatusCode, VideoPrivacy } from '@shared/models' |
7 | import { | 7 | import { |
8 | cleanupTests, | 8 | cleanupTests, |
@@ -120,40 +120,40 @@ describe('Test proxy', function () { | |||
120 | }) | 120 | }) |
121 | 121 | ||
122 | describe('Object storage', function () { | 122 | describe('Object storage', function () { |
123 | if (areObjectStorageTestsDisabled()) return | 123 | if (areMockObjectStorageTestsDisabled()) return |
124 | 124 | ||
125 | before(async function () { | 125 | before(async function () { |
126 | this.timeout(30000) | 126 | this.timeout(30000) |
127 | 127 | ||
128 | await ObjectStorageCommand.prepareDefaultBuckets() | 128 | await ObjectStorageCommand.prepareDefaultMockBuckets() |
129 | }) | 129 | }) |
130 | 130 | ||
131 | it('Should succeed to upload to object storage with the appropriate proxy config', async function () { | 131 | it('Should succeed to upload to object storage with the appropriate proxy config', async function () { |
132 | this.timeout(120000) | 132 | this.timeout(120000) |
133 | 133 | ||
134 | await servers[0].kill() | 134 | await servers[0].kill() |
135 | await servers[0].run(ObjectStorageCommand.getDefaultConfig(), { env: goodEnv }) | 135 | await servers[0].run(ObjectStorageCommand.getDefaultMockConfig(), { env: goodEnv }) |
136 | 136 | ||
137 | const { uuid } = await servers[0].videos.quickUpload({ name: 'video' }) | 137 | const { uuid } = await servers[0].videos.quickUpload({ name: 'video' }) |
138 | await waitJobs(servers) | 138 | await waitJobs(servers) |
139 | 139 | ||
140 | const video = await servers[0].videos.get({ id: uuid }) | 140 | const video = await servers[0].videos.get({ id: uuid }) |
141 | 141 | ||
142 | expectStartWith(video.files[0].fileUrl, ObjectStorageCommand.getWebTorrentBaseUrl()) | 142 | expectStartWith(video.files[0].fileUrl, ObjectStorageCommand.getMockWebTorrentBaseUrl()) |
143 | }) | 143 | }) |
144 | 144 | ||
145 | it('Should fail to upload to object storage with a wrong proxy config', async function () { | 145 | it('Should fail to upload to object storage with a wrong proxy config', async function () { |
146 | this.timeout(120000) | 146 | this.timeout(120000) |
147 | 147 | ||
148 | await servers[0].kill() | 148 | await servers[0].kill() |
149 | await servers[0].run(ObjectStorageCommand.getDefaultConfig(), { env: badEnv }) | 149 | await servers[0].run(ObjectStorageCommand.getDefaultMockConfig(), { env: badEnv }) |
150 | 150 | ||
151 | const { uuid } = await servers[0].videos.quickUpload({ name: 'video' }) | 151 | const { uuid } = await servers[0].videos.quickUpload({ name: 'video' }) |
152 | await waitJobs(servers) | 152 | await waitJobs(servers) |
153 | 153 | ||
154 | const video = await servers[0].videos.get({ id: uuid }) | 154 | const video = await servers[0].videos.get({ id: uuid }) |
155 | 155 | ||
156 | expectNotStartWith(video.files[0].fileUrl, ObjectStorageCommand.getWebTorrentBaseUrl()) | 156 | expectNotStartWith(video.files[0].fileUrl, ObjectStorageCommand.getMockWebTorrentBaseUrl()) |
157 | }) | 157 | }) |
158 | }) | 158 | }) |
159 | 159 | ||
diff --git a/server/tests/api/transcoding/create-transcoding.ts b/server/tests/api/transcoding/create-transcoding.ts index 372f5332a..85389a949 100644 --- a/server/tests/api/transcoding/create-transcoding.ts +++ b/server/tests/api/transcoding/create-transcoding.ts | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | import { expect } from 'chai' | 3 | import { expect } from 'chai' |
4 | import { checkResolutionsInMasterPlaylist, expectStartWith } from '@server/tests/shared' | 4 | import { checkResolutionsInMasterPlaylist, expectStartWith } from '@server/tests/shared' |
5 | import { areObjectStorageTestsDisabled } from '@shared/core-utils' | 5 | import { areMockObjectStorageTestsDisabled } from '@shared/core-utils' |
6 | import { HttpStatusCode, VideoDetails } from '@shared/models' | 6 | import { HttpStatusCode, VideoDetails } from '@shared/models' |
7 | import { | 7 | import { |
8 | cleanupTests, | 8 | cleanupTests, |
@@ -19,7 +19,7 @@ import { | |||
19 | 19 | ||
20 | async function checkFilesInObjectStorage (video: VideoDetails) { | 20 | async function checkFilesInObjectStorage (video: VideoDetails) { |
21 | for (const file of video.files) { | 21 | for (const file of video.files) { |
22 | expectStartWith(file.fileUrl, ObjectStorageCommand.getWebTorrentBaseUrl()) | 22 | expectStartWith(file.fileUrl, ObjectStorageCommand.getMockWebTorrentBaseUrl()) |
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,14 +27,14 @@ 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.getPlaylistBaseUrl()) | 30 | expectStartWith(file.fileUrl, ObjectStorageCommand.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.getPlaylistBaseUrl()) | 34 | expectStartWith(hlsPlaylist.playlistUrl, ObjectStorageCommand.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.getPlaylistBaseUrl()) | 37 | expectStartWith(hlsPlaylist.segmentsSha256Url, ObjectStorageCommand.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 | ||
@@ -49,7 +49,7 @@ function runTests (objectStorage: boolean) { | |||
49 | this.timeout(120000) | 49 | this.timeout(120000) |
50 | 50 | ||
51 | const config = objectStorage | 51 | const config = objectStorage |
52 | ? ObjectStorageCommand.getDefaultConfig() | 52 | ? ObjectStorageCommand.getDefaultMockConfig() |
53 | : {} | 53 | : {} |
54 | 54 | ||
55 | // Run server 2 to have transcoding enabled | 55 | // Run server 2 to have transcoding enabled |
@@ -60,7 +60,7 @@ function runTests (objectStorage: boolean) { | |||
60 | 60 | ||
61 | await doubleFollow(servers[0], servers[1]) | 61 | await doubleFollow(servers[0], servers[1]) |
62 | 62 | ||
63 | if (objectStorage) await ObjectStorageCommand.prepareDefaultBuckets() | 63 | if (objectStorage) await ObjectStorageCommand.prepareDefaultMockBuckets() |
64 | 64 | ||
65 | const { shortUUID } = await servers[0].videos.quickUpload({ name: 'video' }) | 65 | const { shortUUID } = await servers[0].videos.quickUpload({ name: 'video' }) |
66 | videoUUID = shortUUID | 66 | videoUUID = shortUUID |
@@ -256,7 +256,7 @@ describe('Test create transcoding jobs from API', function () { | |||
256 | }) | 256 | }) |
257 | 257 | ||
258 | describe('On object storage', function () { | 258 | describe('On object storage', function () { |
259 | if (areObjectStorageTestsDisabled()) return | 259 | if (areMockObjectStorageTestsDisabled()) return |
260 | 260 | ||
261 | runTests(true) | 261 | runTests(true) |
262 | }) | 262 | }) |
diff --git a/server/tests/api/transcoding/hls.ts b/server/tests/api/transcoding/hls.ts index 7b5492cd4..84a53c0bd 100644 --- a/server/tests/api/transcoding/hls.ts +++ b/server/tests/api/transcoding/hls.ts | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | import { join } from 'path' | 3 | import { join } from 'path' |
4 | import { checkDirectoryIsEmpty, checkTmpIsEmpty, completeCheckHlsPlaylist } from '@server/tests/shared' | 4 | import { checkDirectoryIsEmpty, checkTmpIsEmpty, completeCheckHlsPlaylist } from '@server/tests/shared' |
5 | import { areObjectStorageTestsDisabled } from '@shared/core-utils' | 5 | import { areMockObjectStorageTestsDisabled } from '@shared/core-utils' |
6 | import { HttpStatusCode } from '@shared/models' | 6 | import { HttpStatusCode } from '@shared/models' |
7 | import { | 7 | import { |
8 | cleanupTests, | 8 | cleanupTests, |
@@ -150,19 +150,19 @@ describe('Test HLS videos', function () { | |||
150 | }) | 150 | }) |
151 | 151 | ||
152 | describe('With object storage enabled', function () { | 152 | describe('With object storage enabled', function () { |
153 | if (areObjectStorageTestsDisabled()) return | 153 | if (areMockObjectStorageTestsDisabled()) return |
154 | 154 | ||
155 | before(async function () { | 155 | before(async function () { |
156 | this.timeout(120000) | 156 | this.timeout(120000) |
157 | 157 | ||
158 | const configOverride = ObjectStorageCommand.getDefaultConfig() | 158 | const configOverride = ObjectStorageCommand.getDefaultMockConfig() |
159 | await ObjectStorageCommand.prepareDefaultBuckets() | 159 | await ObjectStorageCommand.prepareDefaultMockBuckets() |
160 | 160 | ||
161 | await servers[0].kill() | 161 | await servers[0].kill() |
162 | await servers[0].run(configOverride) | 162 | await servers[0].run(configOverride) |
163 | }) | 163 | }) |
164 | 164 | ||
165 | runTestSuite(true, ObjectStorageCommand.getPlaylistBaseUrl()) | 165 | runTestSuite(true, ObjectStorageCommand.getMockPlaylistBaseUrl()) |
166 | }) | 166 | }) |
167 | 167 | ||
168 | after(async function () { | 168 | after(async function () { |
diff --git a/server/tests/api/transcoding/update-while-transcoding.ts b/server/tests/api/transcoding/update-while-transcoding.ts index 5ca923392..8e32ea069 100644 --- a/server/tests/api/transcoding/update-while-transcoding.ts +++ b/server/tests/api/transcoding/update-while-transcoding.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 { completeCheckHlsPlaylist } from '@server/tests/shared' | 3 | import { completeCheckHlsPlaylist } from '@server/tests/shared' |
4 | import { areObjectStorageTestsDisabled, wait } from '@shared/core-utils' | 4 | import { areMockObjectStorageTestsDisabled, wait } from '@shared/core-utils' |
5 | import { VideoPrivacy } from '@shared/models' | 5 | import { VideoPrivacy } from '@shared/models' |
6 | import { | 6 | import { |
7 | cleanupTests, | 7 | cleanupTests, |
@@ -130,19 +130,19 @@ describe('Test update video privacy while transcoding', function () { | |||
130 | }) | 130 | }) |
131 | 131 | ||
132 | describe('With object storage enabled', function () { | 132 | describe('With object storage enabled', function () { |
133 | if (areObjectStorageTestsDisabled()) return | 133 | if (areMockObjectStorageTestsDisabled()) return |
134 | 134 | ||
135 | before(async function () { | 135 | before(async function () { |
136 | this.timeout(120000) | 136 | this.timeout(120000) |
137 | 137 | ||
138 | const configOverride = ObjectStorageCommand.getDefaultConfig() | 138 | const configOverride = ObjectStorageCommand.getDefaultMockConfig() |
139 | await ObjectStorageCommand.prepareDefaultBuckets() | 139 | await ObjectStorageCommand.prepareDefaultMockBuckets() |
140 | 140 | ||
141 | await servers[0].kill() | 141 | await servers[0].kill() |
142 | await servers[0].run(configOverride) | 142 | await servers[0].run(configOverride) |
143 | }) | 143 | }) |
144 | 144 | ||
145 | runTestSuite(true, ObjectStorageCommand.getPlaylistBaseUrl()) | 145 | runTestSuite(true, ObjectStorageCommand.getMockPlaylistBaseUrl()) |
146 | }) | 146 | }) |
147 | 147 | ||
148 | after(async function () { | 148 | after(async function () { |
diff --git a/server/tests/api/transcoding/video-studio.ts b/server/tests/api/transcoding/video-studio.ts index 9613111b5..ab08e8fb6 100644 --- a/server/tests/api/transcoding/video-studio.ts +++ b/server/tests/api/transcoding/video-studio.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { expect } from 'chai' | 1 | import { expect } from 'chai' |
2 | import { expectStartWith } from '@server/tests/shared' | 2 | import { expectStartWith } from '@server/tests/shared' |
3 | import { areObjectStorageTestsDisabled, getAllFiles } from '@shared/core-utils' | 3 | import { areMockObjectStorageTestsDisabled, getAllFiles } from '@shared/core-utils' |
4 | import { VideoStudioTask } from '@shared/models' | 4 | import { VideoStudioTask } from '@shared/models' |
5 | import { | 5 | import { |
6 | cleanupTests, | 6 | cleanupTests, |
@@ -315,13 +315,13 @@ describe('Test video studio', function () { | |||
315 | }) | 315 | }) |
316 | 316 | ||
317 | describe('Object storage video edition', function () { | 317 | describe('Object storage video edition', function () { |
318 | if (areObjectStorageTestsDisabled()) return | 318 | if (areMockObjectStorageTestsDisabled()) return |
319 | 319 | ||
320 | before(async function () { | 320 | before(async function () { |
321 | await ObjectStorageCommand.prepareDefaultBuckets() | 321 | await ObjectStorageCommand.prepareDefaultMockBuckets() |
322 | 322 | ||
323 | await servers[0].kill() | 323 | await servers[0].kill() |
324 | await servers[0].run(ObjectStorageCommand.getDefaultConfig()) | 324 | await servers[0].run(ObjectStorageCommand.getDefaultMockConfig()) |
325 | 325 | ||
326 | await servers[0].config.enableMinimumTranscoding() | 326 | await servers[0].config.enableMinimumTranscoding() |
327 | }) | 327 | }) |
@@ -344,11 +344,11 @@ describe('Test video studio', function () { | |||
344 | } | 344 | } |
345 | 345 | ||
346 | for (const webtorrentFile of video.files) { | 346 | for (const webtorrentFile of video.files) { |
347 | expectStartWith(webtorrentFile.fileUrl, ObjectStorageCommand.getWebTorrentBaseUrl()) | 347 | expectStartWith(webtorrentFile.fileUrl, ObjectStorageCommand.getMockWebTorrentBaseUrl()) |
348 | } | 348 | } |
349 | 349 | ||
350 | for (const hlsFile of video.streamingPlaylists[0].files) { | 350 | for (const hlsFile of video.streamingPlaylists[0].files) { |
351 | expectStartWith(hlsFile.fileUrl, ObjectStorageCommand.getPlaylistBaseUrl()) | 351 | expectStartWith(hlsFile.fileUrl, ObjectStorageCommand.getMockPlaylistBaseUrl()) |
352 | } | 352 | } |
353 | 353 | ||
354 | await checkDuration(server, 9) | 354 | await checkDuration(server, 9) |
diff --git a/server/tests/api/videos/video-static-file-privacy.ts b/server/tests/api/videos/video-static-file-privacy.ts index e38fdec6e..bdbe85127 100644 --- a/server/tests/api/videos/video-static-file-privacy.ts +++ b/server/tests/api/videos/video-static-file-privacy.ts | |||
@@ -37,7 +37,7 @@ describe('Test video static file privacy', function () { | |||
37 | 37 | ||
38 | function runSuite () { | 38 | function runSuite () { |
39 | 39 | ||
40 | async function checkPrivateWebTorrentFiles (uuid: string) { | 40 | async function checkPrivateFiles (uuid: string) { |
41 | const video = await server.videos.getWithToken({ id: uuid }) | 41 | const video = await server.videos.getWithToken({ id: uuid }) |
42 | 42 | ||
43 | for (const file of video.files) { | 43 | for (const file of video.files) { |
@@ -63,7 +63,7 @@ describe('Test video static file privacy', function () { | |||
63 | } | 63 | } |
64 | } | 64 | } |
65 | 65 | ||
66 | async function checkPublicWebTorrentFiles (uuid: string) { | 66 | async function checkPublicFiles (uuid: string) { |
67 | const video = await server.videos.get({ id: uuid }) | 67 | const video = await server.videos.get({ id: uuid }) |
68 | 68 | ||
69 | for (const file of getAllFiles(video)) { | 69 | for (const file of getAllFiles(video)) { |
@@ -98,7 +98,7 @@ describe('Test video static file privacy', function () { | |||
98 | const { uuid } = await server.videos.quickUpload({ name: 'video', privacy }) | 98 | const { uuid } = await server.videos.quickUpload({ name: 'video', privacy }) |
99 | await waitJobs([ server ]) | 99 | await waitJobs([ server ]) |
100 | 100 | ||
101 | await checkPrivateWebTorrentFiles(uuid) | 101 | await checkPrivateFiles(uuid) |
102 | } | 102 | } |
103 | }) | 103 | }) |
104 | 104 | ||
@@ -112,7 +112,7 @@ describe('Test video static file privacy', function () { | |||
112 | await server.videos.update({ id: uuid, attributes: { privacy } }) | 112 | await server.videos.update({ id: uuid, attributes: { privacy } }) |
113 | await waitJobs([ server ]) | 113 | await waitJobs([ server ]) |
114 | 114 | ||
115 | await checkPrivateWebTorrentFiles(uuid) | 115 | await checkPrivateFiles(uuid) |
116 | } | 116 | } |
117 | }) | 117 | }) |
118 | 118 | ||
@@ -125,7 +125,7 @@ describe('Test video static file privacy', function () { | |||
125 | await server.videos.update({ id: uuid, attributes: { privacy: VideoPrivacy.UNLISTED } }) | 125 | await server.videos.update({ id: uuid, attributes: { privacy: VideoPrivacy.UNLISTED } }) |
126 | await waitJobs([ server ]) | 126 | await waitJobs([ server ]) |
127 | 127 | ||
128 | await checkPublicWebTorrentFiles(uuid) | 128 | await checkPublicFiles(uuid) |
129 | }) | 129 | }) |
130 | 130 | ||
131 | it('Should upload an internal video and update it to public to have a public static path', async function () { | 131 | it('Should upload an internal video and update it to public to have a public static path', async function () { |
@@ -137,7 +137,7 @@ describe('Test video static file privacy', function () { | |||
137 | await server.videos.update({ id: uuid, attributes: { privacy: VideoPrivacy.PUBLIC } }) | 137 | await server.videos.update({ id: uuid, attributes: { privacy: VideoPrivacy.PUBLIC } }) |
138 | await waitJobs([ server ]) | 138 | await waitJobs([ server ]) |
139 | 139 | ||
140 | await checkPublicWebTorrentFiles(uuid) | 140 | await checkPublicFiles(uuid) |
141 | }) | 141 | }) |
142 | 142 | ||
143 | it('Should upload an internal video and schedule a public publish', async function () { | 143 | it('Should upload an internal video and schedule a public publish', async function () { |
@@ -160,7 +160,7 @@ describe('Test video static file privacy', function () { | |||
160 | 160 | ||
161 | await waitJobs([ server ]) | 161 | await waitJobs([ server ]) |
162 | 162 | ||
163 | await checkPublicWebTorrentFiles(uuid) | 163 | await checkPublicFiles(uuid) |
164 | }) | 164 | }) |
165 | } | 165 | } |
166 | 166 | ||
diff --git a/server/tests/cli/create-import-video-file-job.ts b/server/tests/cli/create-import-video-file-job.ts index a4aa5f699..43f53035b 100644 --- a/server/tests/cli/create-import-video-file-job.ts +++ b/server/tests/cli/create-import-video-file-job.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 { areObjectStorageTestsDisabled } from '@shared/core-utils' | 4 | import { areMockObjectStorageTestsDisabled } from '@shared/core-utils' |
5 | import { HttpStatusCode, VideoDetails, VideoFile, VideoInclude } from '@shared/models' | 5 | import { HttpStatusCode, VideoDetails, VideoFile, VideoInclude } from '@shared/models' |
6 | import { | 6 | import { |
7 | cleanupTests, | 7 | cleanupTests, |
@@ -27,7 +27,7 @@ function assertVideoProperties (video: VideoFile, resolution: number, extname: s | |||
27 | 27 | ||
28 | async function checkFiles (video: VideoDetails, objectStorage: boolean) { | 28 | async function checkFiles (video: VideoDetails, objectStorage: boolean) { |
29 | for (const file of video.files) { | 29 | for (const file of video.files) { |
30 | if (objectStorage) expectStartWith(file.fileUrl, ObjectStorageCommand.getWebTorrentBaseUrl()) | 30 | if (objectStorage) expectStartWith(file.fileUrl, ObjectStorageCommand.getMockWebTorrentBaseUrl()) |
31 | 31 | ||
32 | await makeRawRequest({ url: file.fileUrl, expectedStatus: HttpStatusCode.OK_200 }) | 32 | await makeRawRequest({ url: file.fileUrl, expectedStatus: HttpStatusCode.OK_200 }) |
33 | } | 33 | } |
@@ -43,7 +43,7 @@ function runTests (objectStorage: boolean) { | |||
43 | this.timeout(90000) | 43 | this.timeout(90000) |
44 | 44 | ||
45 | const config = objectStorage | 45 | const config = objectStorage |
46 | ? ObjectStorageCommand.getDefaultConfig() | 46 | ? ObjectStorageCommand.getDefaultMockConfig() |
47 | : {} | 47 | : {} |
48 | 48 | ||
49 | // Run server 2 to have transcoding enabled | 49 | // Run server 2 to have transcoding enabled |
@@ -52,7 +52,7 @@ function runTests (objectStorage: boolean) { | |||
52 | 52 | ||
53 | await doubleFollow(servers[0], servers[1]) | 53 | await doubleFollow(servers[0], servers[1]) |
54 | 54 | ||
55 | if (objectStorage) await ObjectStorageCommand.prepareDefaultBuckets() | 55 | if (objectStorage) await ObjectStorageCommand.prepareDefaultMockBuckets() |
56 | 56 | ||
57 | // Upload two videos for our needs | 57 | // Upload two videos for our needs |
58 | { | 58 | { |
@@ -157,7 +157,7 @@ describe('Test create import video jobs', function () { | |||
157 | }) | 157 | }) |
158 | 158 | ||
159 | describe('On object storage', function () { | 159 | describe('On object storage', function () { |
160 | if (areObjectStorageTestsDisabled()) return | 160 | if (areMockObjectStorageTestsDisabled()) return |
161 | 161 | ||
162 | runTests(true) | 162 | runTests(true) |
163 | }) | 163 | }) |
diff --git a/server/tests/cli/create-move-video-storage-job.ts b/server/tests/cli/create-move-video-storage-job.ts index ecdd75b76..c357f501b 100644 --- a/server/tests/cli/create-move-video-storage-job.ts +++ b/server/tests/cli/create-move-video-storage-job.ts | |||
@@ -1,6 +1,6 @@ | |||
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 { areObjectStorageTestsDisabled } from '@shared/core-utils' | 3 | import { areMockObjectStorageTestsDisabled } from '@shared/core-utils' |
4 | import { HttpStatusCode, VideoDetails } from '@shared/models' | 4 | import { HttpStatusCode, VideoDetails } from '@shared/models' |
5 | import { | 5 | import { |
6 | cleanupTests, | 6 | cleanupTests, |
@@ -17,7 +17,7 @@ import { expectStartWith } from '../shared' | |||
17 | async function checkFiles (origin: PeerTubeServer, video: VideoDetails, inObjectStorage: boolean) { | 17 | async function checkFiles (origin: PeerTubeServer, video: VideoDetails, inObjectStorage: boolean) { |
18 | for (const file of video.files) { | 18 | for (const file of video.files) { |
19 | const start = inObjectStorage | 19 | const start = inObjectStorage |
20 | ? ObjectStorageCommand.getWebTorrentBaseUrl() | 20 | ? ObjectStorageCommand.getMockWebTorrentBaseUrl() |
21 | : origin.url | 21 | : origin.url |
22 | 22 | ||
23 | expectStartWith(file.fileUrl, start) | 23 | expectStartWith(file.fileUrl, start) |
@@ -26,7 +26,7 @@ async function checkFiles (origin: PeerTubeServer, video: VideoDetails, inObject | |||
26 | } | 26 | } |
27 | 27 | ||
28 | const start = inObjectStorage | 28 | const start = inObjectStorage |
29 | ? ObjectStorageCommand.getPlaylistBaseUrl() | 29 | ? ObjectStorageCommand.getMockPlaylistBaseUrl() |
30 | : origin.url | 30 | : origin.url |
31 | 31 | ||
32 | const hls = video.streamingPlaylists[0] | 32 | const hls = video.streamingPlaylists[0] |
@@ -41,7 +41,7 @@ async function checkFiles (origin: PeerTubeServer, video: VideoDetails, inObject | |||
41 | } | 41 | } |
42 | 42 | ||
43 | describe('Test create move video storage job', function () { | 43 | describe('Test create move video storage job', function () { |
44 | if (areObjectStorageTestsDisabled()) return | 44 | if (areMockObjectStorageTestsDisabled()) return |
45 | 45 | ||
46 | let servers: PeerTubeServer[] = [] | 46 | let servers: PeerTubeServer[] = [] |
47 | const uuids: string[] = [] | 47 | const uuids: string[] = [] |
@@ -55,7 +55,7 @@ describe('Test create move video storage job', function () { | |||
55 | 55 | ||
56 | await doubleFollow(servers[0], servers[1]) | 56 | await doubleFollow(servers[0], servers[1]) |
57 | 57 | ||
58 | await ObjectStorageCommand.prepareDefaultBuckets() | 58 | await ObjectStorageCommand.prepareDefaultMockBuckets() |
59 | 59 | ||
60 | await servers[0].config.enableTranscoding() | 60 | await servers[0].config.enableTranscoding() |
61 | 61 | ||
@@ -67,14 +67,14 @@ describe('Test create move video storage job', function () { | |||
67 | await waitJobs(servers) | 67 | await waitJobs(servers) |
68 | 68 | ||
69 | await servers[0].kill() | 69 | await servers[0].kill() |
70 | await servers[0].run(ObjectStorageCommand.getDefaultConfig()) | 70 | await servers[0].run(ObjectStorageCommand.getDefaultMockConfig()) |
71 | }) | 71 | }) |
72 | 72 | ||
73 | it('Should move only one file', async function () { | 73 | it('Should move only one file', async function () { |
74 | this.timeout(120000) | 74 | this.timeout(120000) |
75 | 75 | ||
76 | const command = `npm run create-move-video-storage-job -- --to-object-storage -v ${uuids[1]}` | 76 | const command = `npm run create-move-video-storage-job -- --to-object-storage -v ${uuids[1]}` |
77 | await servers[0].cli.execWithEnv(command, ObjectStorageCommand.getDefaultConfig()) | 77 | await servers[0].cli.execWithEnv(command, ObjectStorageCommand.getDefaultMockConfig()) |
78 | await waitJobs(servers) | 78 | await waitJobs(servers) |
79 | 79 | ||
80 | for (const server of servers) { | 80 | for (const server of servers) { |
@@ -94,7 +94,7 @@ describe('Test create move video storage job', function () { | |||
94 | this.timeout(120000) | 94 | this.timeout(120000) |
95 | 95 | ||
96 | const command = `npm run create-move-video-storage-job -- --to-object-storage --all-videos` | 96 | const command = `npm run create-move-video-storage-job -- --to-object-storage --all-videos` |
97 | await servers[0].cli.execWithEnv(command, ObjectStorageCommand.getDefaultConfig()) | 97 | await servers[0].cli.execWithEnv(command, ObjectStorageCommand.getDefaultMockConfig()) |
98 | await waitJobs(servers) | 98 | await waitJobs(servers) |
99 | 99 | ||
100 | for (const server of servers) { | 100 | for (const server of servers) { |
diff --git a/server/tests/cli/create-transcoding-job.ts b/server/tests/cli/create-transcoding-job.ts index 51bf04a80..38b737829 100644 --- a/server/tests/cli/create-transcoding-job.ts +++ b/server/tests/cli/create-transcoding-job.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 { areObjectStorageTestsDisabled } from '@shared/core-utils' | 4 | import { areMockObjectStorageTestsDisabled } from '@shared/core-utils' |
5 | import { HttpStatusCode, VideoFile } from '@shared/models' | 5 | import { HttpStatusCode, VideoFile } from '@shared/models' |
6 | import { | 6 | import { |
7 | cleanupTests, | 7 | cleanupTests, |
@@ -18,8 +18,8 @@ import { checkResolutionsInMasterPlaylist, expectStartWith } from '../shared' | |||
18 | async function checkFilesInObjectStorage (files: VideoFile[], type: 'webtorrent' | 'playlist') { | 18 | async function checkFilesInObjectStorage (files: VideoFile[], type: 'webtorrent' | 'playlist') { |
19 | for (const file of files) { | 19 | for (const file of files) { |
20 | const shouldStartWith = type === 'webtorrent' | 20 | const shouldStartWith = type === 'webtorrent' |
21 | ? ObjectStorageCommand.getWebTorrentBaseUrl() | 21 | ? ObjectStorageCommand.getMockWebTorrentBaseUrl() |
22 | : ObjectStorageCommand.getPlaylistBaseUrl() | 22 | : ObjectStorageCommand.getMockPlaylistBaseUrl() |
23 | 23 | ||
24 | expectStartWith(file.fileUrl, shouldStartWith) | 24 | expectStartWith(file.fileUrl, shouldStartWith) |
25 | 25 | ||
@@ -36,7 +36,7 @@ function runTests (objectStorage: boolean) { | |||
36 | this.timeout(120000) | 36 | this.timeout(120000) |
37 | 37 | ||
38 | const config = objectStorage | 38 | const config = objectStorage |
39 | ? ObjectStorageCommand.getDefaultConfig() | 39 | ? ObjectStorageCommand.getDefaultMockConfig() |
40 | : {} | 40 | : {} |
41 | 41 | ||
42 | // Run server 2 to have transcoding enabled | 42 | // Run server 2 to have transcoding enabled |
@@ -47,7 +47,7 @@ function runTests (objectStorage: boolean) { | |||
47 | 47 | ||
48 | await doubleFollow(servers[0], servers[1]) | 48 | await doubleFollow(servers[0], servers[1]) |
49 | 49 | ||
50 | if (objectStorage) await ObjectStorageCommand.prepareDefaultBuckets() | 50 | if (objectStorage) await ObjectStorageCommand.prepareDefaultMockBuckets() |
51 | 51 | ||
52 | for (let i = 1; i <= 5; i++) { | 52 | for (let i = 1; i <= 5; i++) { |
53 | const { uuid, shortUUID } = await servers[0].videos.upload({ attributes: { name: 'video' + i } }) | 53 | const { uuid, shortUUID } = await servers[0].videos.upload({ attributes: { name: 'video' + i } }) |
@@ -255,7 +255,7 @@ describe('Test create transcoding jobs', function () { | |||
255 | }) | 255 | }) |
256 | 256 | ||
257 | describe('On object storage', function () { | 257 | describe('On object storage', function () { |
258 | if (areObjectStorageTestsDisabled()) return | 258 | if (areMockObjectStorageTestsDisabled()) return |
259 | 259 | ||
260 | runTests(true) | 260 | runTests(true) |
261 | }) | 261 | }) |
diff --git a/server/tests/shared/live.ts b/server/tests/shared/live.ts index da3691711..78e29f575 100644 --- a/server/tests/shared/live.ts +++ b/server/tests/shared/live.ts | |||
@@ -50,7 +50,7 @@ async function testVideoResolutions (options: { | |||
50 | }) | 50 | }) |
51 | 51 | ||
52 | if (objectStorage) { | 52 | if (objectStorage) { |
53 | expect(hlsPlaylist.playlistUrl).to.contain(ObjectStorageCommand.getPlaylistBaseUrl()) | 53 | expect(hlsPlaylist.playlistUrl).to.contain(ObjectStorageCommand.getMockPlaylistBaseUrl()) |
54 | } | 54 | } |
55 | 55 | ||
56 | for (let i = 0; i < resolutions.length; i++) { | 56 | for (let i = 0; i < resolutions.length; i++) { |
@@ -65,11 +65,11 @@ async function testVideoResolutions (options: { | |||
65 | }) | 65 | }) |
66 | 66 | ||
67 | const baseUrl = objectStorage | 67 | const baseUrl = objectStorage |
68 | ? ObjectStorageCommand.getPlaylistBaseUrl() + 'hls' | 68 | ? ObjectStorageCommand.getMockPlaylistBaseUrl() + 'hls' |
69 | : originServer.url + '/static/streaming-playlists/hls' | 69 | : originServer.url + '/static/streaming-playlists/hls' |
70 | 70 | ||
71 | if (objectStorage) { | 71 | if (objectStorage) { |
72 | expect(hlsPlaylist.segmentsSha256Url).to.contain(ObjectStorageCommand.getPlaylistBaseUrl()) | 72 | expect(hlsPlaylist.segmentsSha256Url).to.contain(ObjectStorageCommand.getMockPlaylistBaseUrl()) |
73 | } | 73 | } |
74 | 74 | ||
75 | const subPlaylist = await originServer.streamingPlaylists.get({ | 75 | const subPlaylist = await originServer.streamingPlaylists.get({ |
diff --git a/server/tests/shared/mock-servers/mock-object-storage.ts b/server/tests/shared/mock-servers/mock-object-storage.ts index 99d68e014..8c325bf11 100644 --- a/server/tests/shared/mock-servers/mock-object-storage.ts +++ b/server/tests/shared/mock-servers/mock-object-storage.ts | |||
@@ -12,7 +12,7 @@ export class MockObjectStorage { | |||
12 | const app = express() | 12 | const app = express() |
13 | 13 | ||
14 | app.get('/:bucketName/:path(*)', (req: express.Request, res: express.Response, next: express.NextFunction) => { | 14 | app.get('/:bucketName/:path(*)', (req: express.Request, res: express.Response, next: express.NextFunction) => { |
15 | const url = `http://${req.params.bucketName}.${ObjectStorageCommand.getEndpointHost()}/${req.params.path}` | 15 | const url = `http://${req.params.bucketName}.${ObjectStorageCommand.getMockEndpointHost()}/${req.params.path}` |
16 | 16 | ||
17 | if (process.env.DEBUG) { | 17 | if (process.env.DEBUG) { |
18 | console.log('Receiving request on mocked server %s.', req.url) | 18 | console.log('Receiving request on mocked server %s.', req.url) |