aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api
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
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')
-rw-r--r--server/tests/api/check-params/views.ts2
-rw-r--r--server/tests/api/views/video-views-counter.ts9
-rw-r--r--server/tests/api/views/video-views-overall-stats.ts6
-rw-r--r--server/tests/api/views/video-views-retention-stats.ts2
-rw-r--r--server/tests/api/views/video-views-timeserie-stats.ts4
5 files changed, 12 insertions, 11 deletions
diff --git a/server/tests/api/check-params/views.ts b/server/tests/api/check-params/views.ts
index 185b04af1..ca4752345 100644
--- a/server/tests/api/check-params/views.ts
+++ b/server/tests/api/check-params/views.ts
@@ -19,7 +19,7 @@ describe('Test videos views', function () {
19 let userAccessToken: string 19 let userAccessToken: string
20 20
21 before(async function () { 21 before(async function () {
22 this.timeout(30000) 22 this.timeout(120000)
23 23
24 servers = await createMultipleServers(2) 24 servers = await createMultipleServers(2)
25 await setAccessTokensToServers(servers) 25 await setAccessTokensToServers(servers)
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 })
diff --git a/server/tests/api/views/video-views-overall-stats.ts b/server/tests/api/views/video-views-overall-stats.ts
index 22761d6ec..d8de73cbc 100644
--- a/server/tests/api/views/video-views-overall-stats.ts
+++ b/server/tests/api/views/video-views-overall-stats.ts
@@ -21,7 +21,7 @@ describe('Test views overall stats', function () {
21 let vodVideoId: string 21 let vodVideoId: string
22 22
23 before(async function () { 23 before(async function () {
24 this.timeout(60000); 24 this.timeout(120000);
25 25
26 ({ vodVideoId } = await prepareViewsVideos({ servers, live: false, vod: true })) 26 ({ vodVideoId } = await prepareViewsVideos({ servers, live: false, vod: true }))
27 }) 27 })
@@ -74,7 +74,7 @@ describe('Test views overall stats', function () {
74 let command: FfmpegCommand 74 let command: FfmpegCommand
75 75
76 before(async function () { 76 before(async function () {
77 this.timeout(60000); 77 this.timeout(120000);
78 78
79 ({ vodVideoId, liveVideoId, ffmpegCommand: command } = await prepareViewsVideos({ servers, live: true, vod: true })) 79 ({ vodVideoId, liveVideoId, ffmpegCommand: command } = await prepareViewsVideos({ servers, live: true, vod: true }))
80 }) 80 })
@@ -189,7 +189,7 @@ describe('Test views overall stats', function () {
189 let videoUUID: string 189 let videoUUID: string
190 190
191 before(async function () { 191 before(async function () {
192 this.timeout(60000); 192 this.timeout(120000);
193 193
194 ({ vodVideoId: videoUUID } = await prepareViewsVideos({ servers, live: true, vod: true })) 194 ({ vodVideoId: videoUUID } = await prepareViewsVideos({ servers, live: true, vod: true }))
195 }) 195 })
diff --git a/server/tests/api/views/video-views-retention-stats.ts b/server/tests/api/views/video-views-retention-stats.ts
index 98be7bfdb..a27141d68 100644
--- a/server/tests/api/views/video-views-retention-stats.ts
+++ b/server/tests/api/views/video-views-retention-stats.ts
@@ -20,7 +20,7 @@ describe('Test views retention stats', function () {
20 let vodVideoId: string 20 let vodVideoId: string
21 21
22 before(async function () { 22 before(async function () {
23 this.timeout(60000); 23 this.timeout(120000);
24 24
25 ({ vodVideoId } = await prepareViewsVideos({ servers, live: false, vod: true })) 25 ({ vodVideoId } = await prepareViewsVideos({ servers, live: false, vod: true }))
26 }) 26 })
diff --git a/server/tests/api/views/video-views-timeserie-stats.ts b/server/tests/api/views/video-views-timeserie-stats.ts
index 98c041cdf..858edeff7 100644
--- a/server/tests/api/views/video-views-timeserie-stats.ts
+++ b/server/tests/api/views/video-views-timeserie-stats.ts
@@ -24,7 +24,7 @@ describe('Test views timeserie stats', function () {
24 let vodVideoId: string 24 let vodVideoId: string
25 25
26 before(async function () { 26 before(async function () {
27 this.timeout(60000); 27 this.timeout(120000);
28 28
29 ({ vodVideoId } = await prepareViewsVideos({ servers, live: false, vod: true })) 29 ({ vodVideoId } = await prepareViewsVideos({ servers, live: false, vod: true }))
30 }) 30 })
@@ -63,7 +63,7 @@ describe('Test views timeserie stats', function () {
63 } 63 }
64 64
65 before(async function () { 65 before(async function () {
66 this.timeout(60000); 66 this.timeout(120000);
67 67
68 ({ vodVideoId, liveVideoId, ffmpegCommand: command } = await prepareViewsVideos({ servers, live: true, vod: true })) 68 ({ vodVideoId, liveVideoId, ffmpegCommand: command } = await prepareViewsVideos({ servers, live: true, vod: true }))
69 }) 69 })