]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Fix tests
authorChocobozzz <me@florianbigard.com>
Wed, 17 May 2023 14:42:57 +0000 (16:42 +0200)
committerChocobozzz <me@florianbigard.com>
Wed, 17 May 2023 14:43:05 +0000 (16:43 +0200)
server/initializers/constants.ts
server/lib/runners/runner.ts
server/tests/api/check-params/video-captions.ts
server/tests/api/notifications/moderation-notifications.ts
server/tests/api/notifications/registrations-notifications.ts
server/tests/api/search/search-videos.ts

index 46455dd5be47559c9f9423bdf597215dc38893aa..85944fa3a420fe1cd5950c0745987a61f52f778f 100644 (file)
@@ -257,7 +257,8 @@ const JOB_REMOVAL_OPTIONS = {
 const VIDEO_IMPORT_TIMEOUT = Math.floor(JOB_TTL['video-import'] * 0.9)
 
 const RUNNER_JOBS = {
-  MAX_FAILURES: 5
+  MAX_FAILURES: 5,
+  LAST_CONTACT_UPDATE_INTERVAL: 30000
 }
 
 // ---------------------------------------------------------------------------
@@ -1034,6 +1035,8 @@ if (process.env.PRODUCTION_CONSTANTS !== 'true') {
     VIDEO_LIVE.SEGMENT_TIME_SECONDS.DEFAULT_LATENCY = 2
     VIDEO_LIVE.SEGMENT_TIME_SECONDS.SMALL_LATENCY = 1
     VIDEO_LIVE.EDGE_LIVE_DELAY_SEGMENTS_NOTIFICATION = 1
+
+    RUNNER_JOBS.LAST_CONTACT_UPDATE_INTERVAL = 2000
   }
 }
 
index 5478ab519a06a76d828781cc65e32a0fddc4bf04..921cae6f22975df5e915f2d74e3fdc2cf77fd1fe 100644 (file)
@@ -3,6 +3,7 @@ import { retryTransactionWrapper } from '@server/helpers/database-utils'
 import { logger, loggerTagsFactory } from '@server/helpers/logger'
 import { sequelizeTypescript } from '@server/initializers/database'
 import { MRunner } from '@server/types/models/runners'
+import { RUNNER_JOBS } from '@server/initializers/constants'
 
 const lTags = loggerTagsFactory('runner')
 
@@ -12,7 +13,7 @@ function updateLastRunnerContact (req: express.Request, runner: MRunner) {
   const now = new Date()
 
   // Don't update last runner contact too often
-  if (now.getTime() - runner.lastContact.getTime() < 30000) return
+  if (now.getTime() - runner.lastContact.getTime() < RUNNER_JOBS.LAST_CONTACT_UPDATE_INTERVAL) return
   if (updatingRunner.has(runner.id)) return
 
   updatingRunner.add(runner.id)
index bfce5ca4767524c46fe891a8bc88a28a886768d2..532dab1c4939278ba309403e4f8b05d1574bdbf7 100644 (file)
@@ -23,7 +23,7 @@ describe('Test video captions API validator', function () {
   // ---------------------------------------------------------------
 
   before(async function () {
-    this.timeout(30000)
+    this.timeout(120000)
 
     server = await createSingleServer(1)
 
index fa75182e15c42d9d5d581573cde3e9fdf9230e9c..d80de821e4f0da69b99a17922af5319f2e8bb6d1 100644 (file)
@@ -33,7 +33,7 @@ describe('Test moderation notifications', function () {
   let emails: object[] = []
 
   before(async function () {
-    this.timeout(50000)
+    this.timeout(120000)
 
     const res = await prepareNotificationsTest(3)
     emails = res.emails
index b5a7c2bb56745d76b8970d2ae1e3a57e8f6466ab..d20fc8df368bd2dd014b624511f218fd98d9c557 100644 (file)
@@ -21,7 +21,7 @@ describe('Test registrations notifications', function () {
   let baseParams: CheckerBaseParams
 
   before(async function () {
-    this.timeout(50000)
+    this.timeout(120000)
 
     const res = await prepareNotificationsTest(1)
 
index 5e85e3aa77ff672bce644a707a355cfdbc39b3fc..66c462942f4b1f0fb45d2c2b0305815d73ce3edd 100644 (file)
@@ -26,7 +26,7 @@ describe('Test videos search', function () {
   let command: SearchCommand
 
   before(async function () {
-    this.timeout(240000)
+    this.timeout(360000)
 
     const servers = await Promise.all([
       createSingleServer(1),