expectLogDoesNotContain,
expectStartWith,
generateHighBitrateVideo,
- MockObjectStorage
+ MockObjectStorageProxy
} from '@server/tests/shared'
import { areMockObjectStorageTestsDisabled } from '@shared/core-utils'
import { HttpStatusCode, VideoDetails } from '@shared/models'
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++
}
}
useMockBaseUrl?: boolean
}) {
- const mockObjectStorage = new MockObjectStorage()
+ const mockObjectStorageProxy = new MockObjectStorageProxy()
const { fixture } = options
let baseMockUrl: string
before(async function () {
this.timeout(120000)
- const port = await mockObjectStorage.initialize()
- baseMockUrl = options.useMockBaseUrl ? `http://localhost:${port}` : undefined
+ const port = await mockObjectStorageProxy.initialize()
+ baseMockUrl = options.useMockBaseUrl
+ ? `http://127.0.0.1:${port}`
+ : undefined
await ObjectStorageCommand.createMockBucket(options.playlistBucket)
await ObjectStorageCommand.createMockBucket(options.webtorrentBucket)
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)
}
})
after(async function () {
- await mockObjectStorage.terminate()
+ await mockObjectStorageProxy.terminate()
await cleanupTests(servers)
})