From 99afa081bc6ae7f34b2105075bd43e3625434fa8 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 15 Dec 2020 13:34:58 +0100 Subject: Add AP stats --- server/tests/api/server/stats.ts | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'server/tests/api') diff --git a/server/tests/api/server/stats.ts b/server/tests/api/server/stats.ts index 0e77712cf..9f785a80e 100644 --- a/server/tests/api/server/stats.ts +++ b/server/tests/api/server/stats.ts @@ -176,6 +176,32 @@ describe('Test stats (excluding redundancy)', function () { } }) + it('Should have the correct AP stats', async function () { + this.timeout(60000) + + for (let i = 0; i < 10; i++) { + await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'video' }) + } + + const res1 = await getStats(servers[1].url) + const first = res1.body as ServerStats + + await waitJobs(servers) + + const res2 = await getStats(servers[1].url) + const second: ServerStats = res2.body + + expect(second.totalActivityPubMessagesWaiting).to.equal(0) + expect(second.totalActivityPubMessagesProcessed).to.be.greaterThan(first.totalActivityPubMessagesProcessed) + + await wait(5000) + + const res3 = await getStats(servers[1].url) + const third: ServerStats = res3.body + + expect(third.activityPubMessagesProcessedPerSecond).to.be.lessThan(second.activityPubMessagesProcessedPerSecond) + }) + after(async function () { await cleanupTests(servers) }) -- cgit v1.2.3