From 9a82ce2455874a80167f5ae30bb19ea12eb0551e Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 4 May 2022 10:07:06 +0200 Subject: Fix quota inconstistencies with lives --- server/tests/api/live/live-constraints.ts | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'server/tests') diff --git a/server/tests/api/live/live-constraints.ts b/server/tests/api/live/live-constraints.ts index cab76f425..cf43c262a 100644 --- a/server/tests/api/live/live-constraints.ts +++ b/server/tests/api/live/live-constraints.ts @@ -12,6 +12,7 @@ import { PeerTubeServer, setAccessTokensToServers, setDefaultVideoChannel, + stopFfmpeg, waitJobs, waitUntilLiveReplacedByReplayOnAllServers, waitUntilLiveWaitingOnAllServers @@ -169,6 +170,30 @@ describe('Test live constraints', function () { await servers[0].live.runAndTestStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: false }) }) + it('Should have the same quota in admin and as a user', async function () { + this.timeout(120000) + + const userVideoLiveoId = await createLiveWrapper({ replay: true, permanent: false }) + const ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ token: userAccessToken, videoId: userVideoLiveoId }) + + await servers[0].live.waitUntilPublished({ videoId: userVideoLiveoId }) + + await wait(3000) + + const quotaUser = await servers[0].users.getMyQuotaUsed({ token: userAccessToken }) + + const { data } = await servers[0].users.list() + const quotaAdmin = data.find(u => u.username === 'user1') + + expect(quotaUser.videoQuotaUsed).to.equal(quotaAdmin.videoQuotaUsed) + expect(quotaUser.videoQuotaUsedDaily).to.equal(quotaAdmin.videoQuotaUsedDaily) + + expect(quotaUser.videoQuotaUsed).to.be.above(10) + expect(quotaUser.videoQuotaUsedDaily).to.be.above(10) + + await stopFfmpeg(ffmpegCommand) + }) + it('Should have max duration limit', async function () { this.timeout(60000) -- cgit v1.2.3