diff options
author | Chocobozzz <me@florianbigard.com> | 2023-04-21 15:00:01 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2023-05-09 08:57:34 +0200 |
commit | d102de1b38f2877463529c3b27bd35ffef4fd8bf (patch) | |
tree | 31fa0bdf26ad7a2ee46d600d804a6f03260266c8 /server/tests/api/videos/multiple-servers.ts | |
parent | 2fe978744e5b74eb824e4d79c1bb9b840169f125 (diff) | |
download | PeerTube-d102de1b38f2877463529c3b27bd35ffef4fd8bf.tar.gz PeerTube-d102de1b38f2877463529c3b27bd35ffef4fd8bf.tar.zst PeerTube-d102de1b38f2877463529c3b27bd35ffef4fd8bf.zip |
Add runner server tests
Diffstat (limited to 'server/tests/api/videos/multiple-servers.ts')
-rw-r--r-- | server/tests/api/videos/multiple-servers.ts | 42 |
1 files changed, 14 insertions, 28 deletions
diff --git a/server/tests/api/videos/multiple-servers.ts b/server/tests/api/videos/multiple-servers.ts index ff730287a..a52a04e07 100644 --- a/server/tests/api/videos/multiple-servers.ts +++ b/server/tests/api/videos/multiple-servers.ts | |||
@@ -5,6 +5,7 @@ import request from 'supertest' | |||
5 | import { | 5 | import { |
6 | checkTmpIsEmpty, | 6 | checkTmpIsEmpty, |
7 | checkVideoFilesWereRemoved, | 7 | checkVideoFilesWereRemoved, |
8 | checkWebTorrentWorks, | ||
8 | completeVideoCheck, | 9 | completeVideoCheck, |
9 | dateIsValid, | 10 | dateIsValid, |
10 | saveVideoInServers, | 11 | saveVideoInServers, |
@@ -21,8 +22,7 @@ import { | |||
21 | setAccessTokensToServers, | 22 | setAccessTokensToServers, |
22 | setDefaultAccountAvatar, | 23 | setDefaultAccountAvatar, |
23 | setDefaultChannelAvatar, | 24 | setDefaultChannelAvatar, |
24 | waitJobs, | 25 | waitJobs |
25 | webtorrentAdd | ||
26 | } from '@shared/server-commands' | 26 | } from '@shared/server-commands' |
27 | 27 | ||
28 | describe('Test multiple servers', function () { | 28 | describe('Test multiple servers', function () { |
@@ -134,7 +134,7 @@ describe('Test multiple servers', function () { | |||
134 | expect(data.length).to.equal(1) | 134 | expect(data.length).to.equal(1) |
135 | const video = data[0] | 135 | const video = data[0] |
136 | 136 | ||
137 | await completeVideoCheck(server, video, checkAttributes) | 137 | await completeVideoCheck({ server, originServer: servers[0], videoUUID: video.uuid, attributes: checkAttributes }) |
138 | publishedAt = video.publishedAt as string | 138 | publishedAt = video.publishedAt as string |
139 | 139 | ||
140 | expect(video.channel.avatars).to.have.lengthOf(2) | 140 | expect(video.channel.avatars).to.have.lengthOf(2) |
@@ -238,7 +238,7 @@ describe('Test multiple servers', function () { | |||
238 | expect(data.length).to.equal(2) | 238 | expect(data.length).to.equal(2) |
239 | const video = data[1] | 239 | const video = data[1] |
240 | 240 | ||
241 | await completeVideoCheck(server, video, checkAttributes) | 241 | await completeVideoCheck({ server, originServer: servers[1], videoUUID: video.uuid, attributes: checkAttributes }) |
242 | } | 242 | } |
243 | }) | 243 | }) |
244 | 244 | ||
@@ -328,7 +328,7 @@ describe('Test multiple servers', function () { | |||
328 | } | 328 | } |
329 | ] | 329 | ] |
330 | } | 330 | } |
331 | await completeVideoCheck(server, video1, checkAttributesVideo1) | 331 | await completeVideoCheck({ server, originServer: servers[2], videoUUID: video1.uuid, attributes: checkAttributesVideo1 }) |
332 | 332 | ||
333 | const checkAttributesVideo2 = { | 333 | const checkAttributesVideo2 = { |
334 | name: 'my super name for server 3-2', | 334 | name: 'my super name for server 3-2', |
@@ -362,7 +362,7 @@ describe('Test multiple servers', function () { | |||
362 | } | 362 | } |
363 | ] | 363 | ] |
364 | } | 364 | } |
365 | await completeVideoCheck(server, video2, checkAttributesVideo2) | 365 | await completeVideoCheck({ server, originServer: servers[2], videoUUID: video2.uuid, attributes: checkAttributesVideo2 }) |
366 | } | 366 | } |
367 | }) | 367 | }) |
368 | }) | 368 | }) |
@@ -408,10 +408,8 @@ describe('Test multiple servers', function () { | |||
408 | toRemove.push(data[3]) | 408 | toRemove.push(data[3]) |
409 | 409 | ||
410 | const videoDetails = await servers[2].videos.get({ id: video.id }) | 410 | const videoDetails = await servers[2].videos.get({ id: video.id }) |
411 | const torrent = await webtorrentAdd(videoDetails.files[0].magnetUri, true) | 411 | |
412 | expect(torrent.files).to.be.an('array') | 412 | await checkWebTorrentWorks(videoDetails.files[0].magnetUri) |
413 | expect(torrent.files.length).to.equal(1) | ||
414 | expect(torrent.files[0].path).to.exist.and.to.not.equal('') | ||
415 | }) | 413 | }) |
416 | 414 | ||
417 | it('Should add the file 2 by asking server 1', async function () { | 415 | it('Should add the file 2 by asking server 1', async function () { |
@@ -422,10 +420,7 @@ describe('Test multiple servers', function () { | |||
422 | const video = data[1] | 420 | const video = data[1] |
423 | const videoDetails = await servers[0].videos.get({ id: video.id }) | 421 | const videoDetails = await servers[0].videos.get({ id: video.id }) |
424 | 422 | ||
425 | const torrent = await webtorrentAdd(videoDetails.files[0].magnetUri, true) | 423 | await checkWebTorrentWorks(videoDetails.files[0].magnetUri) |
426 | expect(torrent.files).to.be.an('array') | ||
427 | expect(torrent.files.length).to.equal(1) | ||
428 | expect(torrent.files[0].path).to.exist.and.to.not.equal('') | ||
429 | }) | 424 | }) |
430 | 425 | ||
431 | it('Should add the file 3 by asking server 2', async function () { | 426 | it('Should add the file 3 by asking server 2', async function () { |
@@ -436,10 +431,7 @@ describe('Test multiple servers', function () { | |||
436 | const video = data[2] | 431 | const video = data[2] |
437 | const videoDetails = await servers[1].videos.get({ id: video.id }) | 432 | const videoDetails = await servers[1].videos.get({ id: video.id }) |
438 | 433 | ||
439 | const torrent = await webtorrentAdd(videoDetails.files[0].magnetUri, true) | 434 | await checkWebTorrentWorks(videoDetails.files[0].magnetUri) |
440 | expect(torrent.files).to.be.an('array') | ||
441 | expect(torrent.files.length).to.equal(1) | ||
442 | expect(torrent.files[0].path).to.exist.and.to.not.equal('') | ||
443 | }) | 435 | }) |
444 | 436 | ||
445 | it('Should add the file 3-2 by asking server 1', async function () { | 437 | it('Should add the file 3-2 by asking server 1', async function () { |
@@ -450,10 +442,7 @@ describe('Test multiple servers', function () { | |||
450 | const video = data[3] | 442 | const video = data[3] |
451 | const videoDetails = await servers[0].videos.get({ id: video.id }) | 443 | const videoDetails = await servers[0].videos.get({ id: video.id }) |
452 | 444 | ||
453 | const torrent = await webtorrentAdd(videoDetails.files[0].magnetUri) | 445 | await checkWebTorrentWorks(videoDetails.files[0].magnetUri) |
454 | expect(torrent.files).to.be.an('array') | ||
455 | expect(torrent.files.length).to.equal(1) | ||
456 | expect(torrent.files[0].path).to.exist.and.to.not.equal('') | ||
457 | }) | 446 | }) |
458 | 447 | ||
459 | it('Should add the file 2 in 360p by asking server 1', async function () { | 448 | it('Should add the file 2 in 360p by asking server 1', async function () { |
@@ -467,10 +456,7 @@ describe('Test multiple servers', function () { | |||
467 | const file = videoDetails.files.find(f => f.resolution.id === 360) | 456 | const file = videoDetails.files.find(f => f.resolution.id === 360) |
468 | expect(file).not.to.be.undefined | 457 | expect(file).not.to.be.undefined |
469 | 458 | ||
470 | const torrent = await webtorrentAdd(file.magnetUri) | 459 | await checkWebTorrentWorks(file.magnetUri) |
471 | expect(torrent.files).to.be.an('array') | ||
472 | expect(torrent.files.length).to.equal(1) | ||
473 | expect(torrent.files[0].path).to.exist.and.to.not.equal('') | ||
474 | }) | 460 | }) |
475 | }) | 461 | }) |
476 | 462 | ||
@@ -685,7 +671,7 @@ describe('Test multiple servers', function () { | |||
685 | thumbnailfile: 'thumbnail', | 671 | thumbnailfile: 'thumbnail', |
686 | previewfile: 'preview' | 672 | previewfile: 'preview' |
687 | } | 673 | } |
688 | await completeVideoCheck(server, videoUpdated, checkAttributes) | 674 | await completeVideoCheck({ server, originServer: servers[2], videoUUID: videoUpdated.uuid, attributes: checkAttributes }) |
689 | } | 675 | } |
690 | }) | 676 | }) |
691 | 677 | ||
@@ -1087,7 +1073,7 @@ describe('Test multiple servers', function () { | |||
1087 | } | 1073 | } |
1088 | ] | 1074 | ] |
1089 | } | 1075 | } |
1090 | await completeVideoCheck(server, video, checkAttributes) | 1076 | await completeVideoCheck({ server, originServer: servers[1], videoUUID: video.uuid, attributes: checkAttributes }) |
1091 | } | 1077 | } |
1092 | }) | 1078 | }) |
1093 | }) | 1079 | }) |