]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Fix tests
authorChocobozzz <me@florianbigard.com>
Fri, 19 Feb 2021 10:23:51 +0000 (11:23 +0100)
committerChocobozzz <me@florianbigard.com>
Fri, 19 Feb 2021 10:27:38 +0000 (11:27 +0100)
server/controllers/api/videos/comment.ts
server/tests/api/live/live-constraints.ts

index 38fa7c3b005deb6d02320b8c1fc6e0e8465ad5a1..f1f53d3542548243ef53cf699e0958e538f213af 100644 (file)
@@ -1,4 +1,5 @@
 import * as express from 'express'
+import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
 import { ResultList, ThreadsResultList, UserRight } from '../../../../shared/models'
 import { VideoCommentCreate } from '../../../../shared/models/videos/video-comment.model'
 import { auditLoggerFactory, CommentAuditView, getAuditIdFromRes } from '../../../helpers/audit-logger'
@@ -29,8 +30,6 @@ import {
 } from '../../../middlewares/validators'
 import { AccountModel } from '../../../models/account/account'
 import { VideoCommentModel } from '../../../models/video/video-comment'
-import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
-import { logger } from '@server/helpers/logger'
 
 const auditLogger = auditLoggerFactory('comments')
 const videoCommentRouter = express.Router()
index 1c60a7c76a641e66641a2e7cc012329d4cc70c49..5569e6066999a40f52d9ea4b22e2d55625809e36 100644 (file)
@@ -20,7 +20,8 @@ import {
   updateUser,
   userLogin,
   wait,
-  waitJobs
+  waitJobs,
+  waitUntilLivePublished
 } from '../../../../shared/extra-utils'
 
 const expect = chai.expect
@@ -55,6 +56,12 @@ describe('Test live constraints', function () {
     await checkLiveCleanup(servers[0], videoId, resolutions)
   }
 
+  async function waitUntilLivePublishedOnAllServers (videoId: string) {
+    for (const server of servers) {
+      await waitUntilLivePublished(server.url, server.accessToken, videoId)
+    }
+  }
+
   before(async function () {
     this.timeout(120000)
 
@@ -118,6 +125,7 @@ describe('Test live constraints', function () {
     const userVideoLiveoId = await createLiveWrapper(true)
     await runAndTestFfmpegStreamError(servers[0].url, userAccessToken, userVideoLiveoId, true)
 
+    await waitUntilLivePublishedOnAllServers(userVideoLiveoId)
     await waitJobs(servers)
 
     await checkSaveReplay(userVideoLiveoId)
@@ -140,6 +148,7 @@ describe('Test live constraints', function () {
     const userVideoLiveoId = await createLiveWrapper(true)
     await runAndTestFfmpegStreamError(servers[0].url, userAccessToken, userVideoLiveoId, true)
 
+    await waitUntilLivePublishedOnAllServers(userVideoLiveoId)
     await waitJobs(servers)
 
     await checkSaveReplay(userVideoLiveoId)
@@ -189,6 +198,7 @@ describe('Test live constraints', function () {
     const userVideoLiveoId = await createLiveWrapper(true)
     await runAndTestFfmpegStreamError(servers[0].url, userAccessToken, userVideoLiveoId, true)
 
+    await waitUntilLivePublishedOnAllServers(userVideoLiveoId)
     await waitJobs(servers)
 
     await checkSaveReplay(userVideoLiveoId, [ 720, 480, 360, 240 ])