From 305facdfab1d5029366d2262ac390b9c71752e4b Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 20 Jul 2023 12:06:39 +0200 Subject: Add peers number and p2p enabled label to metrics --- server/tests/api/check-params/metrics.ts | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) (limited to 'server/tests/api/check-params') diff --git a/server/tests/api/check-params/metrics.ts b/server/tests/api/check-params/metrics.ts index be8253217..25443401d 100644 --- a/server/tests/api/check-params/metrics.ts +++ b/server/tests/api/check-params/metrics.ts @@ -89,10 +89,6 @@ describe('Test metrics API validators', function () { }) }) - it('Should fail with a missing errors', async function () { - - }) - it('Should fail with an missing/invalid errors', async function () { await makePostBodyRequest({ url: server.url, @@ -149,6 +145,22 @@ describe('Test metrics API validators', function () { }) }) + it('Should fail with an invalid p2pEnabled', async function () { + await makePostBodyRequest({ + url: server.url, + path, + fields: { ...baseParams, p2pEnabled: 'toto' } + }) + }) + + it('Should fail with an invalid totalPeers', async function () { + await makePostBodyRequest({ + url: server.url, + path, + fields: { ...baseParams, totalPeers: 'toto' } + }) + }) + it('Should fail with a bad video id', async function () { await makePostBodyRequest({ url: server.url, @@ -173,6 +185,13 @@ describe('Test metrics API validators', function () { fields: baseParams, expectedStatus: HttpStatusCode.NO_CONTENT_204 }) + + await makePostBodyRequest({ + url: server.url, + path, + fields: { ...baseParams, p2pEnabled: false, totalPeers: 32 }, + expectedStatus: HttpStatusCode.NO_CONTENT_204 + }) }) }) -- cgit v1.2.3