aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--server/tests/api/videos/video-create-transcoding.ts6
-rw-r--r--server/tests/cli/create-import-video-file-job.ts10
-rw-r--r--shared/extra-utils/server/jobs.ts9
3 files changed, 19 insertions, 6 deletions
diff --git a/server/tests/api/videos/video-create-transcoding.ts b/server/tests/api/videos/video-create-transcoding.ts
index 128bc885a..c4627e0c1 100644
--- a/server/tests/api/videos/video-create-transcoding.ts
+++ b/server/tests/api/videos/video-create-transcoding.ts
@@ -7,6 +7,7 @@ import {
7 cleanupTests, 7 cleanupTests,
8 createMultipleServers, 8 createMultipleServers,
9 doubleFollow, 9 doubleFollow,
10 expectNoFailedTranscodingJob,
10 expectStartWith, 11 expectStartWith,
11 makeRawRequest, 12 makeRawRequest,
12 ObjectStorageCommand, 13 ObjectStorageCommand,
@@ -30,11 +31,6 @@ async function checkFilesInObjectStorage (video: VideoDetails) {
30 } 31 }
31} 32}
32 33
33async function expectNoFailedTranscodingJob (server: PeerTubeServer) {
34 const { data } = await server.jobs.listFailed({ jobType: 'video-transcoding' })
35 expect(data).to.have.lengthOf(0)
36}
37
38function runTests (objectStorage: boolean) { 34function runTests (objectStorage: boolean) {
39 let servers: PeerTubeServer[] = [] 35 let servers: PeerTubeServer[] = []
40 let videoUUID: string 36 let videoUUID: string
diff --git a/server/tests/cli/create-import-video-file-job.ts b/server/tests/cli/create-import-video-file-job.ts
index 1e278bacc..17ed67b05 100644
--- a/server/tests/cli/create-import-video-file-job.ts
+++ b/server/tests/cli/create-import-video-file-job.ts
@@ -7,6 +7,7 @@ import {
7 cleanupTests, 7 cleanupTests,
8 createMultipleServers, 8 createMultipleServers,
9 doubleFollow, 9 doubleFollow,
10 expectNoFailedTranscodingJob,
10 expectStartWith, 11 expectStartWith,
11 makeRawRequest, 12 makeRawRequest,
12 ObjectStorageCommand, 13 ObjectStorageCommand,
@@ -69,6 +70,10 @@ function runTests (objectStorage: boolean) {
69 } 70 }
70 71
71 await waitJobs(servers) 72 await waitJobs(servers)
73
74 for (const server of servers) {
75 await server.config.enableTranscoding()
76 }
72 }) 77 })
73 78
74 it('Should run a import job on video 1 with a lower resolution', async function () { 79 it('Should run a import job on video 1 with a lower resolution', async function () {
@@ -139,6 +144,11 @@ function runTests (objectStorage: boolean) {
139 } 144 }
140 }) 145 })
141 146
147 it('Should not have run transcoding after an import job', async function () {
148 const { data } = await servers[0].jobs.list({ jobType: 'video-transcoding' })
149 expect(data).to.have.lengthOf(0)
150 })
151
142 after(async function () { 152 after(async function () {
143 await cleanupTests(servers) 153 await cleanupTests(servers)
144 }) 154 })
diff --git a/shared/extra-utils/server/jobs.ts b/shared/extra-utils/server/jobs.ts
index afaaa5cd6..34fefd444 100644
--- a/shared/extra-utils/server/jobs.ts
+++ b/shared/extra-utils/server/jobs.ts
@@ -1,4 +1,5 @@
1 1
2import { expect } from 'chai'
2import { JobState, JobType } from '../../models' 3import { JobState, JobType } from '../../models'
3import { wait } from '../miscs' 4import { wait } from '../miscs'
4import { PeerTubeServer } from './server' 5import { PeerTubeServer } from './server'
@@ -70,8 +71,14 @@ async function waitJobs (serversArg: PeerTubeServer[] | PeerTubeServer, skipDela
70 } while (pendingRequests) 71 } while (pendingRequests)
71} 72}
72 73
74async function expectNoFailedTranscodingJob (server: PeerTubeServer) {
75 const { data } = await server.jobs.listFailed({ jobType: 'video-transcoding' })
76 expect(data).to.have.lengthOf(0)
77}
78
73// --------------------------------------------------------------------------- 79// ---------------------------------------------------------------------------
74 80
75export { 81export {
76 waitJobs 82 waitJobs,
83 expectNoFailedTranscodingJob
77} 84}