import 'mocha'
import * as chai from 'chai'
+import { areObjectStorageTestsDisabled } from '@shared/core-utils'
+import { HttpStatusCode, VideoDetails, VideoFile, VideoInclude } from '@shared/models'
import {
- areObjectStorageTestsDisabled,
cleanupTests,
createMultipleServers,
doubleFollow,
- expectStartWith,
makeRawRequest,
ObjectStorageCommand,
PeerTubeServer,
setAccessTokensToServers,
waitJobs
-} from '@shared/extra-utils'
-import { HttpStatusCode, VideoDetails, VideoFile } from '@shared/models'
+} from '@shared/server-commands'
+import { expectStartWith } from '../shared'
const expect = chai.expect
}
function runTests (objectStorage: boolean) {
- let video1UUID: string
+ let video1ShortId: string
let video2UUID: string
let servers: PeerTubeServer[] = []
// Upload two videos for our needs
{
- const { uuid } = await servers[0].videos.upload({ attributes: { name: 'video1' } })
- video1UUID = uuid
+ const { shortUUID } = await servers[0].videos.upload({ attributes: { name: 'video1' } })
+ video1ShortId = shortUUID
}
{
}
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 () {
- const command = `npm run create-import-video-file-job -- -v ${video1UUID} -i server/tests/fixtures/video_short-480.webm`
+ const command = `npm run create-import-video-file-job -- -v ${video1ShortId} -i server/tests/fixtures/video_short-480.webm`
await servers[0].cli.execWithEnv(command)
await waitJobs(servers)
const { data: videos } = await server.videos.list()
expect(videos).to.have.lengthOf(2)
- const video = videos.find(({ uuid }) => uuid === video1UUID)
- const videoDetails = await server.videos.get({ id: video.uuid })
+ const video = videos.find(({ shortUUID }) => shortUUID === video1ShortId)
+ const videoDetails = await server.videos.get({ id: video.shortUUID })
expect(videoDetails.files).to.have.lengthOf(2)
const [ originalVideo, transcodedVideo ] = videoDetails.files
await waitJobs(servers)
for (const server of servers) {
- const { data: videos } = await server.videos.list()
+ const { data: videos } = await server.videos.listWithToken({ include: VideoInclude.NOT_PUBLISHED_STATE })
expect(videos).to.have.lengthOf(2)
const video = videos.find(({ uuid }) => uuid === video2UUID)
})
it('Should run a import job on video 2 with the same resolution and the same extension', async function () {
- const command = `npm run create-import-video-file-job -- -v ${video1UUID} -i server/tests/fixtures/video_short2.webm`
+ const command = `npm run create-import-video-file-job -- -v ${video1ShortId} -i server/tests/fixtures/video_short2.webm`
await servers[0].cli.execWithEnv(command)
await waitJobs(servers)
for (const server of servers) {
- const { data: videos } = await server.videos.list()
+ const { data: videos } = await server.videos.listWithToken({ include: VideoInclude.NOT_PUBLISHED_STATE })
expect(videos).to.have.lengthOf(2)
- const video = videos.find(({ uuid }) => uuid === video1UUID)
+ const video = videos.find(({ shortUUID }) => shortUUID === video1ShortId)
const videoDetails = await server.videos.get({ id: video.uuid })
expect(videoDetails.files).to.have.lengthOf(2)
}
})
+ 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 () {
await cleanupTests(servers)
})