aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/controllers/object-storage-proxy.ts1
-rw-r--r--server/tests/api/object-storage/videos.ts20
-rw-r--r--server/tests/api/videos/video-imports.ts8
3 files changed, 23 insertions, 6 deletions
diff --git a/server/controllers/object-storage-proxy.ts b/server/controllers/object-storage-proxy.ts
index 6bff05f14..c530b57f8 100644
--- a/server/controllers/object-storage-proxy.ts
+++ b/server/controllers/object-storage-proxy.ts
@@ -110,6 +110,7 @@ function handleObjectStorageFailure (res: express.Response, err: Error) {
110 110
111function setS3Headers (res: express.Response, s3Response: GetObjectCommandOutput) { 111function setS3Headers (res: express.Response, s3Response: GetObjectCommandOutput) {
112 if (s3Response.$metadata.httpStatusCode === HttpStatusCode.PARTIAL_CONTENT_206) { 112 if (s3Response.$metadata.httpStatusCode === HttpStatusCode.PARTIAL_CONTENT_206) {
113 res.setHeader('Content-Range', s3Response.ContentRange)
113 res.status(HttpStatusCode.PARTIAL_CONTENT_206) 114 res.status(HttpStatusCode.PARTIAL_CONTENT_206)
114 } 115 }
115} 116}
diff --git a/server/tests/api/object-storage/videos.ts b/server/tests/api/object-storage/videos.ts
index 6862658cc..6aaf32c34 100644
--- a/server/tests/api/object-storage/videos.ts
+++ b/server/tests/api/object-storage/videos.ts
@@ -26,8 +26,12 @@ import {
26 waitJobs, 26 waitJobs,
27 webtorrentAdd 27 webtorrentAdd
28} from '@shared/server-commands' 28} from '@shared/server-commands'
29import { sha1 } from '@shared/extra-utils'
29 30
30async function checkFiles (options: { 31async function checkFiles (options: {
32 server: PeerTubeServer
33 originServer: PeerTubeServer
34
31 video: VideoDetails 35 video: VideoDetails
32 36
33 baseMockUrl?: string 37 baseMockUrl?: string
@@ -39,6 +43,8 @@ async function checkFiles (options: {
39 webtorrentPrefix?: string 43 webtorrentPrefix?: string
40}) { 44}) {
41 const { 45 const {
46 server,
47 originServer,
42 video, 48 video,
43 playlistBucket, 49 playlistBucket,
44 webtorrentBucket, 50 webtorrentBucket,
@@ -86,6 +92,7 @@ async function checkFiles (options: {
86 const resSha = await makeRawRequest({ url: hls.segmentsSha256Url, expectedStatus: HttpStatusCode.OK_200 }) 92 const resSha = await makeRawRequest({ url: hls.segmentsSha256Url, expectedStatus: HttpStatusCode.OK_200 })
87 expect(JSON.stringify(resSha.body)).to.not.throw 93 expect(JSON.stringify(resSha.body)).to.not.throw
88 94
95 let i = 0
89 for (const file of hls.files) { 96 for (const file of hls.files) {
90 expectStartWith(file.fileUrl, start) 97 expectStartWith(file.fileUrl, start)
91 98
@@ -94,6 +101,15 @@ async function checkFiles (options: {
94 expectStartWith(location, start) 101 expectStartWith(location, start)
95 102
96 await makeRawRequest({ url: location, expectedStatus: HttpStatusCode.OK_200 }) 103 await makeRawRequest({ url: location, expectedStatus: HttpStatusCode.OK_200 })
104
105 if (originServer.internalServerNumber === server.internalServerNumber) {
106 const infohash = sha1(`${2 + hls.playlistUrl}+V${i}`)
107 const dbInfohashes = await originServer.sql.getPlaylistInfohash(hls.id)
108
109 expect(dbInfohashes).to.include(infohash)
110 }
111
112 i++
97 } 113 }
98 } 114 }
99 115
@@ -198,7 +214,7 @@ function runTestSuite (options: {
198 214
199 for (const server of servers) { 215 for (const server of servers) {
200 const video = await server.videos.get({ id: uuid }) 216 const video = await server.videos.get({ id: uuid })
201 const files = await checkFiles({ ...options, video, baseMockUrl }) 217 const files = await checkFiles({ ...options, server, originServer: servers[0], video, baseMockUrl })
202 218
203 deletedUrls = deletedUrls.concat(files) 219 deletedUrls = deletedUrls.concat(files)
204 } 220 }
@@ -214,7 +230,7 @@ function runTestSuite (options: {
214 230
215 for (const server of servers) { 231 for (const server of servers) {
216 const video = await server.videos.get({ id: uuid }) 232 const video = await server.videos.get({ id: uuid })
217 const files = await checkFiles({ ...options, video, baseMockUrl }) 233 const files = await checkFiles({ ...options, server, originServer: servers[0], video, baseMockUrl })
218 234
219 deletedUrls = deletedUrls.concat(files) 235 deletedUrls = deletedUrls.concat(files)
220 } 236 }
diff --git a/server/tests/api/videos/video-imports.ts b/server/tests/api/videos/video-imports.ts
index 80215f038..878452ed2 100644
--- a/server/tests/api/videos/video-imports.ts
+++ b/server/tests/api/videos/video-imports.ts
@@ -23,9 +23,8 @@ async function checkVideosServer1 (server: PeerTubeServer, idHttp: string, idMag
23 const videoHttp = await server.videos.get({ id: idHttp }) 23 const videoHttp = await server.videos.get({ id: idHttp })
24 24
25 expect(videoHttp.name).to.equal('small video - youtube') 25 expect(videoHttp.name).to.equal('small video - youtube')
26 // FIXME: youtube-dl seems broken 26 expect(videoHttp.category.label).to.equal('News & Politics')
27 // expect(videoHttp.category.label).to.equal('News & Politics') 27 expect(videoHttp.licence.label).to.equal('Attribution')
28 // expect(videoHttp.licence.label).to.equal('Attribution')
29 expect(videoHttp.language.label).to.equal('Unknown') 28 expect(videoHttp.language.label).to.equal('Unknown')
30 expect(videoHttp.nsfw).to.be.false 29 expect(videoHttp.nsfw).to.be.false
31 expect(videoHttp.description).to.equal('this is a super description') 30 expect(videoHttp.description).to.equal('this is a super description')
@@ -460,7 +459,8 @@ describe('Test video imports', function () {
460 }) 459 })
461 } 460 }
462 461
463 runSuite('youtube-dl') 462 // FIXME: youtube-dl seems broken
463 // runSuite('youtube-dl')
464 464
465 runSuite('yt-dlp') 465 runSuite('yt-dlp')
466 466