2021-08-17 08:26:20 +02:00
|
|
|
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
|
|
|
|
|
2022-04-19 15:22:18 +02:00
|
|
|
import bytes from 'bytes'
|
2022-08-17 15:44:32 +02:00
|
|
|
import { expect } from 'chai'
|
2022-04-19 15:22:18 +02:00
|
|
|
import { stat } from 'fs-extra'
|
2021-08-17 08:26:20 +02:00
|
|
|
import { merge } from 'lodash'
|
2022-04-19 15:22:18 +02:00
|
|
|
import {
|
|
|
|
checkTmpIsEmpty,
|
2023-04-21 15:00:01 +02:00
|
|
|
checkWebTorrentWorks,
|
2022-04-19 15:22:18 +02:00
|
|
|
expectLogDoesNotContain,
|
|
|
|
expectStartWith,
|
|
|
|
generateHighBitrateVideo,
|
2023-04-21 15:00:01 +02:00
|
|
|
MockObjectStorageProxy,
|
|
|
|
SQLCommand
|
2022-04-19 15:22:18 +02:00
|
|
|
} from '@server/tests/shared'
|
2022-10-19 10:43:53 +02:00
|
|
|
import { areMockObjectStorageTestsDisabled } from '@shared/core-utils'
|
2023-04-21 15:00:01 +02:00
|
|
|
import { sha1 } from '@shared/extra-utils'
|
2021-12-17 11:58:15 +01:00
|
|
|
import { HttpStatusCode, VideoDetails } from '@shared/models'
|
2021-08-17 08:26:20 +02:00
|
|
|
import {
|
|
|
|
cleanupTests,
|
|
|
|
createMultipleServers,
|
|
|
|
createSingleServer,
|
|
|
|
doubleFollow,
|
|
|
|
killallServers,
|
|
|
|
makeRawRequest,
|
|
|
|
ObjectStorageCommand,
|
|
|
|
PeerTubeServer,
|
|
|
|
setAccessTokensToServers,
|
2023-04-21 15:00:01 +02:00
|
|
|
waitJobs
|
2021-12-17 09:29:23 +01:00
|
|
|
} from '@shared/server-commands'
|
2021-08-17 08:26:20 +02:00
|
|
|
|
|
|
|
async function checkFiles (options: {
|
2023-03-20 08:57:01 +01:00
|
|
|
server: PeerTubeServer
|
|
|
|
originServer: PeerTubeServer
|
2023-04-21 15:00:01 +02:00
|
|
|
originSQLCommand: SQLCommand
|
2023-03-20 08:57:01 +01:00
|
|
|
|
2021-08-17 08:26:20 +02:00
|
|
|
video: VideoDetails
|
|
|
|
|
|
|
|
baseMockUrl?: string
|
|
|
|
|
|
|
|
playlistBucket: string
|
|
|
|
playlistPrefix?: string
|
|
|
|
|
|
|
|
webtorrentBucket: string
|
|
|
|
webtorrentPrefix?: string
|
|
|
|
}) {
|
|
|
|
const {
|
2023-03-20 08:57:01 +01:00
|
|
|
server,
|
|
|
|
originServer,
|
2023-04-21 15:00:01 +02:00
|
|
|
originSQLCommand,
|
2021-08-17 08:26:20 +02:00
|
|
|
video,
|
|
|
|
playlistBucket,
|
|
|
|
webtorrentBucket,
|
|
|
|
baseMockUrl,
|
|
|
|
playlistPrefix,
|
|
|
|
webtorrentPrefix
|
|
|
|
} = options
|
|
|
|
|
|
|
|
let allFiles = video.files
|
|
|
|
|
|
|
|
for (const file of video.files) {
|
|
|
|
const baseUrl = baseMockUrl
|
|
|
|
? `${baseMockUrl}/${webtorrentBucket}/`
|
2022-10-19 10:43:53 +02:00
|
|
|
: `http://${webtorrentBucket}.${ObjectStorageCommand.getMockEndpointHost()}/`
|
2021-08-17 08:26:20 +02:00
|
|
|
|
|
|
|
const prefix = webtorrentPrefix || ''
|
|
|
|
const start = baseUrl + prefix
|
|
|
|
|
|
|
|
expectStartWith(file.fileUrl, start)
|
|
|
|
|
2022-10-12 16:09:02 +02:00
|
|
|
const res = await makeRawRequest({ url: file.fileDownloadUrl, expectedStatus: HttpStatusCode.FOUND_302 })
|
2021-08-17 08:26:20 +02:00
|
|
|
const location = res.headers['location']
|
|
|
|
expectStartWith(location, start)
|
|
|
|
|
2022-10-12 16:09:02 +02:00
|
|
|
await makeRawRequest({ url: location, expectedStatus: HttpStatusCode.OK_200 })
|
2021-08-17 08:26:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
const hls = video.streamingPlaylists[0]
|
|
|
|
|
|
|
|
if (hls) {
|
|
|
|
allFiles = allFiles.concat(hls.files)
|
|
|
|
|
|
|
|
const baseUrl = baseMockUrl
|
|
|
|
? `${baseMockUrl}/${playlistBucket}/`
|
2022-10-19 10:43:53 +02:00
|
|
|
: `http://${playlistBucket}.${ObjectStorageCommand.getMockEndpointHost()}/`
|
2021-08-17 08:26:20 +02:00
|
|
|
|
|
|
|
const prefix = playlistPrefix || ''
|
|
|
|
const start = baseUrl + prefix
|
|
|
|
|
|
|
|
expectStartWith(hls.playlistUrl, start)
|
|
|
|
expectStartWith(hls.segmentsSha256Url, start)
|
|
|
|
|
2022-10-12 16:09:02 +02:00
|
|
|
await makeRawRequest({ url: hls.playlistUrl, expectedStatus: HttpStatusCode.OK_200 })
|
2021-08-17 08:26:20 +02:00
|
|
|
|
2022-10-12 16:09:02 +02:00
|
|
|
const resSha = await makeRawRequest({ url: hls.segmentsSha256Url, expectedStatus: HttpStatusCode.OK_200 })
|
2021-08-17 08:26:20 +02:00
|
|
|
expect(JSON.stringify(resSha.body)).to.not.throw
|
|
|
|
|
2023-03-20 08:57:01 +01:00
|
|
|
let i = 0
|
2021-08-17 08:26:20 +02:00
|
|
|
for (const file of hls.files) {
|
|
|
|
expectStartWith(file.fileUrl, start)
|
|
|
|
|
2022-10-12 16:09:02 +02:00
|
|
|
const res = await makeRawRequest({ url: file.fileDownloadUrl, expectedStatus: HttpStatusCode.FOUND_302 })
|
2021-08-17 08:26:20 +02:00
|
|
|
const location = res.headers['location']
|
|
|
|
expectStartWith(location, start)
|
|
|
|
|
2022-10-12 16:09:02 +02:00
|
|
|
await makeRawRequest({ url: location, expectedStatus: HttpStatusCode.OK_200 })
|
2023-03-20 08:57:01 +01:00
|
|
|
|
|
|
|
if (originServer.internalServerNumber === server.internalServerNumber) {
|
|
|
|
const infohash = sha1(`${2 + hls.playlistUrl}+V${i}`)
|
2023-04-21 15:00:01 +02:00
|
|
|
const dbInfohashes = await originSQLCommand.getPlaylistInfohash(hls.id)
|
2023-03-20 08:57:01 +01:00
|
|
|
|
|
|
|
expect(dbInfohashes).to.include(infohash)
|
|
|
|
}
|
|
|
|
|
|
|
|
i++
|
2021-08-17 08:26:20 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (const file of allFiles) {
|
2023-04-21 15:00:01 +02:00
|
|
|
await checkWebTorrentWorks(file.magnetUri)
|
2021-08-17 08:26:20 +02:00
|
|
|
|
2022-10-12 16:09:02 +02:00
|
|
|
const res = await makeRawRequest({ url: file.fileUrl, expectedStatus: HttpStatusCode.OK_200 })
|
2021-08-17 08:26:20 +02:00
|
|
|
expect(res.body).to.have.length.above(100)
|
|
|
|
}
|
|
|
|
|
|
|
|
return allFiles.map(f => f.fileUrl)
|
|
|
|
}
|
|
|
|
|
|
|
|
function runTestSuite (options: {
|
2022-04-19 15:22:18 +02:00
|
|
|
fixture?: string
|
|
|
|
|
|
|
|
maxUploadPart?: string
|
|
|
|
|
2021-08-17 08:26:20 +02:00
|
|
|
playlistBucket: string
|
|
|
|
playlistPrefix?: string
|
|
|
|
|
|
|
|
webtorrentBucket: string
|
|
|
|
webtorrentPrefix?: string
|
|
|
|
|
|
|
|
useMockBaseUrl?: boolean
|
|
|
|
}) {
|
2023-01-27 08:30:56 +01:00
|
|
|
const mockObjectStorageProxy = new MockObjectStorageProxy()
|
2022-04-19 15:22:18 +02:00
|
|
|
const { fixture } = options
|
2021-08-17 08:26:20 +02:00
|
|
|
let baseMockUrl: string
|
|
|
|
|
|
|
|
let servers: PeerTubeServer[]
|
2023-05-10 16:23:55 +02:00
|
|
|
let sqlCommands: SQLCommand[] = []
|
2023-05-23 10:49:45 +02:00
|
|
|
const objectStorage = new ObjectStorageCommand()
|
2021-08-17 08:26:20 +02:00
|
|
|
|
|
|
|
let keptUrls: string[] = []
|
|
|
|
|
|
|
|
const uuidsToDelete: string[] = []
|
|
|
|
let deletedUrls: string[] = []
|
|
|
|
|
|
|
|
before(async function () {
|
2023-05-15 15:06:14 +02:00
|
|
|
this.timeout(240000)
|
2021-08-17 08:26:20 +02:00
|
|
|
|
2023-01-27 08:30:56 +01:00
|
|
|
const port = await mockObjectStorageProxy.initialize()
|
|
|
|
baseMockUrl = options.useMockBaseUrl
|
|
|
|
? `http://127.0.0.1:${port}`
|
|
|
|
: undefined
|
2021-08-17 08:26:20 +02:00
|
|
|
|
2023-05-23 10:49:45 +02:00
|
|
|
await objectStorage.createMockBucket(options.playlistBucket)
|
|
|
|
await objectStorage.createMockBucket(options.webtorrentBucket)
|
2021-08-17 08:26:20 +02:00
|
|
|
|
|
|
|
const config = {
|
|
|
|
object_storage: {
|
|
|
|
enabled: true,
|
2022-10-19 10:43:53 +02:00
|
|
|
endpoint: 'http://' + ObjectStorageCommand.getMockEndpointHost(),
|
|
|
|
region: ObjectStorageCommand.getMockRegion(),
|
2021-08-17 08:26:20 +02:00
|
|
|
|
2022-10-19 10:43:53 +02:00
|
|
|
credentials: ObjectStorageCommand.getMockCredentialsConfig(),
|
2021-08-17 08:26:20 +02:00
|
|
|
|
2022-04-19 15:22:18 +02:00
|
|
|
max_upload_part: options.maxUploadPart || '5MB',
|
2021-08-17 08:26:20 +02:00
|
|
|
|
|
|
|
streaming_playlists: {
|
|
|
|
bucket_name: options.playlistBucket,
|
|
|
|
prefix: options.playlistPrefix,
|
|
|
|
base_url: baseMockUrl
|
|
|
|
? `${baseMockUrl}/${options.playlistBucket}`
|
|
|
|
: undefined
|
|
|
|
},
|
|
|
|
|
|
|
|
videos: {
|
|
|
|
bucket_name: options.webtorrentBucket,
|
|
|
|
prefix: options.webtorrentPrefix,
|
|
|
|
base_url: baseMockUrl
|
|
|
|
? `${baseMockUrl}/${options.webtorrentBucket}`
|
|
|
|
: undefined
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
servers = await createMultipleServers(2, config)
|
|
|
|
|
|
|
|
await setAccessTokensToServers(servers)
|
|
|
|
await doubleFollow(servers[0], servers[1])
|
|
|
|
|
|
|
|
for (const server of servers) {
|
|
|
|
const { uuid } = await server.videos.quickUpload({ name: 'video to keep' })
|
|
|
|
await waitJobs(servers)
|
|
|
|
|
|
|
|
const files = await server.videos.listFiles({ id: uuid })
|
|
|
|
keptUrls = keptUrls.concat(files.map(f => f.fileUrl))
|
|
|
|
}
|
2023-04-21 15:00:01 +02:00
|
|
|
|
|
|
|
sqlCommands = servers.map(s => new SQLCommand(s))
|
2021-08-17 08:26:20 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
it('Should upload a video and move it to the object storage without transcoding', async function () {
|
2021-10-22 14:31:38 +02:00
|
|
|
this.timeout(40000)
|
2021-08-17 08:26:20 +02:00
|
|
|
|
2022-04-19 15:22:18 +02:00
|
|
|
const { uuid } = await servers[0].videos.quickUpload({ name: 'video 1', fixture })
|
2021-08-17 08:26:20 +02:00
|
|
|
uuidsToDelete.push(uuid)
|
|
|
|
|
|
|
|
await waitJobs(servers)
|
|
|
|
|
|
|
|
for (const server of servers) {
|
|
|
|
const video = await server.videos.get({ id: uuid })
|
2023-04-21 15:00:01 +02:00
|
|
|
const files = await checkFiles({ ...options, server, originServer: servers[0], originSQLCommand: sqlCommands[0], video, baseMockUrl })
|
2021-08-17 08:26:20 +02:00
|
|
|
|
|
|
|
deletedUrls = deletedUrls.concat(files)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Should upload a video and move it to the object storage with transcoding', async function () {
|
2021-10-15 08:23:02 +02:00
|
|
|
this.timeout(120000)
|
2021-08-17 08:26:20 +02:00
|
|
|
|
2022-04-19 15:22:18 +02:00
|
|
|
const { uuid } = await servers[1].videos.quickUpload({ name: 'video 2', fixture })
|
2021-08-17 08:26:20 +02:00
|
|
|
uuidsToDelete.push(uuid)
|
|
|
|
|
|
|
|
await waitJobs(servers)
|
|
|
|
|
|
|
|
for (const server of servers) {
|
|
|
|
const video = await server.videos.get({ id: uuid })
|
2023-04-21 15:00:01 +02:00
|
|
|
const files = await checkFiles({ ...options, server, originServer: servers[0], originSQLCommand: sqlCommands[0], video, baseMockUrl })
|
2021-08-17 08:26:20 +02:00
|
|
|
|
|
|
|
deletedUrls = deletedUrls.concat(files)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2021-10-12 15:36:44 +02:00
|
|
|
it('Should fetch correctly all the files', async function () {
|
|
|
|
for (const url of deletedUrls.concat(keptUrls)) {
|
2022-10-12 16:09:02 +02:00
|
|
|
await makeRawRequest({ url, expectedStatus: HttpStatusCode.OK_200 })
|
2021-10-12 15:36:44 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2021-08-17 08:26:20 +02:00
|
|
|
it('Should correctly delete the files', async function () {
|
|
|
|
await servers[0].videos.remove({ id: uuidsToDelete[0] })
|
|
|
|
await servers[1].videos.remove({ id: uuidsToDelete[1] })
|
|
|
|
|
|
|
|
await waitJobs(servers)
|
|
|
|
|
|
|
|
for (const url of deletedUrls) {
|
2022-10-12 16:09:02 +02:00
|
|
|
await makeRawRequest({ url, expectedStatus: HttpStatusCode.NOT_FOUND_404 })
|
2021-08-17 08:26:20 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Should have kept other files', async function () {
|
|
|
|
for (const url of keptUrls) {
|
2022-10-12 16:09:02 +02:00
|
|
|
await makeRawRequest({ url, expectedStatus: HttpStatusCode.OK_200 })
|
2021-08-17 08:26:20 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Should have an empty tmp directory', async function () {
|
|
|
|
for (const server of servers) {
|
|
|
|
await checkTmpIsEmpty(server)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2021-08-18 09:14:51 +02:00
|
|
|
it('Should not have downloaded files from object storage', async function () {
|
|
|
|
for (const server of servers) {
|
|
|
|
await expectLogDoesNotContain(server, 'from object storage')
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2021-08-17 08:26:20 +02:00
|
|
|
after(async function () {
|
2023-01-27 08:30:56 +01:00
|
|
|
await mockObjectStorageProxy.terminate()
|
2023-05-23 10:49:45 +02:00
|
|
|
await objectStorage.cleanupMock()
|
2021-08-17 08:26:20 +02:00
|
|
|
|
2023-04-21 15:00:01 +02:00
|
|
|
for (const sqlCommand of sqlCommands) {
|
|
|
|
await sqlCommand.cleanup()
|
|
|
|
}
|
|
|
|
|
2021-08-17 08:26:20 +02:00
|
|
|
await cleanupTests(servers)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
describe('Object storage for videos', function () {
|
2022-10-19 10:43:53 +02:00
|
|
|
if (areMockObjectStorageTestsDisabled()) return
|
2021-08-17 08:26:20 +02:00
|
|
|
|
2023-05-23 10:49:45 +02:00
|
|
|
const objectStorage = new ObjectStorageCommand()
|
|
|
|
|
2021-08-17 08:26:20 +02:00
|
|
|
describe('Test config', function () {
|
|
|
|
let server: PeerTubeServer
|
|
|
|
|
2023-05-23 10:49:45 +02:00
|
|
|
const baseConfig = objectStorage.getDefaultMockConfig()
|
2021-08-17 08:26:20 +02:00
|
|
|
|
|
|
|
const badCredentials = {
|
|
|
|
access_key_id: 'AKIAIOSFODNN7EXAMPLE',
|
|
|
|
secret_access_key: 'aJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY'
|
|
|
|
}
|
|
|
|
|
|
|
|
it('Should fail with same bucket names without prefix', function (done) {
|
|
|
|
const config = merge({}, baseConfig, {
|
|
|
|
object_storage: {
|
|
|
|
streaming_playlists: {
|
|
|
|
bucket_name: 'aaa'
|
|
|
|
},
|
|
|
|
|
|
|
|
videos: {
|
|
|
|
bucket_name: 'aaa'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
createSingleServer(1, config)
|
|
|
|
.then(() => done(new Error('Did not throw')))
|
|
|
|
.catch(() => done())
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Should fail with bad credentials', async function () {
|
|
|
|
this.timeout(60000)
|
|
|
|
|
2023-05-23 10:49:45 +02:00
|
|
|
await objectStorage.prepareDefaultMockBuckets()
|
2021-08-17 08:26:20 +02:00
|
|
|
|
|
|
|
const config = merge({}, baseConfig, {
|
|
|
|
object_storage: {
|
|
|
|
credentials: badCredentials
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
server = await createSingleServer(1, config)
|
|
|
|
await setAccessTokensToServers([ server ])
|
|
|
|
|
|
|
|
const { uuid } = await server.videos.quickUpload({ name: 'video' })
|
|
|
|
|
2022-10-25 15:01:51 +02:00
|
|
|
await waitJobs([ server ], { skipDelayed: true })
|
2021-08-17 08:26:20 +02:00
|
|
|
const video = await server.videos.get({ id: uuid })
|
|
|
|
|
|
|
|
expectStartWith(video.files[0].fileUrl, server.url)
|
|
|
|
|
|
|
|
await killallServers([ server ])
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Should succeed with credentials from env', async function () {
|
|
|
|
this.timeout(60000)
|
|
|
|
|
2023-05-23 10:49:45 +02:00
|
|
|
await objectStorage.prepareDefaultMockBuckets()
|
2021-08-17 08:26:20 +02:00
|
|
|
|
|
|
|
const config = merge({}, baseConfig, {
|
|
|
|
object_storage: {
|
|
|
|
credentials: {
|
|
|
|
access_key_id: '',
|
|
|
|
secret_access_key: ''
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2022-10-19 10:43:53 +02:00
|
|
|
const goodCredentials = ObjectStorageCommand.getMockCredentialsConfig()
|
2021-08-17 08:26:20 +02:00
|
|
|
|
|
|
|
server = await createSingleServer(1, config, {
|
|
|
|
env: {
|
|
|
|
AWS_ACCESS_KEY_ID: goodCredentials.access_key_id,
|
|
|
|
AWS_SECRET_ACCESS_KEY: goodCredentials.secret_access_key
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
await setAccessTokensToServers([ server ])
|
|
|
|
|
|
|
|
const { uuid } = await server.videos.quickUpload({ name: 'video' })
|
|
|
|
|
2022-10-25 15:01:51 +02:00
|
|
|
await waitJobs([ server ], { skipDelayed: true })
|
2021-08-17 08:26:20 +02:00
|
|
|
const video = await server.videos.get({ id: uuid })
|
|
|
|
|
2023-05-23 10:49:45 +02:00
|
|
|
expectStartWith(video.files[0].fileUrl, objectStorage.getMockWebVideosBaseUrl())
|
2021-08-17 08:26:20 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
after(async function () {
|
2023-05-23 10:49:45 +02:00
|
|
|
await objectStorage.cleanupMock()
|
|
|
|
|
2023-05-10 13:57:06 +02:00
|
|
|
await cleanupTests([ server ])
|
2021-08-17 08:26:20 +02:00
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
describe('Test simple object storage', function () {
|
|
|
|
runTestSuite({
|
2023-05-23 10:49:45 +02:00
|
|
|
playlistBucket: objectStorage.getMockBucketName('streaming-playlists'),
|
|
|
|
webtorrentBucket: objectStorage.getMockBucketName('videos')
|
2021-08-17 08:26:20 +02:00
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
describe('Test object storage with prefix', function () {
|
|
|
|
runTestSuite({
|
2023-05-23 10:49:45 +02:00
|
|
|
playlistBucket: objectStorage.getMockBucketName('mybucket'),
|
|
|
|
webtorrentBucket: objectStorage.getMockBucketName('mybucket'),
|
2021-08-17 08:26:20 +02:00
|
|
|
|
|
|
|
playlistPrefix: 'streaming-playlists_',
|
|
|
|
webtorrentPrefix: 'webtorrent_'
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
describe('Test object storage with prefix and base URL', function () {
|
|
|
|
runTestSuite({
|
2023-05-23 10:49:45 +02:00
|
|
|
playlistBucket: objectStorage.getMockBucketName('mybucket'),
|
|
|
|
webtorrentBucket: objectStorage.getMockBucketName('mybucket'),
|
2021-08-17 08:26:20 +02:00
|
|
|
|
2021-09-06 08:13:11 +02:00
|
|
|
playlistPrefix: 'streaming-playlists/',
|
|
|
|
webtorrentPrefix: 'webtorrent/',
|
2021-08-17 08:26:20 +02:00
|
|
|
|
|
|
|
useMockBaseUrl: true
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2022-04-19 15:22:18 +02:00
|
|
|
describe('Test object storage with file bigger than upload part', function () {
|
|
|
|
let fixture: string
|
|
|
|
const maxUploadPart = '5MB'
|
|
|
|
|
|
|
|
before(async function () {
|
2022-05-18 15:16:34 +02:00
|
|
|
this.timeout(120000)
|
|
|
|
|
2022-04-19 15:22:18 +02:00
|
|
|
fixture = await generateHighBitrateVideo()
|
|
|
|
|
|
|
|
const { size } = await stat(fixture)
|
|
|
|
|
|
|
|
if (bytes.parse(maxUploadPart) > size) {
|
|
|
|
throw Error(`Fixture file is too small (${size}) to make sense for this test.`)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2021-08-17 08:26:20 +02:00
|
|
|
runTestSuite({
|
2022-04-19 15:22:18 +02:00
|
|
|
maxUploadPart,
|
2023-05-23 10:49:45 +02:00
|
|
|
playlistBucket: objectStorage.getMockBucketName('streaming-playlists'),
|
|
|
|
webtorrentBucket: objectStorage.getMockBucketName('videos'),
|
2022-04-19 15:22:18 +02:00
|
|
|
fixture
|
2021-08-17 08:26:20 +02:00
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|