X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fapi%2Fserver%2Fproxy.ts;h=4bf89410eb831f9280bfcb8a0c06428df73ae44a;hb=7b97127e8ba718d673b8a43afa964d136723e6a2;hp=e238edaf42c3a5e62238113a20a04a9ddb1db7e8;hpb=ca3d5912e16b39697bdeeda35d10b44ed8f711aa;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/api/server/proxy.ts b/server/tests/api/server/proxy.ts index e238edaf4..4bf89410e 100644 --- a/server/tests/api/server/proxy.ts +++ b/server/tests/api/server/proxy.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 { expectNotStartWith, expectStartWith, FIXTURE_URLS, MockProxy } from '@server/tests/shared' -import { areObjectStorageTestsDisabled } from '@shared/core-utils' +import { areMockObjectStorageTestsDisabled } from '@shared/core-utils' import { HttpStatusCode, VideoPrivacy } from '@shared/models' import { cleanupTests, @@ -16,14 +15,12 @@ import { waitJobs } from '@shared/server-commands' -const expect = chai.expect - describe('Test proxy', function () { let servers: PeerTubeServer[] = [] let proxy: MockProxy const goodEnv = { HTTP_PROXY: '' } - const badEnv = { HTTP_PROXY: 'http://localhost:9000' } + const badEnv = { HTTP_PROXY: 'http://127.0.0.1:9000' } before(async function () { this.timeout(120000) @@ -33,7 +30,7 @@ describe('Test proxy', function () { const proxyPort = await proxy.initialize() servers = await createMultipleServers(2) - goodEnv.HTTP_PROXY = 'http://localhost:' + proxyPort + goodEnv.HTTP_PROXY = 'http://127.0.0.1:' + proxyPort await setAccessTokensToServers(servers) await setDefaultVideoChannel(servers) @@ -98,7 +95,7 @@ describe('Test proxy', function () { } it('Should succeed import with the appropriate proxy config', async function () { - this.timeout(120000) + this.timeout(240000) await servers[0].kill() await servers[0].run({}, { env: goodEnv }) @@ -123,40 +120,40 @@ describe('Test proxy', function () { }) describe('Object storage', function () { - if (areObjectStorageTestsDisabled()) return + if (areMockObjectStorageTestsDisabled()) return before(async function () { this.timeout(30000) - await ObjectStorageCommand.prepareDefaultBuckets() + await ObjectStorageCommand.prepareDefaultMockBuckets() }) it('Should succeed to upload to object storage with the appropriate proxy config', async function () { this.timeout(120000) await servers[0].kill() - await servers[0].run(ObjectStorageCommand.getDefaultConfig(), { env: goodEnv }) + await servers[0].run(ObjectStorageCommand.getDefaultMockConfig(), { env: goodEnv }) const { uuid } = await servers[0].videos.quickUpload({ name: 'video' }) await waitJobs(servers) const video = await servers[0].videos.get({ id: uuid }) - expectStartWith(video.files[0].fileUrl, ObjectStorageCommand.getWebTorrentBaseUrl()) + expectStartWith(video.files[0].fileUrl, ObjectStorageCommand.getMockWebTorrentBaseUrl()) }) it('Should fail to upload to object storage with a wrong proxy config', async function () { this.timeout(120000) await servers[0].kill() - await servers[0].run(ObjectStorageCommand.getDefaultConfig(), { env: badEnv }) + await servers[0].run(ObjectStorageCommand.getDefaultMockConfig(), { env: badEnv }) const { uuid } = await servers[0].videos.quickUpload({ name: 'video' }) - await waitJobs(servers) + await waitJobs(servers, { skipDelayed: true }) const video = await servers[0].videos.get({ id: uuid }) - expectNotStartWith(video.files[0].fileUrl, ObjectStorageCommand.getWebTorrentBaseUrl()) + expectNotStartWith(video.files[0].fileUrl, ObjectStorageCommand.getMockWebTorrentBaseUrl()) }) })