diff options
author | Chocobozzz <me@florianbigard.com> | 2021-02-26 10:28:11 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-02-26 10:28:11 +0100 |
commit | 543442a3be9d7740749eb3918dc59f502ff042f9 (patch) | |
tree | 3d2959757b7907ea9be8a6f6a69d4bab8521dbc3 /server/tests | |
parent | cb2e36618ca5986949d4326ea939b5b08f3a9a82 (diff) | |
download | PeerTube-543442a3be9d7740749eb3918dc59f502ff042f9.tar.gz PeerTube-543442a3be9d7740749eb3918dc59f502ff042f9.tar.zst PeerTube-543442a3be9d7740749eb3918dc59f502ff042f9.zip |
Add more AP stats to stats endpoint
It will help to understand if the federation correctly works or not
Diffstat (limited to 'server/tests')
-rw-r--r-- | server/tests/api/server/stats.ts | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/server/tests/api/server/stats.ts b/server/tests/api/server/stats.ts index 332c09585..eb474c1f5 100644 --- a/server/tests/api/server/stats.ts +++ b/server/tests/api/server/stats.ts | |||
@@ -21,6 +21,7 @@ import { waitJobs } from '../../../../shared/extra-utils/server/jobs' | |||
21 | import { getStats } from '../../../../shared/extra-utils/server/stats' | 21 | import { getStats } from '../../../../shared/extra-utils/server/stats' |
22 | import { addVideoCommentThread } from '../../../../shared/extra-utils/videos/video-comments' | 22 | import { addVideoCommentThread } from '../../../../shared/extra-utils/videos/video-comments' |
23 | import { ServerStats } from '../../../../shared/models/server/server-stats.model' | 23 | import { ServerStats } from '../../../../shared/models/server/server-stats.model' |
24 | import { ActivityType } from '@shared/models' | ||
24 | 25 | ||
25 | const expect = chai.expect | 26 | const expect = chai.expect |
26 | 27 | ||
@@ -201,6 +202,22 @@ describe('Test stats (excluding redundancy)', function () { | |||
201 | const second: ServerStats = res2.body | 202 | const second: ServerStats = res2.body |
202 | 203 | ||
203 | expect(second.totalActivityPubMessagesProcessed).to.be.greaterThan(first.totalActivityPubMessagesProcessed) | 204 | expect(second.totalActivityPubMessagesProcessed).to.be.greaterThan(first.totalActivityPubMessagesProcessed) |
205 | const apTypes: ActivityType[] = [ | ||
206 | 'Create', 'Update', 'Delete', 'Follow', 'Accept', 'Announce', 'Undo', 'Like', 'Reject', 'View', 'Dislike', 'Flag' | ||
207 | ] | ||
208 | |||
209 | const processed = apTypes.reduce( | ||
210 | (previous, type) => previous + second['totalActivityPub' + type + 'MessagesSuccesses'], | ||
211 | 0 | ||
212 | ) | ||
213 | expect(second.totalActivityPubMessagesProcessed).to.equal(processed) | ||
214 | expect(second.totalActivityPubMessagesSuccesses).to.equal(processed) | ||
215 | |||
216 | expect(second.totalActivityPubMessagesErrors).to.equal(0) | ||
217 | |||
218 | for (const apType of apTypes) { | ||
219 | expect(second['totalActivityPub' + apType + 'MessagesErrors']).to.equal(0) | ||
220 | } | ||
204 | 221 | ||
205 | await wait(6000) | 222 | await wait(6000) |
206 | 223 | ||