let servers: PeerTubeServer[]
let sqlCommands: SQLCommand[] = []
+ const objectStorage = new ObjectStorageCommand()
let keptUrls: string[] = []
? `http://127.0.0.1:${port}`
: undefined
- await ObjectStorageCommand.createMockBucket(options.playlistBucket)
- await ObjectStorageCommand.createMockBucket(options.webtorrentBucket)
+ await objectStorage.createMockBucket(options.playlistBucket)
+ await objectStorage.createMockBucket(options.webtorrentBucket)
const config = {
object_storage: {
after(async function () {
await mockObjectStorageProxy.terminate()
+ await objectStorage.cleanupMock()
for (const sqlCommand of sqlCommands) {
await sqlCommand.cleanup()
describe('Object storage for videos', function () {
if (areMockObjectStorageTestsDisabled()) return
+ const objectStorage = new ObjectStorageCommand()
+
describe('Test config', function () {
let server: PeerTubeServer
- const baseConfig = {
- object_storage: {
- enabled: true,
- endpoint: 'http://' + ObjectStorageCommand.getMockEndpointHost(),
- region: ObjectStorageCommand.getMockRegion(),
-
- credentials: ObjectStorageCommand.getMockCredentialsConfig(),
-
- streaming_playlists: {
- bucket_name: ObjectStorageCommand.DEFAULT_PLAYLIST_MOCK_BUCKET
- },
-
- videos: {
- bucket_name: ObjectStorageCommand.DEFAULT_WEBTORRENT_MOCK_BUCKET
- }
- }
- }
+ const baseConfig = objectStorage.getDefaultMockConfig()
const badCredentials = {
access_key_id: 'AKIAIOSFODNN7EXAMPLE',
it('Should fail with bad credentials', async function () {
this.timeout(60000)
- await ObjectStorageCommand.prepareDefaultMockBuckets()
+ await objectStorage.prepareDefaultMockBuckets()
const config = merge({}, baseConfig, {
object_storage: {
it('Should succeed with credentials from env', async function () {
this.timeout(60000)
- await ObjectStorageCommand.prepareDefaultMockBuckets()
+ await objectStorage.prepareDefaultMockBuckets()
const config = merge({}, baseConfig, {
object_storage: {
await waitJobs([ server ], { skipDelayed: true })
const video = await server.videos.get({ id: uuid })
- expectStartWith(video.files[0].fileUrl, ObjectStorageCommand.getMockWebTorrentBaseUrl())
+ expectStartWith(video.files[0].fileUrl, objectStorage.getMockWebVideosBaseUrl())
})
after(async function () {
+ await objectStorage.cleanupMock()
+
await cleanupTests([ server ])
})
})
describe('Test simple object storage', function () {
runTestSuite({
- playlistBucket: 'streaming-playlists',
- webtorrentBucket: 'videos'
+ playlistBucket: objectStorage.getMockBucketName('streaming-playlists'),
+ webtorrentBucket: objectStorage.getMockBucketName('videos')
})
})
describe('Test object storage with prefix', function () {
runTestSuite({
- playlistBucket: 'mybucket',
- webtorrentBucket: 'mybucket',
+ playlistBucket: objectStorage.getMockBucketName('mybucket'),
+ webtorrentBucket: objectStorage.getMockBucketName('mybucket'),
playlistPrefix: 'streaming-playlists_',
webtorrentPrefix: 'webtorrent_'
describe('Test object storage with prefix and base URL', function () {
runTestSuite({
- playlistBucket: 'mybucket',
- webtorrentBucket: 'mybucket',
+ playlistBucket: objectStorage.getMockBucketName('mybucket'),
+ webtorrentBucket: objectStorage.getMockBucketName('mybucket'),
playlistPrefix: 'streaming-playlists/',
webtorrentPrefix: 'webtorrent/',
runTestSuite({
maxUploadPart,
- playlistBucket: 'streaming-playlists',
- webtorrentBucket: 'videos',
+ playlistBucket: objectStorage.getMockBucketName('streaming-playlists'),
+ webtorrentBucket: objectStorage.getMockBucketName('videos'),
fixture
})
})