Fix proxy tests

pull/5378/head
Chocobozzz 2022-10-25 15:01:51 +02:00
parent 3fc43fa0b0
commit e82cb08722
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
3 changed files with 11 additions and 4 deletions

View File

@ -323,7 +323,7 @@ describe('Object storage for videos', function () {
const { uuid } = await server.videos.quickUpload({ name: 'video' }) const { uuid } = await server.videos.quickUpload({ name: 'video' })
await waitJobs([ server ], true) await waitJobs([ server ], { skipDelayed: true })
const video = await server.videos.get({ id: uuid }) const video = await server.videos.get({ id: uuid })
expectStartWith(video.files[0].fileUrl, server.url) expectStartWith(video.files[0].fileUrl, server.url)
@ -358,7 +358,7 @@ describe('Object storage for videos', function () {
const { uuid } = await server.videos.quickUpload({ name: 'video' }) const { uuid } = await server.videos.quickUpload({ name: 'video' })
await waitJobs([ server ], true) await waitJobs([ server ], { skipDelayed: true })
const video = await server.videos.get({ id: uuid }) const video = await server.videos.get({ id: uuid })
expectStartWith(video.files[0].fileUrl, ObjectStorageCommand.getMockWebTorrentBaseUrl()) expectStartWith(video.files[0].fileUrl, ObjectStorageCommand.getMockWebTorrentBaseUrl())

View File

@ -149,7 +149,7 @@ describe('Test proxy', function () {
await servers[0].run(ObjectStorageCommand.getDefaultMockConfig(), { env: badEnv }) await servers[0].run(ObjectStorageCommand.getDefaultMockConfig(), { env: badEnv })
const { uuid } = await servers[0].videos.quickUpload({ name: 'video' }) const { uuid } = await servers[0].videos.quickUpload({ name: 'video' })
await waitJobs(servers) await waitJobs(servers, { skipDelayed: true })
const video = await servers[0].videos.get({ id: uuid }) const video = await servers[0].videos.get({ id: uuid })

View File

@ -4,7 +4,14 @@ import { wait } from '@shared/core-utils'
import { JobState, JobType } from '../../models' import { JobState, JobType } from '../../models'
import { PeerTubeServer } from './server' import { PeerTubeServer } from './server'
async function waitJobs (serversArg: PeerTubeServer[] | PeerTubeServer, skipDelayed = false) { async function waitJobs (
serversArg: PeerTubeServer[] | PeerTubeServer,
options: {
skipDelayed?: boolean // default false
} = {}
) {
const { skipDelayed = false } = options
const pendingJobWait = process.env.NODE_PENDING_JOB_WAIT const pendingJobWait = process.env.NODE_PENDING_JOB_WAIT
? parseInt(process.env.NODE_PENDING_JOB_WAIT, 10) ? parseInt(process.env.NODE_PENDING_JOB_WAIT, 10)
: 250 : 250