aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/views/video-views-counter.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-04-06 08:50:43 +0200
committerChocobozzz <chocobozzz@cpy.re>2022-04-15 09:49:35 +0200
commitac907dc7c158056e9b6a5cb58acd27df5c7c2670 (patch)
treef9d8bff22e0543a305c64e1a1808c0df6d512f1e /server/tests/api/views/video-views-counter.ts
parentdfbcefc20dc64f0814b1f2e8e782a4ea1bd24db2 (diff)
downloadPeerTube-ac907dc7c158056e9b6a5cb58acd27df5c7c2670.tar.gz
PeerTube-ac907dc7c158056e9b6a5cb58acd27df5c7c2670.tar.zst
PeerTube-ac907dc7c158056e9b6a5cb58acd27df5c7c2670.zip
Improve viewer counter
More precise, avoid weird decrease, reuse an id to federate viewers
Diffstat (limited to 'server/tests/api/views/video-views-counter.ts')
-rw-r--r--server/tests/api/views/video-views-counter.ts9
1 files changed, 5 insertions, 4 deletions
diff --git a/server/tests/api/views/video-views-counter.ts b/server/tests/api/views/video-views-counter.ts
index b68aaa350..b8969d52d 100644
--- a/server/tests/api/views/video-views-counter.ts
+++ b/server/tests/api/views/video-views-counter.ts
@@ -57,10 +57,11 @@ describe('Test video views/viewers counters', function () {
57 }) 57 })
58 58
59 it('Should not view again this video with the same IP', async function () { 59 it('Should not view again this video with the same IP', async function () {
60 await servers[0].views.simulateViewer({ id: videoUUID, currentTimes: [ 1, 4 ] }) 60 await servers[0].views.simulateViewer({ id: videoUUID, xForwardedFor: '0.0.0.1,127.0.0.1', currentTimes: [ 1, 4 ] })
61 await servers[0].views.simulateViewer({ id: videoUUID, xForwardedFor: '0.0.0.1,127.0.0.1', currentTimes: [ 1, 4 ] })
61 await processViewsBuffer(servers) 62 await processViewsBuffer(servers)
62 63
63 await checkCounter('views', videoUUID, 1) 64 await checkCounter('views', videoUUID, 2)
64 }) 65 })
65 66
66 it('Should view the video from server 2 and send the event', async function () { 67 it('Should view the video from server 2 and send the event', async function () {
@@ -68,7 +69,7 @@ describe('Test video views/viewers counters', function () {
68 await waitJobs(servers) 69 await waitJobs(servers)
69 await processViewsBuffer(servers) 70 await processViewsBuffer(servers)
70 71
71 await checkCounter('views', videoUUID, 2) 72 await checkCounter('views', videoUUID, 3)
72 }) 73 })
73 }) 74 })
74 75
@@ -78,7 +79,7 @@ describe('Test video views/viewers counters', function () {
78 let command: FfmpegCommand 79 let command: FfmpegCommand
79 80
80 before(async function () { 81 before(async function () {
81 this.timeout(60000); 82 this.timeout(120000);
82 83
83 ({ vodVideoId, liveVideoId, ffmpegCommand: command } = await prepareViewsVideos({ servers, live: true, vod: true })) 84 ({ vodVideoId, liveVideoId, ffmpegCommand: command } = await prepareViewsVideos({ servers, live: true, vod: true }))
84 }) 85 })