waitJobs,
webtorrentAdd
} from '@shared/server-commands'
+import { sha1 } from '@shared/extra-utils'
async function checkFiles (options: {
+ server: PeerTubeServer
+ originServer: PeerTubeServer
+
video: VideoDetails
baseMockUrl?: string
webtorrentPrefix?: string
}) {
const {
+ server,
+ originServer,
video,
playlistBucket,
webtorrentBucket,
const resSha = await makeRawRequest({ url: hls.segmentsSha256Url, expectedStatus: HttpStatusCode.OK_200 })
expect(JSON.stringify(resSha.body)).to.not.throw
+ let i = 0
for (const file of hls.files) {
expectStartWith(file.fileUrl, start)
expectStartWith(location, start)
await makeRawRequest({ url: location, expectedStatus: HttpStatusCode.OK_200 })
+
+ if (originServer.internalServerNumber === server.internalServerNumber) {
+ const infohash = sha1(`${2 + hls.playlistUrl}+V${i}`)
+ const dbInfohashes = await originServer.sql.getPlaylistInfohash(hls.id)
+
+ expect(dbInfohashes).to.include(infohash)
+ }
+
+ i++
}
}
for (const server of servers) {
const video = await server.videos.get({ id: uuid })
- const files = await checkFiles({ ...options, video, baseMockUrl })
+ const files = await checkFiles({ ...options, server, originServer: servers[0], video, baseMockUrl })
deletedUrls = deletedUrls.concat(files)
}
for (const server of servers) {
const video = await server.videos.get({ id: uuid })
- const files = await checkFiles({ ...options, video, baseMockUrl })
+ const files = await checkFiles({ ...options, server, originServer: servers[0], video, baseMockUrl })
deletedUrls = deletedUrls.concat(files)
}