aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-03-20 08:57:01 +0100
committerChocobozzz <me@florianbigard.com>2023-03-20 08:57:01 +0100
commit1c41b5c1ac798a06fbc0e7a2c6b91c5542865780 (patch)
treea9b2622e0341977ddee80781be7f1fdbc44cebd2 /server/tests
parentc32985769eb06c92fd4c2cbd9d7861d808f1a7b5 (diff)
downloadPeerTube-1c41b5c1ac798a06fbc0e7a2c6b91c5542865780.tar.gz
PeerTube-1c41b5c1ac798a06fbc0e7a2c6b91c5542865780.tar.zst
PeerTube-1c41b5c1ac798a06fbc0e7a2c6b91c5542865780.zip
Add infohash test for VOD
Diffstat (limited to 'server/tests')
-rw-r--r--server/tests/api/object-storage/videos.ts20
1 files changed, 18 insertions, 2 deletions
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 }