]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - server/tests/api/multiple-pods.ts
Add ability to download a video from direct link or torrent file
[github/Chocobozzz/PeerTube.git] / server / tests / api / multiple-pods.ts
1 /* tslint:disable:no-unused-expression */
2
3 import 'mocha'
4 import * as chai from 'chai'
5
6 import {
7 dateIsValid,
8 flushAndRunMultipleServers,
9 flushTests,
10 getVideo,
11 getVideosList,
12 killallServers,
13 makeFriends,
14 rateVideo,
15 removeVideo,
16 ServerInfo,
17 setAccessTokensToServers,
18 testVideoImage,
19 updateVideo,
20 uploadVideo,
21 wait,
22 webtorrentAdd
23 } from '../utils'
24
25 const expect = chai.expect
26
27 describe('Test multiple pods', function () {
28 let servers: ServerInfo[] = []
29 const toRemove = []
30 let videoUUID = ''
31
32 before(async function () {
33 this.timeout(120000)
34
35 servers = await flushAndRunMultipleServers(3)
36
37 // Get the access tokens
38 await setAccessTokensToServers(servers)
39
40 // The second pod make friend with the third
41 await makeFriends(servers[1].url, servers[1].accessToken)
42
43 // Wait for the request between pods
44 await wait(10000)
45
46 // Pod 1 make friends too
47 await makeFriends(servers[0].url, servers[0].accessToken)
48 })
49
50 it('Should not have videos for all pods', async function () {
51 for (const server of servers) {
52 const res = await getVideosList(server.url)
53 const videos = res.body.data
54 expect(videos).to.be.an('array')
55 expect(videos.length).to.equal(0)
56 }
57 })
58
59 describe('Should upload the video and propagate on each pod', function () {
60 it('Should upload the video on pod 1 and propagate on each pod', async function () {
61 // Pod 1 has video transcoding activated
62 this.timeout(15000)
63
64 const videoAttributes = {
65 name: 'my super name for pod 1',
66 category: 5,
67 licence: 4,
68 language: 9,
69 nsfw: true,
70 description: 'my super description for pod 1',
71 tags: [ 'tag1p1', 'tag2p1' ],
72 fixture: 'video_short1.webm'
73 }
74 await uploadVideo(servers[0].url, servers[0].accessToken, videoAttributes)
75
76 await wait(11000)
77
78 // All pods should have this video
79 for (const server of servers) {
80 let baseMagnet = null
81
82 const res = await getVideosList(server.url)
83
84 const videos = res.body.data
85 expect(videos).to.be.an('array')
86 expect(videos.length).to.equal(1)
87 const video = videos[0]
88 expect(video.name).to.equal('my super name for pod 1')
89 expect(video.category).to.equal(5)
90 expect(video.categoryLabel).to.equal('Sports')
91 expect(video.licence).to.equal(4)
92 expect(video.licenceLabel).to.equal('Attribution - Non Commercial')
93 expect(video.language).to.equal(9)
94 expect(video.languageLabel).to.equal('Japanese')
95 expect(video.nsfw).to.be.ok
96 expect(video.description).to.equal('my super description for pod 1')
97 expect(video.podHost).to.equal('localhost:9001')
98 expect(video.duration).to.equal(10)
99 expect(video.tags).to.deep.equal([ 'tag1p1', 'tag2p1' ])
100 expect(dateIsValid(video.createdAt)).to.be.true
101 expect(dateIsValid(video.updatedAt)).to.be.true
102 expect(video.author).to.equal('root')
103
104 expect(video.files).to.have.lengthOf(1)
105
106 const file = video.files[0]
107 const magnetUri = file.magnetUri
108 expect(file.magnetUri).to.have.lengthOf.above(2)
109 expect(file.torrentUrl).to.equal(`http://${video.podHost}/static/torrents/${video.uuid}-${file.resolution}.torrent`)
110 expect(file.fileUrl).to.equal(`http://${video.podHost}/static/webseed/${video.uuid}-${file.resolution}.webm`)
111 expect(file.resolution).to.equal(720)
112 expect(file.resolutionLabel).to.equal('720p')
113 expect(file.size).to.equal(572456)
114
115 if (server.url !== 'http://localhost:9001') {
116 expect(video.isLocal).to.be.false
117 } else {
118 expect(video.isLocal).to.be.true
119 }
120
121 // All pods should have the same magnet Uri
122 if (baseMagnet === null) {
123 baseMagnet = magnetUri
124 } else {
125 expect(baseMagnet).to.equal(magnetUri)
126 }
127
128 const test = await testVideoImage(server.url, 'video_short1.webm', video.thumbnailPath)
129 expect(test).to.equal(true)
130 }
131 })
132
133 it('Should upload the video on pod 2 and propagate on each pod', async function () {
134 this.timeout(120000)
135
136 const videoAttributes = {
137 name: 'my super name for pod 2',
138 category: 4,
139 licence: 3,
140 language: 11,
141 nsfw: true,
142 description: 'my super description for pod 2',
143 tags: [ 'tag1p2', 'tag2p2', 'tag3p2' ],
144 fixture: 'video_short2.webm'
145 }
146 await uploadVideo(servers[1].url, servers[1].accessToken, videoAttributes)
147
148 // Transcoding, so wait more than 22000
149 await wait(60000)
150
151 // All pods should have this video
152 for (const server of servers) {
153 let baseMagnet = {}
154
155 const res = await getVideosList(server.url)
156
157 const videos = res.body.data
158 expect(videos).to.be.an('array')
159 expect(videos.length).to.equal(2)
160 const video = videos[1]
161 expect(video.name).to.equal('my super name for pod 2')
162 expect(video.category).to.equal(4)
163 expect(video.categoryLabel).to.equal('Art')
164 expect(video.licence).to.equal(3)
165 expect(video.licenceLabel).to.equal('Attribution - No Derivatives')
166 expect(video.language).to.equal(11)
167 expect(video.languageLabel).to.equal('German')
168 expect(video.nsfw).to.be.true
169 expect(video.description).to.equal('my super description for pod 2')
170 expect(video.podHost).to.equal('localhost:9002')
171 expect(video.duration).to.equal(5)
172 expect(video.tags).to.deep.equal([ 'tag1p2', 'tag2p2', 'tag3p2' ])
173 expect(dateIsValid(video.createdAt)).to.be.true
174 expect(dateIsValid(video.updatedAt)).to.be.true
175 expect(video.author).to.equal('root')
176
177 expect(video.files).to.have.lengthOf(4)
178
179 // Check common attributes
180 for (const file of video.files) {
181 expect(file.magnetUri).to.have.lengthOf.above(2)
182
183 if (server.url !== 'http://localhost:9002') {
184 expect(video.isLocal).to.be.false
185 } else {
186 expect(video.isLocal).to.be.true
187 }
188
189 // All pods should have the same magnet Uri
190 if (baseMagnet[file.resolution] === undefined) {
191 baseMagnet[file.resolution] = file.magnet
192 } else {
193 expect(baseMagnet[file.resolution]).to.equal(file.magnet)
194 }
195 }
196
197 const file240p = video.files.find(f => f.resolution === 240)
198 expect(file240p).not.to.be.undefined
199 expect(file240p.resolutionLabel).to.equal('240p')
200 expect(file240p.size).to.be.above(180000).and.below(200000)
201
202 const file360p = video.files.find(f => f.resolution === 360)
203 expect(file360p).not.to.be.undefined
204 expect(file360p.resolutionLabel).to.equal('360p')
205 expect(file360p.size).to.be.above(270000).and.below(290000)
206
207 const file480p = video.files.find(f => f.resolution === 480)
208 expect(file480p).not.to.be.undefined
209 expect(file480p.resolutionLabel).to.equal('480p')
210 expect(file480p.size).to.be.above(380000).and.below(400000)
211
212 const file720p = video.files.find(f => f.resolution === 720)
213 expect(file720p).not.to.be.undefined
214 expect(file720p.resolutionLabel).to.equal('720p')
215 expect(file720p.size).to.be.above(700000).and.below(7200000)
216
217 const test = await testVideoImage(server.url, 'video_short2.webm', video.thumbnailPath)
218 expect(test).to.equal(true)
219 }
220 })
221
222 it('Should upload two videos on pod 3 and propagate on each pod', async function () {
223 this.timeout(45000)
224
225 const videoAttributes1 = {
226 name: 'my super name for pod 3',
227 category: 6,
228 licence: 5,
229 language: 11,
230 nsfw: true,
231 description: 'my super description for pod 3',
232 tags: [ 'tag1p3' ],
233 fixture: 'video_short3.webm'
234 }
235 await uploadVideo(servers[2].url, servers[2].accessToken, videoAttributes1)
236
237 const videoAttributes2 = {
238 name: 'my super name for pod 3-2',
239 category: 7,
240 licence: 6,
241 language: 12,
242 nsfw: false,
243 description: 'my super description for pod 3-2',
244 tags: [ 'tag2p3', 'tag3p3', 'tag4p3' ],
245 fixture: 'video_short.webm'
246 }
247 await uploadVideo(servers[2].url, servers[2].accessToken, videoAttributes2)
248
249 await wait(33000)
250
251 let baseMagnet = null
252 // All pods should have this video
253 for (const server of servers) {
254 const res = await getVideosList(server.url)
255
256 const videos = res.body.data
257 expect(videos).to.be.an('array')
258 expect(videos.length).to.equal(4)
259
260 // We not sure about the order of the two last uploads
261 let video1 = null
262 let video2 = null
263 if (videos[2].name === 'my super name for pod 3') {
264 video1 = videos[2]
265 video2 = videos[3]
266 } else {
267 video1 = videos[3]
268 video2 = videos[2]
269 }
270
271 expect(video1.name).to.equal('my super name for pod 3')
272 expect(video1.category).to.equal(6)
273 expect(video1.categoryLabel).to.equal('Travels')
274 expect(video1.licence).to.equal(5)
275 expect(video1.licenceLabel).to.equal('Attribution - Non Commercial - Share Alike')
276 expect(video1.language).to.equal(11)
277 expect(video1.languageLabel).to.equal('German')
278 expect(video1.nsfw).to.be.ok
279 expect(video1.description).to.equal('my super description for pod 3')
280 expect(video1.podHost).to.equal('localhost:9003')
281 expect(video1.duration).to.equal(5)
282 expect(video1.tags).to.deep.equal([ 'tag1p3' ])
283 expect(video1.author).to.equal('root')
284 expect(dateIsValid(video1.createdAt)).to.be.true
285 expect(dateIsValid(video1.updatedAt)).to.be.true
286
287 expect(video1.files).to.have.lengthOf(1)
288
289 const file1 = video1.files[0]
290 expect(file1.magnetUri).to.have.lengthOf.above(2)
291 expect(file1.resolution).to.equal(720)
292 expect(file1.resolutionLabel).to.equal('720p')
293 expect(file1.size).to.equal(292677)
294
295 expect(video2.name).to.equal('my super name for pod 3-2')
296 expect(video2.category).to.equal(7)
297 expect(video2.categoryLabel).to.equal('Gaming')
298 expect(video2.licence).to.equal(6)
299 expect(video2.licenceLabel).to.equal('Attribution - Non Commercial - No Derivatives')
300 expect(video2.language).to.equal(12)
301 expect(video2.languageLabel).to.equal('Korean')
302 expect(video2.nsfw).to.be.false
303 expect(video2.description).to.equal('my super description for pod 3-2')
304 expect(video2.podHost).to.equal('localhost:9003')
305 expect(video2.duration).to.equal(5)
306 expect(video2.tags).to.deep.equal([ 'tag2p3', 'tag3p3', 'tag4p3' ])
307 expect(video2.author).to.equal('root')
308 expect(dateIsValid(video2.createdAt)).to.be.true
309 expect(dateIsValid(video2.updatedAt)).to.be.true
310
311 expect(video2.files).to.have.lengthOf(1)
312
313 const file2 = video2.files[0]
314 const magnetUri2 = file2.magnetUri
315 expect(file2.magnetUri).to.have.lengthOf.above(2)
316 expect(file2.resolution).to.equal(720)
317 expect(file2.resolutionLabel).to.equal('720p')
318 expect(file2.size).to.equal(218910)
319
320 if (server.url !== 'http://localhost:9003') {
321 expect(video1.isLocal).to.be.false
322 expect(video2.isLocal).to.be.false
323 } else {
324 expect(video1.isLocal).to.be.true
325 expect(video2.isLocal).to.be.true
326 }
327
328 // All pods should have the same magnet Uri
329 if (baseMagnet === null) {
330 baseMagnet = magnetUri2
331 } else {
332 expect(baseMagnet).to.equal(magnetUri2)
333 }
334
335 const test1 = await testVideoImage(server.url, 'video_short3.webm', video1.thumbnailPath)
336 expect(test1).to.equal(true)
337
338 const test2 = await testVideoImage(server.url, 'video_short.webm', video2.thumbnailPath)
339 expect(test2).to.equal(true)
340 }
341 })
342 })
343
344 describe('Should seed the uploaded video', function () {
345 it('Should add the file 1 by asking pod 3', async function () {
346 // Yes, this could be long
347 this.timeout(200000)
348
349 const res = await getVideosList(servers[2].url)
350
351 const video = res.body.data[0]
352 toRemove.push(res.body.data[2])
353 toRemove.push(res.body.data[3])
354
355 const torrent = await webtorrentAdd(video.files[0].magnetUri)
356 expect(torrent.files).to.be.an('array')
357 expect(torrent.files.length).to.equal(1)
358 expect(torrent.files[0].path).to.exist.and.to.not.equal('')
359 })
360
361 it('Should add the file 2 by asking pod 1', async function () {
362 // Yes, this could be long
363 this.timeout(200000)
364
365 const res = await getVideosList(servers[0].url)
366
367 const video = res.body.data[1]
368
369 const torrent = await webtorrentAdd(video.files[0].magnetUri)
370 expect(torrent.files).to.be.an('array')
371 expect(torrent.files.length).to.equal(1)
372 expect(torrent.files[0].path).to.exist.and.to.not.equal('')
373 })
374
375 it('Should add the file 3 by asking pod 2', async function () {
376 // Yes, this could be long
377 this.timeout(200000)
378
379 const res = await getVideosList(servers[1].url)
380
381 const video = res.body.data[2]
382
383 const torrent = await webtorrentAdd(video.files[0].magnetUri)
384 expect(torrent.files).to.be.an('array')
385 expect(torrent.files.length).to.equal(1)
386 expect(torrent.files[0].path).to.exist.and.to.not.equal('')
387 })
388
389 it('Should add the file 3-2 by asking pod 1', async function () {
390 // Yes, this could be long
391 this.timeout(200000)
392
393 const res = await getVideosList(servers[0].url)
394
395 const video = res.body.data[3]
396
397 const torrent = await webtorrentAdd(video.files[0].magnetUri)
398 expect(torrent.files).to.be.an('array')
399 expect(torrent.files.length).to.equal(1)
400 expect(torrent.files[0].path).to.exist.and.to.not.equal('')
401 })
402
403 it('Should add the file 2 in 360p by asking pod 1', async function () {
404 // Yes, this could be long
405 this.timeout(200000)
406
407 const res = await getVideosList(servers[0].url)
408
409 const video = res.body.data.find(v => v.name === 'my super name for pod 2')
410 const file = video.files.find(f => f.resolution === 360)
411 expect(file).not.to.be.undefined
412
413 const torrent = await webtorrentAdd(file.magnetUri)
414 expect(torrent.files).to.be.an('array')
415 expect(torrent.files.length).to.equal(1)
416 expect(torrent.files[0].path).to.exist.and.to.not.equal('')
417 })
418 })
419
420 describe('Should update video views, likes and dislikes', function () {
421 let localVideosPod3 = []
422 let remoteVideosPod1 = []
423 let remoteVideosPod2 = []
424 let remoteVideosPod3 = []
425
426 before(async function () {
427 const res1 = await getVideosList(servers[0].url)
428 remoteVideosPod1 = res1.body.data.filter(video => video.isLocal === false).map(video => video.id)
429
430 const res2 = await getVideosList(servers[1].url)
431 remoteVideosPod2 = res2.body.data.filter(video => video.isLocal === false).map(video => video.id)
432
433 const res3 = await getVideosList(servers[2].url)
434 localVideosPod3 = res3.body.data.filter(video => video.isLocal === true).map(video => video.id)
435 remoteVideosPod3 = res3.body.data.filter(video => video.isLocal === false).map(video => video.id)
436 })
437
438 it('Should view multiple videos on owned servers', async function () {
439 this.timeout(30000)
440
441 const tasks: Promise<any>[] = []
442 tasks.push(getVideo(servers[2].url, localVideosPod3[0]))
443 tasks.push(getVideo(servers[2].url, localVideosPod3[0]))
444 tasks.push(getVideo(servers[2].url, localVideosPod3[0]))
445 tasks.push(getVideo(servers[2].url, localVideosPod3[1]))
446
447 await Promise.all(tasks)
448
449 await wait(22000)
450
451 for (const server of servers) {
452 const res = await getVideosList(server.url)
453
454 const videos = res.body.data
455 expect(videos.find(video => video.views === 3)).to.be.an('object')
456 expect(videos.find(video => video.views === 1)).to.be.an('object')
457 }
458 })
459
460 it('Should view multiple videos on each servers', async function () {
461 this.timeout(30000)
462
463 const tasks: Promise<any>[] = []
464 tasks.push(getVideo(servers[0].url, remoteVideosPod1[0]))
465 tasks.push(getVideo(servers[1].url, remoteVideosPod2[0]))
466 tasks.push(getVideo(servers[1].url, remoteVideosPod2[0]))
467 tasks.push(getVideo(servers[2].url, remoteVideosPod3[0]))
468 tasks.push(getVideo(servers[2].url, remoteVideosPod3[1]))
469 tasks.push(getVideo(servers[2].url, remoteVideosPod3[1]))
470 tasks.push(getVideo(servers[2].url, remoteVideosPod3[1]))
471 tasks.push(getVideo(servers[2].url, localVideosPod3[1]))
472 tasks.push(getVideo(servers[2].url, localVideosPod3[1]))
473 tasks.push(getVideo(servers[2].url, localVideosPod3[1]))
474
475 await Promise.all(tasks)
476
477 await wait(22000)
478
479 let baseVideos = null
480
481 for (const server of servers) {
482 const res = await getVideosList(server.url)
483
484 const videos = res.body.data
485
486 // Initialize base videos for future comparisons
487 if (baseVideos === null) {
488 baseVideos = videos
489 return
490 }
491
492 for (const baseVideo of baseVideos) {
493 const sameVideo = videos.find(video => video.name === baseVideo.name)
494 expect(baseVideo.views).to.equal(sameVideo.views)
495 }
496 }
497 })
498
499 it('Should like and dislikes videos on different services', async function () {
500 this.timeout(30000)
501
502 const tasks: Promise<any>[] = []
503 tasks.push(rateVideo(servers[0].url, servers[0].accessToken, remoteVideosPod1[0], 'like'))
504 tasks.push(rateVideo(servers[0].url, servers[0].accessToken, remoteVideosPod1[0], 'dislike'))
505 tasks.push(rateVideo(servers[0].url, servers[0].accessToken, remoteVideosPod1[0], 'like'))
506 tasks.push(rateVideo(servers[2].url, servers[2].accessToken, localVideosPod3[1], 'like'))
507 tasks.push(rateVideo(servers[2].url, servers[2].accessToken, localVideosPod3[1], 'dislike'))
508 tasks.push(rateVideo(servers[2].url, servers[2].accessToken, remoteVideosPod3[1], 'dislike'))
509 tasks.push(rateVideo(servers[2].url, servers[2].accessToken, remoteVideosPod3[0], 'like'))
510
511 await Promise.all(tasks)
512
513 await wait(22000)
514
515 let baseVideos = null
516 for (const server of servers) {
517 const res = await getVideosList(server.url)
518
519 const videos = res.body.data
520
521 // Initialize base videos for future comparisons
522 if (baseVideos === null) {
523 baseVideos = videos
524 return
525 }
526
527 baseVideos.forEach(baseVideo => {
528 const sameVideo = videos.find(video => video.name === baseVideo.name)
529 expect(baseVideo.likes).to.equal(sameVideo.likes)
530 expect(baseVideo.dislikes).to.equal(sameVideo.dislikes)
531 })
532 }
533 })
534 })
535
536 describe('Should manipulate these videos', function () {
537 it('Should update the video 3 by asking pod 3', async function () {
538 this.timeout(15000)
539
540 const attributes = {
541 name: 'my super video updated',
542 category: 10,
543 licence: 7,
544 language: 13,
545 nsfw: true,
546 description: 'my super description updated',
547 tags: [ 'tag_up_1', 'tag_up_2' ]
548 }
549
550 await updateVideo(servers[2].url, servers[2].accessToken, toRemove[0].id, attributes)
551
552 await wait(11000)
553 })
554
555 it('Should have the video 3 updated on each pod', async function () {
556 this.timeout(200000)
557
558 for (const server of servers) {
559 const res = await getVideosList(server.url)
560
561 const videos = res.body.data
562 const videoUpdated = videos.find(video => video.name === 'my super video updated')
563
564 expect(!!videoUpdated).to.be.true
565 expect(videoUpdated.category).to.equal(10)
566 expect(videoUpdated.categoryLabel).to.equal('Entertainment')
567 expect(videoUpdated.licence).to.equal(7)
568 expect(videoUpdated.licenceLabel).to.equal('Public Domain Dedication')
569 expect(videoUpdated.language).to.equal(13)
570 expect(videoUpdated.languageLabel).to.equal('French')
571 expect(videoUpdated.nsfw).to.be.ok
572 expect(videoUpdated.description).to.equal('my super description updated')
573 expect(videoUpdated.tags).to.deep.equal([ 'tag_up_1', 'tag_up_2' ])
574 expect(dateIsValid(videoUpdated.updatedAt, 20000)).to.be.true
575
576 const file = videoUpdated.files[0]
577 expect(file.magnetUri).to.have.lengthOf.above(2)
578 expect(file.resolution).to.equal(720)
579 expect(file.resolutionLabel).to.equal('720p')
580 expect(file.size).to.equal(292677)
581
582 const test = await testVideoImage(server.url, 'video_short3.webm', videoUpdated.thumbnailPath)
583 expect(test).to.equal(true)
584
585 // Avoid "duplicate torrent" errors
586 const refreshWebTorrent = true
587 const torrent = await webtorrentAdd(videoUpdated.files[0].magnetUri, refreshWebTorrent)
588 expect(torrent.files).to.be.an('array')
589 expect(torrent.files.length).to.equal(1)
590 expect(torrent.files[0].path).to.exist.and.to.not.equal('')
591 }
592 })
593
594 it('Should remove the videos 3 and 3-2 by asking pod 3', async function () {
595 this.timeout(15000)
596
597 await removeVideo(servers[2].url, servers[2].accessToken, toRemove[0].id)
598 await removeVideo(servers[2].url, servers[2].accessToken, toRemove[1].id)
599
600 await wait(11000)
601 })
602
603 it('Should have videos 1 and 3 on each pod', async function () {
604 for (const server of servers) {
605 const res = await getVideosList(server.url)
606
607 const videos = res.body.data
608 expect(videos).to.be.an('array')
609 expect(videos.length).to.equal(2)
610 expect(videos[0].name).not.to.equal(videos[1].name)
611 expect(videos[0].name).not.to.equal(toRemove[0].name)
612 expect(videos[1].name).not.to.equal(toRemove[0].name)
613 expect(videos[0].name).not.to.equal(toRemove[1].name)
614 expect(videos[1].name).not.to.equal(toRemove[1].name)
615
616 videoUUID = videos.find(video => video.name === 'my super name for pod 1').uuid
617 }
618 })
619
620 it('Should get the same video by UUID on each pod', async function () {
621 let baseVideo = null
622 for (const server of servers) {
623 const res = await getVideo(server.url, videoUUID)
624
625 const video = res.body
626
627 if (baseVideo === null) {
628 baseVideo = video
629 return
630 }
631
632 expect(baseVideo.name).to.equal(video.name)
633 expect(baseVideo.uuid).to.equal(video.uuid)
634 expect(baseVideo.category).to.equal(video.category)
635 expect(baseVideo.language).to.equal(video.language)
636 expect(baseVideo.licence).to.equal(video.licence)
637 expect(baseVideo.category).to.equal(video.category)
638 expect(baseVideo.nsfw).to.equal(video.nsfw)
639 expect(baseVideo.author).to.equal(video.author)
640 expect(baseVideo.tags).to.deep.equal(video.tags)
641 }
642 })
643
644 it('Should get the preview from each pod', async function () {
645 for (const server of servers) {
646 const res = await getVideo(server.url, videoUUID)
647 const video = res.body
648
649 const test = await testVideoImage(server.url, 'video_short1-preview.webm', video.previewPath)
650 expect(test).to.equal(true)
651 }
652 })
653 })
654
655 after(async function () {
656 killallServers(servers)
657
658 // Keep the logs if the test failed
659 if (this['ok']) {
660 await flushTests()
661 }
662 })
663 })