From 9ab330b90decf4edf152ff8e1d2948c065766b2c Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 19 Oct 2022 10:43:53 +0200 Subject: Use private ACL for private videos in s3 --- server/tests/cli/create-import-video-file-job.ts | 10 +++++----- server/tests/cli/create-move-video-storage-job.ts | 16 ++++++++-------- server/tests/cli/create-transcoding-job.ts | 12 ++++++------ 3 files changed, 19 insertions(+), 19 deletions(-) (limited to 'server/tests/cli') diff --git a/server/tests/cli/create-import-video-file-job.ts b/server/tests/cli/create-import-video-file-job.ts index a4aa5f699..43f53035b 100644 --- a/server/tests/cli/create-import-video-file-job.ts +++ b/server/tests/cli/create-import-video-file-job.ts @@ -1,7 +1,7 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import { expect } from 'chai' -import { areObjectStorageTestsDisabled } from '@shared/core-utils' +import { areMockObjectStorageTestsDisabled } from '@shared/core-utils' import { HttpStatusCode, VideoDetails, VideoFile, VideoInclude } from '@shared/models' import { cleanupTests, @@ -27,7 +27,7 @@ function assertVideoProperties (video: VideoFile, resolution: number, extname: s async function checkFiles (video: VideoDetails, objectStorage: boolean) { for (const file of video.files) { - if (objectStorage) expectStartWith(file.fileUrl, ObjectStorageCommand.getWebTorrentBaseUrl()) + if (objectStorage) expectStartWith(file.fileUrl, ObjectStorageCommand.getMockWebTorrentBaseUrl()) await makeRawRequest({ url: file.fileUrl, expectedStatus: HttpStatusCode.OK_200 }) } @@ -43,7 +43,7 @@ function runTests (objectStorage: boolean) { this.timeout(90000) const config = objectStorage - ? ObjectStorageCommand.getDefaultConfig() + ? ObjectStorageCommand.getDefaultMockConfig() : {} // Run server 2 to have transcoding enabled @@ -52,7 +52,7 @@ function runTests (objectStorage: boolean) { await doubleFollow(servers[0], servers[1]) - if (objectStorage) await ObjectStorageCommand.prepareDefaultBuckets() + if (objectStorage) await ObjectStorageCommand.prepareDefaultMockBuckets() // Upload two videos for our needs { @@ -157,7 +157,7 @@ describe('Test create import video jobs', function () { }) describe('On object storage', function () { - if (areObjectStorageTestsDisabled()) return + if (areMockObjectStorageTestsDisabled()) return runTests(true) }) diff --git a/server/tests/cli/create-move-video-storage-job.ts b/server/tests/cli/create-move-video-storage-job.ts index ecdd75b76..c357f501b 100644 --- a/server/tests/cli/create-move-video-storage-job.ts +++ b/server/tests/cli/create-move-video-storage-job.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import { areObjectStorageTestsDisabled } from '@shared/core-utils' +import { areMockObjectStorageTestsDisabled } from '@shared/core-utils' import { HttpStatusCode, VideoDetails } from '@shared/models' import { cleanupTests, @@ -17,7 +17,7 @@ import { expectStartWith } from '../shared' async function checkFiles (origin: PeerTubeServer, video: VideoDetails, inObjectStorage: boolean) { for (const file of video.files) { const start = inObjectStorage - ? ObjectStorageCommand.getWebTorrentBaseUrl() + ? ObjectStorageCommand.getMockWebTorrentBaseUrl() : origin.url expectStartWith(file.fileUrl, start) @@ -26,7 +26,7 @@ async function checkFiles (origin: PeerTubeServer, video: VideoDetails, inObject } const start = inObjectStorage - ? ObjectStorageCommand.getPlaylistBaseUrl() + ? ObjectStorageCommand.getMockPlaylistBaseUrl() : origin.url const hls = video.streamingPlaylists[0] @@ -41,7 +41,7 @@ async function checkFiles (origin: PeerTubeServer, video: VideoDetails, inObject } describe('Test create move video storage job', function () { - if (areObjectStorageTestsDisabled()) return + if (areMockObjectStorageTestsDisabled()) return let servers: PeerTubeServer[] = [] const uuids: string[] = [] @@ -55,7 +55,7 @@ describe('Test create move video storage job', function () { await doubleFollow(servers[0], servers[1]) - await ObjectStorageCommand.prepareDefaultBuckets() + await ObjectStorageCommand.prepareDefaultMockBuckets() await servers[0].config.enableTranscoding() @@ -67,14 +67,14 @@ describe('Test create move video storage job', function () { await waitJobs(servers) await servers[0].kill() - await servers[0].run(ObjectStorageCommand.getDefaultConfig()) + await servers[0].run(ObjectStorageCommand.getDefaultMockConfig()) }) it('Should move only one file', async function () { this.timeout(120000) const command = `npm run create-move-video-storage-job -- --to-object-storage -v ${uuids[1]}` - await servers[0].cli.execWithEnv(command, ObjectStorageCommand.getDefaultConfig()) + await servers[0].cli.execWithEnv(command, ObjectStorageCommand.getDefaultMockConfig()) await waitJobs(servers) for (const server of servers) { @@ -94,7 +94,7 @@ describe('Test create move video storage job', function () { this.timeout(120000) const command = `npm run create-move-video-storage-job -- --to-object-storage --all-videos` - await servers[0].cli.execWithEnv(command, ObjectStorageCommand.getDefaultConfig()) + await servers[0].cli.execWithEnv(command, ObjectStorageCommand.getDefaultMockConfig()) await waitJobs(servers) for (const server of servers) { diff --git a/server/tests/cli/create-transcoding-job.ts b/server/tests/cli/create-transcoding-job.ts index 51bf04a80..38b737829 100644 --- a/server/tests/cli/create-transcoding-job.ts +++ b/server/tests/cli/create-transcoding-job.ts @@ -1,7 +1,7 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import { expect } from 'chai' -import { areObjectStorageTestsDisabled } from '@shared/core-utils' +import { areMockObjectStorageTestsDisabled } from '@shared/core-utils' import { HttpStatusCode, VideoFile } from '@shared/models' import { cleanupTests, @@ -18,8 +18,8 @@ import { checkResolutionsInMasterPlaylist, expectStartWith } from '../shared' async function checkFilesInObjectStorage (files: VideoFile[], type: 'webtorrent' | 'playlist') { for (const file of files) { const shouldStartWith = type === 'webtorrent' - ? ObjectStorageCommand.getWebTorrentBaseUrl() - : ObjectStorageCommand.getPlaylistBaseUrl() + ? ObjectStorageCommand.getMockWebTorrentBaseUrl() + : ObjectStorageCommand.getMockPlaylistBaseUrl() expectStartWith(file.fileUrl, shouldStartWith) @@ -36,7 +36,7 @@ function runTests (objectStorage: boolean) { this.timeout(120000) const config = objectStorage - ? ObjectStorageCommand.getDefaultConfig() + ? ObjectStorageCommand.getDefaultMockConfig() : {} // Run server 2 to have transcoding enabled @@ -47,7 +47,7 @@ function runTests (objectStorage: boolean) { await doubleFollow(servers[0], servers[1]) - if (objectStorage) await ObjectStorageCommand.prepareDefaultBuckets() + if (objectStorage) await ObjectStorageCommand.prepareDefaultMockBuckets() for (let i = 1; i <= 5; i++) { const { uuid, shortUUID } = await servers[0].videos.upload({ attributes: { name: 'video' + i } }) @@ -255,7 +255,7 @@ describe('Test create transcoding jobs', function () { }) describe('On object storage', function () { - if (areObjectStorageTestsDisabled()) return + if (areMockObjectStorageTestsDisabled()) return runTests(true) }) -- cgit v1.2.3