1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-06 03:50:26 +02:00

Support studio transcoding in peertube runner

This commit is contained in:
Chocobozzz 2023-05-04 15:29:34 +02:00 committed by Chocobozzz
parent 6a49056026
commit 5e47f6ab98
67 changed files with 1423 additions and 262 deletions

View file

@ -1,5 +1,5 @@
import { expect } from 'chai'
import { checkPersistentTmpIsEmpty, expectStartWith } from '@server/tests/shared'
import { checkPersistentTmpIsEmpty, checkVideoDuration, expectStartWith } from '@server/tests/shared'
import { areMockObjectStorageTestsDisabled, getAllFiles } from '@shared/core-utils'
import { VideoStudioTask } from '@shared/models'
import {
@ -18,20 +18,6 @@ describe('Test video studio', function () {
let servers: PeerTubeServer[] = []
let videoUUID: string
async function checkDuration (server: PeerTubeServer, duration: number) {
const video = await server.videos.get({ id: videoUUID })
expect(video.duration).to.be.approximately(duration, 1)
for (const file of video.files) {
const metadata = await server.videos.getFileMetadata({ url: file.metadataUrl })
for (const stream of metadata.streams) {
expect(Math.round(stream.duration)).to.be.approximately(duration, 1)
}
}
}
async function renewVideo (fixture = 'video_short.webm') {
const video = await servers[0].videos.quickUpload({ name: 'video', fixture })
videoUUID = video.uuid
@ -79,7 +65,7 @@ describe('Test video studio', function () {
])
for (const server of servers) {
await checkDuration(server, 3)
await checkVideoDuration(server, videoUUID, 3)
const video = await server.videos.get({ id: videoUUID })
expect(new Date(video.publishedAt)).to.be.below(beforeTasks)
@ -100,7 +86,7 @@ describe('Test video studio', function () {
])
for (const server of servers) {
await checkDuration(server, 2)
await checkVideoDuration(server, videoUUID, 2)
}
})
@ -119,7 +105,7 @@ describe('Test video studio', function () {
])
for (const server of servers) {
await checkDuration(server, 4)
await checkVideoDuration(server, videoUUID, 4)
}
})
})
@ -140,7 +126,7 @@ describe('Test video studio', function () {
])
for (const server of servers) {
await checkDuration(server, 10)
await checkVideoDuration(server, videoUUID, 10)
}
})
@ -158,7 +144,7 @@ describe('Test video studio', function () {
])
for (const server of servers) {
await checkDuration(server, 7)
await checkVideoDuration(server, videoUUID, 7)
}
})
@ -183,7 +169,7 @@ describe('Test video studio', function () {
])
for (const server of servers) {
await checkDuration(server, 12)
await checkVideoDuration(server, videoUUID, 12)
}
})
@ -201,7 +187,7 @@ describe('Test video studio', function () {
])
for (const server of servers) {
await checkDuration(server, 7)
await checkVideoDuration(server, videoUUID, 7)
}
})
@ -219,7 +205,7 @@ describe('Test video studio', function () {
])
for (const server of servers) {
await checkDuration(server, 10)
await checkVideoDuration(server, videoUUID, 10)
}
})
@ -237,7 +223,7 @@ describe('Test video studio', function () {
])
for (const server of servers) {
await checkDuration(server, 10)
await checkVideoDuration(server, videoUUID, 10)
}
})
})
@ -279,7 +265,7 @@ describe('Test video studio', function () {
await createTasks(VideoStudioCommand.getComplexTask())
for (const server of servers) {
await checkDuration(server, 9)
await checkVideoDuration(server, videoUUID, 9)
}
})
})
@ -309,7 +295,7 @@ describe('Test video studio', function () {
const video = await server.videos.get({ id: videoUUID })
expect(video.files).to.have.lengthOf(0)
await checkDuration(server, 9)
await checkVideoDuration(server, videoUUID, 9)
}
})
})
@ -351,7 +337,7 @@ describe('Test video studio', function () {
expectStartWith(hlsFile.fileUrl, ObjectStorageCommand.getMockPlaylistBaseUrl())
}
await checkDuration(server, 9)
await checkVideoDuration(server, videoUUID, 9)
}
})
})
@ -370,7 +356,7 @@ describe('Test video studio', function () {
await waitJobs(servers)
for (const server of servers) {
await checkDuration(server, 9)
await checkVideoDuration(server, videoUUID, 9)
}
})