From 3f0ceab06e5320f62f593c49daa30d963dbc36f9 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 22 May 2023 15:52:59 +0200 Subject: More robust quota check Avoid concurrency issues with permanent lives --- server/tests/api/live/live-constraints.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'server/tests/api') diff --git a/server/tests/api/live/live-constraints.ts b/server/tests/api/live/live-constraints.ts index 168241b79..7af6af193 100644 --- a/server/tests/api/live/live-constraints.ts +++ b/server/tests/api/live/live-constraints.ts @@ -2,7 +2,7 @@ import { expect } from 'chai' import { wait } from '@shared/core-utils' -import { LiveVideoError, VideoPrivacy } from '@shared/models' +import { LiveVideoError, UserVideoQuota, VideoPrivacy } from '@shared/models' import { cleanupTests, ConfigCommand, @@ -172,12 +172,18 @@ describe('Test live constraints', function () { const ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ token: userAccessToken, videoId: userVideoLiveoId }) await servers[0].live.waitUntilPublished({ videoId: userVideoLiveoId }) + // Wait previous live cleanups + await wait(3000) const baseQuota = await servers[0].users.getMyQuotaUsed({ token: userAccessToken }) - await wait(3000) + let quotaUser: UserVideoQuota + + do { + await wait(500) - const quotaUser = await servers[0].users.getMyQuotaUsed({ token: userAccessToken }) + quotaUser = await servers[0].users.getMyQuotaUsed({ token: userAccessToken }) + } while (quotaUser.videoQuotaUsed < baseQuota.videoQuotaUsed) const { data } = await servers[0].users.list() const quotaAdmin = data.find(u => u.username === 'user1') -- cgit v1.2.3