diff options
Diffstat (limited to 'server/tests/api/redundancy/manage-redundancy.ts')
-rw-r--r-- | server/tests/api/redundancy/manage-redundancy.ts | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/server/tests/api/redundancy/manage-redundancy.ts b/server/tests/api/redundancy/manage-redundancy.ts index 6a8937f24..4253124c8 100644 --- a/server/tests/api/redundancy/manage-redundancy.ts +++ b/server/tests/api/redundancy/manage-redundancy.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | /* tslint:disable:no-unused-expression */ | 1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ |
2 | 2 | ||
3 | import * as chai from 'chai' | 3 | import * as chai from 'chai' |
4 | import 'mocha' | 4 | import 'mocha' |
@@ -56,20 +56,20 @@ describe('Test manage videos redundancy', function () { | |||
56 | await setAccessTokensToServers(servers) | 56 | await setAccessTokensToServers(servers) |
57 | 57 | ||
58 | { | 58 | { |
59 | const res = await uploadVideo(servers[ 1 ].url, servers[ 1 ].accessToken, { name: 'video 1 server 2' }) | 59 | const res = await uploadVideo(servers[1].url, servers[1].accessToken, { name: 'video 1 server 2' }) |
60 | video1Server2UUID = res.body.video.uuid | 60 | video1Server2UUID = res.body.video.uuid |
61 | } | 61 | } |
62 | 62 | ||
63 | { | 63 | { |
64 | const res = await uploadVideo(servers[ 1 ].url, servers[ 1 ].accessToken, { name: 'video 2 server 2' }) | 64 | const res = await uploadVideo(servers[1].url, servers[1].accessToken, { name: 'video 2 server 2' }) |
65 | video2Server2UUID = res.body.video.uuid | 65 | video2Server2UUID = res.body.video.uuid |
66 | } | 66 | } |
67 | 67 | ||
68 | await waitJobs(servers) | 68 | await waitJobs(servers) |
69 | 69 | ||
70 | // Server 1 and server 2 follow each other | 70 | // Server 1 and server 2 follow each other |
71 | await doubleFollow(servers[ 0 ], servers[ 1 ]) | 71 | await doubleFollow(servers[0], servers[1]) |
72 | await updateRedundancy(servers[ 0 ].url, servers[ 0 ].accessToken, servers[ 1 ].host, true) | 72 | await updateRedundancy(servers[0].url, servers[0].accessToken, servers[1].host, true) |
73 | 73 | ||
74 | await waitJobs(servers) | 74 | await waitJobs(servers) |
75 | }) | 75 | }) |
@@ -195,8 +195,8 @@ describe('Test manage videos redundancy', function () { | |||
195 | }) | 195 | }) |
196 | 196 | ||
197 | const videos = res.body.data | 197 | const videos = res.body.data |
198 | expect(videos[ 0 ].name).to.equal('video 1 server 2') | 198 | expect(videos[0].name).to.equal('video 1 server 2') |
199 | expect(videos[ 1 ].name).to.equal('video 2 server 2') | 199 | expect(videos[1].name).to.equal('video 2 server 2') |
200 | } | 200 | } |
201 | 201 | ||
202 | { | 202 | { |
@@ -210,8 +210,8 @@ describe('Test manage videos redundancy', function () { | |||
210 | }) | 210 | }) |
211 | 211 | ||
212 | const videos = res.body.data | 212 | const videos = res.body.data |
213 | expect(videos[ 0 ].name).to.equal('video 2 server 2') | 213 | expect(videos[0].name).to.equal('video 2 server 2') |
214 | expect(videos[ 1 ].name).to.equal('video 1 server 2') | 214 | expect(videos[1].name).to.equal('video 1 server 2') |
215 | } | 215 | } |
216 | 216 | ||
217 | { | 217 | { |
@@ -225,14 +225,14 @@ describe('Test manage videos redundancy', function () { | |||
225 | }) | 225 | }) |
226 | 226 | ||
227 | const videos = res.body.data | 227 | const videos = res.body.data |
228 | expect(videos[ 0 ].name).to.equal('video 1 server 2') | 228 | expect(videos[0].name).to.equal('video 1 server 2') |
229 | } | 229 | } |
230 | }) | 230 | }) |
231 | 231 | ||
232 | it('Should manually add a redundancy and list it', async function () { | 232 | it('Should manually add a redundancy and list it', async function () { |
233 | this.timeout(120000) | 233 | this.timeout(120000) |
234 | 234 | ||
235 | const uuid = (await uploadVideoAndGetId({ server: servers[ 1 ], videoName: 'video 3 server 2', privacy: VideoPrivacy.UNLISTED })).uuid | 235 | const uuid = (await uploadVideoAndGetId({ server: servers[1], videoName: 'video 3 server 2', privacy: VideoPrivacy.UNLISTED })).uuid |
236 | await waitJobs(servers) | 236 | await waitJobs(servers) |
237 | const videoId = await getLocalIdByUUID(servers[0].url, uuid) | 237 | const videoId = await getLocalIdByUUID(servers[0].url, uuid) |
238 | 238 | ||
@@ -257,9 +257,9 @@ describe('Test manage videos redundancy', function () { | |||
257 | }) | 257 | }) |
258 | 258 | ||
259 | const videos = res.body.data | 259 | const videos = res.body.data |
260 | expect(videos[ 0 ].name).to.equal('video 3 server 2') | 260 | expect(videos[0].name).to.equal('video 3 server 2') |
261 | 261 | ||
262 | const video = videos[ 0 ] | 262 | const video = videos[0] |
263 | expect(video.redundancies.files).to.have.lengthOf(4) | 263 | expect(video.redundancies.files).to.have.lengthOf(4) |
264 | expect(video.redundancies.streamingPlaylists).to.have.lengthOf(1) | 264 | expect(video.redundancies.streamingPlaylists).to.have.lengthOf(1) |
265 | 265 | ||
@@ -286,9 +286,9 @@ describe('Test manage videos redundancy', function () { | |||
286 | }) | 286 | }) |
287 | 287 | ||
288 | const videos = res.body.data | 288 | const videos = res.body.data |
289 | expect(videos[ 0 ].name).to.equal('video 3 server 2') | 289 | expect(videos[0].name).to.equal('video 3 server 2') |
290 | 290 | ||
291 | const video = videos[ 0 ] | 291 | const video = videos[0] |
292 | expect(video.redundancies.files).to.have.lengthOf(4) | 292 | expect(video.redundancies.files).to.have.lengthOf(4) |
293 | expect(video.redundancies.streamingPlaylists).to.have.lengthOf(1) | 293 | expect(video.redundancies.streamingPlaylists).to.have.lengthOf(1) |
294 | 294 | ||
@@ -308,8 +308,8 @@ describe('Test manage videos redundancy', function () { | |||
308 | 308 | ||
309 | for (const redundancyId of redundanciesToRemove) { | 309 | for (const redundancyId of redundanciesToRemove) { |
310 | await removeVideoRedundancy({ | 310 | await removeVideoRedundancy({ |
311 | url: servers[ 0 ].url, | 311 | url: servers[0].url, |
312 | accessToken: servers[ 0 ].accessToken, | 312 | accessToken: servers[0].accessToken, |
313 | redundancyId | 313 | redundancyId |
314 | }) | 314 | }) |
315 | } | 315 | } |
@@ -327,10 +327,10 @@ describe('Test manage videos redundancy', function () { | |||
327 | const videos = res.body.data | 327 | const videos = res.body.data |
328 | expect(videos).to.have.lengthOf(2) | 328 | expect(videos).to.have.lengthOf(2) |
329 | 329 | ||
330 | expect(videos[ 0 ].name).to.equal('video 2 server 2') | 330 | expect(videos[0].name).to.equal('video 2 server 2') |
331 | 331 | ||
332 | redundanciesToRemove = [] | 332 | redundanciesToRemove = [] |
333 | const video = videos[ 0 ] | 333 | const video = videos[0] |
334 | expect(video.redundancies.files).to.have.lengthOf(4) | 334 | expect(video.redundancies.files).to.have.lengthOf(4) |
335 | expect(video.redundancies.streamingPlaylists).to.have.lengthOf(1) | 335 | expect(video.redundancies.streamingPlaylists).to.have.lengthOf(1) |
336 | 336 | ||
@@ -346,8 +346,8 @@ describe('Test manage videos redundancy', function () { | |||
346 | { | 346 | { |
347 | for (const redundancyId of redundanciesToRemove) { | 347 | for (const redundancyId of redundanciesToRemove) { |
348 | await removeVideoRedundancy({ | 348 | await removeVideoRedundancy({ |
349 | url: servers[ 0 ].url, | 349 | url: servers[0].url, |
350 | accessToken: servers[ 0 ].accessToken, | 350 | accessToken: servers[0].accessToken, |
351 | redundancyId | 351 | redundancyId |
352 | }) | 352 | }) |
353 | } | 353 | } |
@@ -362,7 +362,7 @@ describe('Test manage videos redundancy', function () { | |||
362 | }) | 362 | }) |
363 | 363 | ||
364 | const videos = res.body.data | 364 | const videos = res.body.data |
365 | expect(videos[ 0 ].name).to.equal('video 1 server 2') | 365 | expect(videos[0].name).to.equal('video 1 server 2') |
366 | expect(videos).to.have.lengthOf(1) | 366 | expect(videos).to.have.lengthOf(1) |
367 | } | 367 | } |
368 | }) | 368 | }) |