diff options
author | Chocobozzz <me@florianbigard.com> | 2022-05-09 11:49:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-09 11:49:25 +0200 |
commit | ca3d5912e16b39697bdeeda35d10b44ed8f711aa (patch) | |
tree | b7697f24d7587e6d031949e3925d9faff03e4537 /server/tests/api | |
parent | 644014cc55fcf61e611f2031b125304da086c039 (diff) | |
download | PeerTube-ca3d5912e16b39697bdeeda35d10b44ed8f711aa.tar.gz PeerTube-ca3d5912e16b39697bdeeda35d10b44ed8f711aa.tar.zst PeerTube-ca3d5912e16b39697bdeeda35d10b44ed8f711aa.zip |
Add use proxy for s3 (#4973)
* Fix object storage to be accessible via proxy
* fix lint
* Use hpagent
* Fix lint
* Fix PR
Co-authored-by: noellabo <noel.yoshiba@gmail.com>
Diffstat (limited to 'server/tests/api')
-rw-r--r-- | server/tests/api/server/proxy.ts | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/server/tests/api/server/proxy.ts b/server/tests/api/server/proxy.ts index 2a8ff56d2..e238edaf4 100644 --- a/server/tests/api/server/proxy.ts +++ b/server/tests/api/server/proxy.ts | |||
@@ -2,12 +2,14 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { FIXTURE_URLS, MockProxy } from '@server/tests/shared' | 5 | import { expectNotStartWith, expectStartWith, FIXTURE_URLS, MockProxy } from '@server/tests/shared' |
6 | import { areObjectStorageTestsDisabled } from '@shared/core-utils' | ||
6 | import { HttpStatusCode, VideoPrivacy } from '@shared/models' | 7 | import { HttpStatusCode, VideoPrivacy } from '@shared/models' |
7 | import { | 8 | import { |
8 | cleanupTests, | 9 | cleanupTests, |
9 | createMultipleServers, | 10 | createMultipleServers, |
10 | doubleFollow, | 11 | doubleFollow, |
12 | ObjectStorageCommand, | ||
11 | PeerTubeServer, | 13 | PeerTubeServer, |
12 | setAccessTokensToServers, | 14 | setAccessTokensToServers, |
13 | setDefaultVideoChannel, | 15 | setDefaultVideoChannel, |
@@ -120,6 +122,44 @@ describe('Test proxy', function () { | |||
120 | }) | 122 | }) |
121 | }) | 123 | }) |
122 | 124 | ||
125 | describe('Object storage', function () { | ||
126 | if (areObjectStorageTestsDisabled()) return | ||
127 | |||
128 | before(async function () { | ||
129 | this.timeout(30000) | ||
130 | |||
131 | await ObjectStorageCommand.prepareDefaultBuckets() | ||
132 | }) | ||
133 | |||
134 | it('Should succeed to upload to object storage with the appropriate proxy config', async function () { | ||
135 | this.timeout(120000) | ||
136 | |||
137 | await servers[0].kill() | ||
138 | await servers[0].run(ObjectStorageCommand.getDefaultConfig(), { env: goodEnv }) | ||
139 | |||
140 | const { uuid } = await servers[0].videos.quickUpload({ name: 'video' }) | ||
141 | await waitJobs(servers) | ||
142 | |||
143 | const video = await servers[0].videos.get({ id: uuid }) | ||
144 | |||
145 | expectStartWith(video.files[0].fileUrl, ObjectStorageCommand.getWebTorrentBaseUrl()) | ||
146 | }) | ||
147 | |||
148 | it('Should fail to upload to object storage with a wrong proxy config', async function () { | ||
149 | this.timeout(120000) | ||
150 | |||
151 | await servers[0].kill() | ||
152 | await servers[0].run(ObjectStorageCommand.getDefaultConfig(), { env: badEnv }) | ||
153 | |||
154 | const { uuid } = await servers[0].videos.quickUpload({ name: 'video' }) | ||
155 | await waitJobs(servers) | ||
156 | |||
157 | const video = await servers[0].videos.get({ id: uuid }) | ||
158 | |||
159 | expectNotStartWith(video.files[0].fileUrl, ObjectStorageCommand.getWebTorrentBaseUrl()) | ||
160 | }) | ||
161 | }) | ||
162 | |||
123 | after(async function () { | 163 | after(async function () { |
124 | await proxy.terminate() | 164 | await proxy.terminate() |
125 | 165 | ||