X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fapi%2Ftranscoding%2Fcreate-transcoding.ts;h=85389a9493150f7c0f021dc827e15377aff6c495;hb=2fe978744e5b74eb824e4d79c1bb9b840169f125;hp=b59bef77253d4070d27846276eb5f97ddcb539fe;hpb=1bb4c9ab2e8b3b3022351b33a82a5e527fa5d4d7;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/api/transcoding/create-transcoding.ts b/server/tests/api/transcoding/create-transcoding.ts index b59bef772..85389a949 100644 --- a/server/tests/api/transcoding/create-transcoding.ts +++ b/server/tests/api/transcoding/create-transcoding.ts @@ -1,9 +1,8 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import 'mocha' -import * as chai from 'chai' +import { expect } from 'chai' import { checkResolutionsInMasterPlaylist, expectStartWith } from '@server/tests/shared' -import { areObjectStorageTestsDisabled } from '@shared/core-utils' +import { areMockObjectStorageTestsDisabled } from '@shared/core-utils' import { HttpStatusCode, VideoDetails } from '@shared/models' import { cleanupTests, @@ -18,27 +17,25 @@ import { waitJobs } from '@shared/server-commands' -const expect = chai.expect - async function checkFilesInObjectStorage (video: VideoDetails) { for (const file of video.files) { - expectStartWith(file.fileUrl, ObjectStorageCommand.getWebTorrentBaseUrl()) - await makeRawRequest(file.fileUrl, HttpStatusCode.OK_200) + expectStartWith(file.fileUrl, ObjectStorageCommand.getMockWebTorrentBaseUrl()) + await makeRawRequest({ url: file.fileUrl, expectedStatus: HttpStatusCode.OK_200 }) } if (video.streamingPlaylists.length === 0) return const hlsPlaylist = video.streamingPlaylists[0] for (const file of hlsPlaylist.files) { - expectStartWith(file.fileUrl, ObjectStorageCommand.getPlaylistBaseUrl()) - await makeRawRequest(file.fileUrl, HttpStatusCode.OK_200) + expectStartWith(file.fileUrl, ObjectStorageCommand.getMockPlaylistBaseUrl()) + await makeRawRequest({ url: file.fileUrl, expectedStatus: HttpStatusCode.OK_200 }) } - expectStartWith(hlsPlaylist.playlistUrl, ObjectStorageCommand.getPlaylistBaseUrl()) - await makeRawRequest(hlsPlaylist.playlistUrl, HttpStatusCode.OK_200) + expectStartWith(hlsPlaylist.playlistUrl, ObjectStorageCommand.getMockPlaylistBaseUrl()) + await makeRawRequest({ url: hlsPlaylist.playlistUrl, expectedStatus: HttpStatusCode.OK_200 }) - expectStartWith(hlsPlaylist.segmentsSha256Url, ObjectStorageCommand.getPlaylistBaseUrl()) - await makeRawRequest(hlsPlaylist.segmentsSha256Url, HttpStatusCode.OK_200) + expectStartWith(hlsPlaylist.segmentsSha256Url, ObjectStorageCommand.getMockPlaylistBaseUrl()) + await makeRawRequest({ url: hlsPlaylist.segmentsSha256Url, expectedStatus: HttpStatusCode.OK_200 }) } function runTests (objectStorage: boolean) { @@ -52,7 +49,7 @@ function runTests (objectStorage: boolean) { this.timeout(120000) const config = objectStorage - ? ObjectStorageCommand.getDefaultConfig() + ? ObjectStorageCommand.getDefaultMockConfig() : {} // Run server 2 to have transcoding enabled @@ -63,7 +60,7 @@ function runTests (objectStorage: boolean) { await doubleFollow(servers[0], servers[1]) - if (objectStorage) await ObjectStorageCommand.prepareDefaultBuckets() + if (objectStorage) await ObjectStorageCommand.prepareDefaultMockBuckets() const { shortUUID } = await servers[0].videos.quickUpload({ name: 'video' }) videoUUID = shortUUID @@ -237,7 +234,7 @@ function runTests (objectStorage: boolean) { it('Should have correctly deleted previous files', async function () { for (const fileUrl of shouldBeDeleted) { - await makeRawRequest(fileUrl, HttpStatusCode.NOT_FOUND_404) + await makeRawRequest({ url: fileUrl, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) } }) @@ -259,7 +256,7 @@ describe('Test create transcoding jobs from API', function () { }) describe('On object storage', function () { - if (areObjectStorageTestsDisabled()) return + if (areMockObjectStorageTestsDisabled()) return runTests(true) })