diff options
author | Chocobozzz <me@florianbigard.com> | 2022-03-24 13:36:47 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2022-04-15 09:49:35 +0200 |
commit | b211106695bb82f6c32e53306081b5262c3d109d (patch) | |
tree | fa187de1c33b0956665f5362e29af6b0f6d8bb57 /server/tests/api/videos/multiple-servers.ts | |
parent | 69d48ee30c9d47cddf0c3c047dc99a99dcb6e894 (diff) | |
download | PeerTube-b211106695bb82f6c32e53306081b5262c3d109d.tar.gz PeerTube-b211106695bb82f6c32e53306081b5262c3d109d.tar.zst PeerTube-b211106695bb82f6c32e53306081b5262c3d109d.zip |
Support video views/viewers stats in server
* Add "currentTime" and "event" body params to view endpoint
* Merge watching and view endpoints
* Introduce WatchAction AP activity
* Add tables to store viewer information of local videos
* Add endpoints to fetch video views/viewers stats of local videos
* Refactor views/viewers handlers
* Support "views" and "viewers" counters for both VOD and live videos
Diffstat (limited to 'server/tests/api/videos/multiple-servers.ts')
-rw-r--r-- | server/tests/api/videos/multiple-servers.ts | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/server/tests/api/videos/multiple-servers.ts b/server/tests/api/videos/multiple-servers.ts index a9df262dc..84c1515a3 100644 --- a/server/tests/api/videos/multiple-servers.ts +++ b/server/tests/api/videos/multiple-servers.ts | |||
@@ -504,21 +504,22 @@ describe('Test multiple servers', function () { | |||
504 | it('Should view multiple videos on owned servers', async function () { | 504 | it('Should view multiple videos on owned servers', async function () { |
505 | this.timeout(30000) | 505 | this.timeout(30000) |
506 | 506 | ||
507 | await servers[2].videos.view({ id: localVideosServer3[0] }) | 507 | await servers[2].views.simulateView({ id: localVideosServer3[0] }) |
508 | await wait(1000) | 508 | await wait(1000) |
509 | 509 | ||
510 | await servers[2].videos.view({ id: localVideosServer3[0] }) | 510 | await servers[2].views.simulateView({ id: localVideosServer3[0] }) |
511 | await servers[2].videos.view({ id: localVideosServer3[1] }) | 511 | await servers[2].views.simulateView({ id: localVideosServer3[1] }) |
512 | 512 | ||
513 | await wait(1000) | 513 | await wait(1000) |
514 | 514 | ||
515 | await servers[2].videos.view({ id: localVideosServer3[0] }) | 515 | await servers[2].views.simulateView({ id: localVideosServer3[0] }) |
516 | await servers[2].videos.view({ id: localVideosServer3[0] }) | 516 | await servers[2].views.simulateView({ id: localVideosServer3[0] }) |
517 | 517 | ||
518 | await waitJobs(servers) | 518 | await waitJobs(servers) |
519 | 519 | ||
520 | // Wait the repeatable job | 520 | for (const server of servers) { |
521 | await wait(6000) | 521 | await server.debug.sendCommand({ body: { command: 'process-video-views-buffer' } }) |
522 | } | ||
522 | 523 | ||
523 | await waitJobs(servers) | 524 | await waitJobs(servers) |
524 | 525 | ||
@@ -537,23 +538,24 @@ describe('Test multiple servers', function () { | |||
537 | this.timeout(45000) | 538 | this.timeout(45000) |
538 | 539 | ||
539 | const tasks: Promise<any>[] = [] | 540 | const tasks: Promise<any>[] = [] |
540 | tasks.push(servers[0].videos.view({ id: remoteVideosServer1[0] })) | 541 | tasks.push(servers[0].views.simulateView({ id: remoteVideosServer1[0] })) |
541 | tasks.push(servers[1].videos.view({ id: remoteVideosServer2[0] })) | 542 | tasks.push(servers[1].views.simulateView({ id: remoteVideosServer2[0] })) |
542 | tasks.push(servers[1].videos.view({ id: remoteVideosServer2[0] })) | 543 | tasks.push(servers[1].views.simulateView({ id: remoteVideosServer2[0] })) |
543 | tasks.push(servers[2].videos.view({ id: remoteVideosServer3[0] })) | 544 | tasks.push(servers[2].views.simulateView({ id: remoteVideosServer3[0] })) |
544 | tasks.push(servers[2].videos.view({ id: remoteVideosServer3[1] })) | 545 | tasks.push(servers[2].views.simulateView({ id: remoteVideosServer3[1] })) |
545 | tasks.push(servers[2].videos.view({ id: remoteVideosServer3[1] })) | 546 | tasks.push(servers[2].views.simulateView({ id: remoteVideosServer3[1] })) |
546 | tasks.push(servers[2].videos.view({ id: remoteVideosServer3[1] })) | 547 | tasks.push(servers[2].views.simulateView({ id: remoteVideosServer3[1] })) |
547 | tasks.push(servers[2].videos.view({ id: localVideosServer3[1] })) | 548 | tasks.push(servers[2].views.simulateView({ id: localVideosServer3[1] })) |
548 | tasks.push(servers[2].videos.view({ id: localVideosServer3[1] })) | 549 | tasks.push(servers[2].views.simulateView({ id: localVideosServer3[1] })) |
549 | tasks.push(servers[2].videos.view({ id: localVideosServer3[1] })) | 550 | tasks.push(servers[2].views.simulateView({ id: localVideosServer3[1] })) |
550 | 551 | ||
551 | await Promise.all(tasks) | 552 | await Promise.all(tasks) |
552 | 553 | ||
553 | await waitJobs(servers) | 554 | await waitJobs(servers) |
554 | 555 | ||
555 | // Wait the repeatable job | 556 | for (const server of servers) { |
556 | await wait(16000) | 557 | await server.debug.sendCommand({ body: { command: 'process-video-views-buffer' } }) |
558 | } | ||
557 | 559 | ||
558 | await waitJobs(servers) | 560 | await waitJobs(servers) |
559 | 561 | ||