aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/shared/videos.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/shared/videos.ts')
-rw-r--r--server/tests/shared/videos.ts23
1 files changed, 12 insertions, 11 deletions
diff --git a/server/tests/shared/videos.ts b/server/tests/shared/videos.ts
index 856fabd11..e09bd60b5 100644
--- a/server/tests/shared/videos.ts
+++ b/server/tests/shared/videos.ts
@@ -7,7 +7,7 @@ import { loadLanguages, VIDEO_CATEGORIES, VIDEO_LANGUAGES, VIDEO_LICENCES, VIDEO
7import { getLowercaseExtension, pick, uuidRegex } from '@shared/core-utils' 7import { getLowercaseExtension, pick, uuidRegex } from '@shared/core-utils'
8import { HttpStatusCode, VideoCaption, VideoDetails, VideoPrivacy, VideoResolution } from '@shared/models' 8import { HttpStatusCode, VideoCaption, VideoDetails, VideoPrivacy, VideoResolution } from '@shared/models'
9import { makeRawRequest, PeerTubeServer, VideoEdit, waitJobs } from '@shared/server-commands' 9import { makeRawRequest, PeerTubeServer, VideoEdit, waitJobs } from '@shared/server-commands'
10import { dateIsValid, expectStartWith, testImage } from './checks' 10import { dateIsValid, expectStartWith, testImageGeneratedByFFmpeg } from './checks'
11import { checkWebTorrentWorks } from './webtorrent' 11import { checkWebTorrentWorks } from './webtorrent'
12 12
13loadLanguages() 13loadLanguages()
@@ -28,7 +28,7 @@ async function completeWebVideoFilesCheck (options: {
28 const serverConfig = await originServer.config.getConfig() 28 const serverConfig = await originServer.config.getConfig()
29 const requiresAuth = video.privacy.id === VideoPrivacy.PRIVATE || video.privacy.id === VideoPrivacy.INTERNAL 29 const requiresAuth = video.privacy.id === VideoPrivacy.PRIVATE || video.privacy.id === VideoPrivacy.INTERNAL
30 30
31 const transcodingEnabled = serverConfig.transcoding.webtorrent.enabled 31 const transcodingEnabled = serverConfig.transcoding.web_videos.enabled
32 32
33 for (const attributeFile of files) { 33 for (const attributeFile of files) {
34 const file = video.files.find(f => f.resolution.id === attributeFile.resolution) 34 const file = video.files.find(f => f.resolution.id === attributeFile.resolution)
@@ -51,11 +51,12 @@ async function completeWebVideoFilesCheck (options: {
51 expect(file.torrentUrl).to.match(new RegExp(`${server.url}/lazy-static/torrents/${nameReg}.torrent`)) 51 expect(file.torrentUrl).to.match(new RegExp(`${server.url}/lazy-static/torrents/${nameReg}.torrent`))
52 52
53 if (objectStorageBaseUrl && requiresAuth) { 53 if (objectStorageBaseUrl && requiresAuth) {
54 expect(file.fileUrl).to.match(new RegExp(`${originServer.url}/object-storage-proxy/webseed/${privatePath}${nameReg}${extension}`)) 54 const regexp = new RegExp(`${originServer.url}/object-storage-proxy/web-videos/${privatePath}${nameReg}${extension}`)
55 expect(file.fileUrl).to.match(regexp)
55 } else if (objectStorageBaseUrl) { 56 } else if (objectStorageBaseUrl) {
56 expectStartWith(file.fileUrl, objectStorageBaseUrl) 57 expectStartWith(file.fileUrl, objectStorageBaseUrl)
57 } else { 58 } else {
58 expect(file.fileUrl).to.match(new RegExp(`${originServer.url}/static/webseed/${privatePath}${nameReg}${extension}`)) 59 expect(file.fileUrl).to.match(new RegExp(`${originServer.url}/static/web-videos/${privatePath}${nameReg}${extension}`))
59 } 60 }
60 61
61 expect(file.fileDownloadUrl).to.match(new RegExp(`${originServer.url}/download/videos/${nameReg}${extension}`)) 62 expect(file.fileDownloadUrl).to.match(new RegExp(`${originServer.url}/download/videos/${nameReg}${extension}`))
@@ -197,11 +198,11 @@ async function completeVideoCheck (options: {
197 expect(video.downloadEnabled).to.equal(attributes.downloadEnabled) 198 expect(video.downloadEnabled).to.equal(attributes.downloadEnabled)
198 199
199 expect(video.thumbnailPath).to.exist 200 expect(video.thumbnailPath).to.exist
200 await testImage(server.url, attributes.thumbnailfile || attributes.fixture, video.thumbnailPath) 201 await testImageGeneratedByFFmpeg(server.url, attributes.thumbnailfile || attributes.fixture, video.thumbnailPath)
201 202
202 if (attributes.previewfile) { 203 if (attributes.previewfile) {
203 expect(video.previewPath).to.exist 204 expect(video.previewPath).to.exist
204 await testImage(server.url, attributes.previewfile, video.previewPath) 205 await testImageGeneratedByFFmpeg(server.url, attributes.previewfile, video.previewPath)
205 } 206 }
206 207
207 await completeWebVideoFilesCheck({ server, originServer, videoUUID: video.uuid, ...pick(attributes, [ 'fixture', 'files' ]) }) 208 await completeWebVideoFilesCheck({ server, originServer, videoUUID: video.uuid, ...pick(attributes, [ 'fixture', 'files' ]) })
@@ -215,22 +216,22 @@ async function checkVideoFilesWereRemoved (options: {
215}) { 216}) {
216 const { video, server, captions = [], onlyVideoFiles = false } = options 217 const { video, server, captions = [], onlyVideoFiles = false } = options
217 218
218 const webtorrentFiles = video.files || [] 219 const webVideoFiles = video.files || []
219 const hlsFiles = video.streamingPlaylists[0]?.files || [] 220 const hlsFiles = video.streamingPlaylists[0]?.files || []
220 221
221 const thumbnailName = basename(video.thumbnailPath) 222 const thumbnailName = basename(video.thumbnailPath)
222 const previewName = basename(video.previewPath) 223 const previewName = basename(video.previewPath)
223 224
224 const torrentNames = webtorrentFiles.concat(hlsFiles).map(f => basename(f.torrentUrl)) 225 const torrentNames = webVideoFiles.concat(hlsFiles).map(f => basename(f.torrentUrl))
225 226
226 const captionNames = captions.map(c => basename(c.captionPath)) 227 const captionNames = captions.map(c => basename(c.captionPath))
227 228
228 const webtorrentFilenames = webtorrentFiles.map(f => basename(f.fileUrl)) 229 const webVideoFilenames = webVideoFiles.map(f => basename(f.fileUrl))
229 const hlsFilenames = hlsFiles.map(f => basename(f.fileUrl)) 230 const hlsFilenames = hlsFiles.map(f => basename(f.fileUrl))
230 231
231 let directories: { [ directory: string ]: string[] } = { 232 let directories: { [ directory: string ]: string[] } = {
232 videos: webtorrentFilenames, 233 videos: webVideoFilenames,
233 redundancy: webtorrentFilenames, 234 redundancy: webVideoFilenames,
234 [join('playlists', 'hls')]: hlsFilenames, 235 [join('playlists', 'hls')]: hlsFilenames,
235 [join('redundancy', 'hls')]: hlsFilenames 236 [join('redundancy', 'hls')]: hlsFilenames
236 } 237 }