Ensure we don't run transcoding after import file

This commit is contained in:
Chocobozzz 2021-11-23 15:22:07 +01:00
parent 0c8af78521
commit 842a15732b
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
3 changed files with 19 additions and 6 deletions

View File

@ -7,6 +7,7 @@ import {
cleanupTests, cleanupTests,
createMultipleServers, createMultipleServers,
doubleFollow, doubleFollow,
expectNoFailedTranscodingJob,
expectStartWith, expectStartWith,
makeRawRequest, makeRawRequest,
ObjectStorageCommand, ObjectStorageCommand,
@ -30,11 +31,6 @@ async function checkFilesInObjectStorage (video: VideoDetails) {
} }
} }
async function expectNoFailedTranscodingJob (server: PeerTubeServer) {
const { data } = await server.jobs.listFailed({ jobType: 'video-transcoding' })
expect(data).to.have.lengthOf(0)
}
function runTests (objectStorage: boolean) { function runTests (objectStorage: boolean) {
let servers: PeerTubeServer[] = [] let servers: PeerTubeServer[] = []
let videoUUID: string let videoUUID: string

View File

@ -7,6 +7,7 @@ import {
cleanupTests, cleanupTests,
createMultipleServers, createMultipleServers,
doubleFollow, doubleFollow,
expectNoFailedTranscodingJob,
expectStartWith, expectStartWith,
makeRawRequest, makeRawRequest,
ObjectStorageCommand, ObjectStorageCommand,
@ -69,6 +70,10 @@ function runTests (objectStorage: boolean) {
} }
await waitJobs(servers) await waitJobs(servers)
for (const server of servers) {
await server.config.enableTranscoding()
}
}) })
it('Should run a import job on video 1 with a lower resolution', async function () { it('Should run a import job on video 1 with a lower resolution', async function () {
@ -139,6 +144,11 @@ function runTests (objectStorage: boolean) {
} }
}) })
it('Should not have run transcoding after an import job', async function () {
const { data } = await servers[0].jobs.list({ jobType: 'video-transcoding' })
expect(data).to.have.lengthOf(0)
})
after(async function () { after(async function () {
await cleanupTests(servers) await cleanupTests(servers)
}) })

View File

@ -1,4 +1,5 @@
import { expect } from 'chai'
import { JobState, JobType } from '../../models' import { JobState, JobType } from '../../models'
import { wait } from '../miscs' import { wait } from '../miscs'
import { PeerTubeServer } from './server' import { PeerTubeServer } from './server'
@ -70,8 +71,14 @@ async function waitJobs (serversArg: PeerTubeServer[] | PeerTubeServer, skipDela
} while (pendingRequests) } while (pendingRequests)
} }
async function expectNoFailedTranscodingJob (server: PeerTubeServer) {
const { data } = await server.jobs.listFailed({ jobType: 'video-transcoding' })
expect(data).to.have.lengthOf(0)
}
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
export { export {
waitJobs waitJobs,
expectNoFailedTranscodingJob
} }