aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-10-25 15:01:51 +0200
committerChocobozzz <me@florianbigard.com>2022-10-25 15:01:51 +0200
commite82cb08722f076aea4fdfcfa53940e7e4a0ac419 (patch)
treec333cff4c86a1db7a7f2e796fb63e5c3b66fd95c
parent3fc43fa0b0e81ff972526057c9d63e0aaa012aaa (diff)
downloadPeerTube-e82cb08722f076aea4fdfcfa53940e7e4a0ac419.tar.gz
PeerTube-e82cb08722f076aea4fdfcfa53940e7e4a0ac419.tar.zst
PeerTube-e82cb08722f076aea4fdfcfa53940e7e4a0ac419.zip
Fix proxy tests
-rw-r--r--server/tests/api/object-storage/videos.ts4
-rw-r--r--server/tests/api/server/proxy.ts2
-rw-r--r--shared/server-commands/server/jobs.ts9
3 files changed, 11 insertions, 4 deletions
diff --git a/server/tests/api/object-storage/videos.ts b/server/tests/api/object-storage/videos.ts
index af3db9334..d1875febb 100644
--- a/server/tests/api/object-storage/videos.ts
+++ b/server/tests/api/object-storage/videos.ts
@@ -323,7 +323,7 @@ describe('Object storage for videos', function () {
323 323
324 const { uuid } = await server.videos.quickUpload({ name: 'video' }) 324 const { uuid } = await server.videos.quickUpload({ name: 'video' })
325 325
326 await waitJobs([ server ], true) 326 await waitJobs([ server ], { skipDelayed: true })
327 const video = await server.videos.get({ id: uuid }) 327 const video = await server.videos.get({ id: uuid })
328 328
329 expectStartWith(video.files[0].fileUrl, server.url) 329 expectStartWith(video.files[0].fileUrl, server.url)
@@ -358,7 +358,7 @@ describe('Object storage for videos', function () {
358 358
359 const { uuid } = await server.videos.quickUpload({ name: 'video' }) 359 const { uuid } = await server.videos.quickUpload({ name: 'video' })
360 360
361 await waitJobs([ server ], true) 361 await waitJobs([ server ], { skipDelayed: true })
362 const video = await server.videos.get({ id: uuid }) 362 const video = await server.videos.get({ id: uuid })
363 363
364 expectStartWith(video.files[0].fileUrl, ObjectStorageCommand.getMockWebTorrentBaseUrl()) 364 expectStartWith(video.files[0].fileUrl, ObjectStorageCommand.getMockWebTorrentBaseUrl())
diff --git a/server/tests/api/server/proxy.ts b/server/tests/api/server/proxy.ts
index 3700b0746..71c444efd 100644
--- a/server/tests/api/server/proxy.ts
+++ b/server/tests/api/server/proxy.ts
@@ -149,7 +149,7 @@ describe('Test proxy', function () {
149 await servers[0].run(ObjectStorageCommand.getDefaultMockConfig(), { env: badEnv }) 149 await servers[0].run(ObjectStorageCommand.getDefaultMockConfig(), { env: badEnv })
150 150
151 const { uuid } = await servers[0].videos.quickUpload({ name: 'video' }) 151 const { uuid } = await servers[0].videos.quickUpload({ name: 'video' })
152 await waitJobs(servers) 152 await waitJobs(servers, { skipDelayed: true })
153 153
154 const video = await servers[0].videos.get({ id: uuid }) 154 const video = await servers[0].videos.get({ id: uuid })
155 155
diff --git a/shared/server-commands/server/jobs.ts b/shared/server-commands/server/jobs.ts
index fc65a873b..e1d6cdff4 100644
--- a/shared/server-commands/server/jobs.ts
+++ b/shared/server-commands/server/jobs.ts
@@ -4,7 +4,14 @@ import { wait } from '@shared/core-utils'
4import { JobState, JobType } from '../../models' 4import { JobState, JobType } from '../../models'
5import { PeerTubeServer } from './server' 5import { PeerTubeServer } from './server'
6 6
7async function waitJobs (serversArg: PeerTubeServer[] | PeerTubeServer, skipDelayed = false) { 7async function waitJobs (
8 serversArg: PeerTubeServer[] | PeerTubeServer,
9 options: {
10 skipDelayed?: boolean // default false
11 } = {}
12) {
13 const { skipDelayed = false } = options
14
8 const pendingJobWait = process.env.NODE_PENDING_JOB_WAIT 15 const pendingJobWait = process.env.NODE_PENDING_JOB_WAIT
9 ? parseInt(process.env.NODE_PENDING_JOB_WAIT, 10) 16 ? parseInt(process.env.NODE_PENDING_JOB_WAIT, 10)
10 : 250 17 : 250