diff options
author | Chocobozzz <me@florianbigard.com> | 2018-09-14 11:05:38 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-09-14 11:05:38 +0200 |
commit | 3f6b6a565dc98a658ec9d8f697252788c0faa46d (patch) | |
tree | 9549d3722b2d2d6501d85b4a56e6bfd3ea14fed3 /server/tests/api | |
parent | 780daa7e91336116a5163156f298c9ad875ec1e3 (diff) | |
download | PeerTube-3f6b6a565dc98a658ec9d8f697252788c0faa46d.tar.gz PeerTube-3f6b6a565dc98a658ec9d8f697252788c0faa46d.tar.zst PeerTube-3f6b6a565dc98a658ec9d8f697252788c0faa46d.zip |
Add recently added redundancy strategy
Diffstat (limited to 'server/tests/api')
-rw-r--r-- | server/tests/api/server/redundancy.ts | 63 |
1 files changed, 55 insertions, 8 deletions
diff --git a/server/tests/api/server/redundancy.ts b/server/tests/api/server/redundancy.ts index 211570d2f..6574e8ea9 100644 --- a/server/tests/api/server/redundancy.ts +++ b/server/tests/api/server/redundancy.ts | |||
@@ -14,7 +14,7 @@ import { | |||
14 | setAccessTokensToServers, | 14 | setAccessTokensToServers, |
15 | uploadVideo, | 15 | uploadVideo, |
16 | wait, | 16 | wait, |
17 | root, viewVideo | 17 | root, viewVideo, immutableAssign |
18 | } from '../../utils' | 18 | } from '../../utils' |
19 | import { waitJobs } from '../../utils/server/jobs' | 19 | import { waitJobs } from '../../utils/server/jobs' |
20 | import * as magnetUtil from 'magnet-uri' | 20 | import * as magnetUtil from 'magnet-uri' |
@@ -39,14 +39,14 @@ function checkMagnetWebseeds (file: { magnetUri: string, resolution: { id: numbe | |||
39 | } | 39 | } |
40 | } | 40 | } |
41 | 41 | ||
42 | async function runServers (strategy: VideoRedundancyStrategy) { | 42 | async function runServers (strategy: VideoRedundancyStrategy, additionalParams: any = {}) { |
43 | const config = { | 43 | const config = { |
44 | redundancy: { | 44 | redundancy: { |
45 | videos: [ | 45 | videos: [ |
46 | { | 46 | immutableAssign({ |
47 | strategy: strategy, | 47 | strategy: strategy, |
48 | size: '100KB' | 48 | size: '100KB' |
49 | } | 49 | }, additionalParams) |
50 | ] | 50 | ] |
51 | } | 51 | } |
52 | } | 52 | } |
@@ -153,11 +153,11 @@ describe('Test videos redundancy', function () { | |||
153 | return check1WebSeed() | 153 | return check1WebSeed() |
154 | }) | 154 | }) |
155 | 155 | ||
156 | it('Should enable redundancy on server 1', async function () { | 156 | it('Should enable redundancy on server 1', function () { |
157 | return enableRedundancy() | 157 | return enableRedundancy() |
158 | }) | 158 | }) |
159 | 159 | ||
160 | it('Should have 2 webseed on the first video', async function () { | 160 | it('Should have 2 webseed on the first video', function () { |
161 | this.timeout(40000) | 161 | this.timeout(40000) |
162 | 162 | ||
163 | return check2Webseeds() | 163 | return check2Webseeds() |
@@ -180,11 +180,58 @@ describe('Test videos redundancy', function () { | |||
180 | return check1WebSeed() | 180 | return check1WebSeed() |
181 | }) | 181 | }) |
182 | 182 | ||
183 | it('Should enable redundancy on server 1', async function () { | 183 | it('Should enable redundancy on server 1', function () { |
184 | return enableRedundancy() | 184 | return enableRedundancy() |
185 | }) | 185 | }) |
186 | 186 | ||
187 | it('Should have 2 webseed on the first video', async function () { | 187 | it('Should have 2 webseed on the first video', function () { |
188 | this.timeout(40000) | ||
189 | |||
190 | return check2Webseeds() | ||
191 | }) | ||
192 | |||
193 | after(function () { | ||
194 | return cleanServers() | ||
195 | }) | ||
196 | }) | ||
197 | |||
198 | describe('With recently added strategy', function () { | ||
199 | |||
200 | before(function () { | ||
201 | this.timeout(120000) | ||
202 | |||
203 | return runServers('recently-added', { minViews: 3 }) | ||
204 | }) | ||
205 | |||
206 | it('Should have 1 webseed on the first video', function () { | ||
207 | return check1WebSeed() | ||
208 | }) | ||
209 | |||
210 | it('Should enable redundancy on server 1', function () { | ||
211 | return enableRedundancy() | ||
212 | }) | ||
213 | |||
214 | it('Should still have 1 webseed on the first video', async function () { | ||
215 | this.timeout(40000) | ||
216 | |||
217 | await waitJobs(servers) | ||
218 | await wait(15000) | ||
219 | await waitJobs(servers) | ||
220 | |||
221 | return check1WebSeed() | ||
222 | }) | ||
223 | |||
224 | it('Should view 2 times the first video', async function () { | ||
225 | this.timeout(40000) | ||
226 | |||
227 | await viewVideo(servers[ 0 ].url, video1Server2UUID) | ||
228 | await viewVideo(servers[ 2 ].url, video1Server2UUID) | ||
229 | |||
230 | await wait(10000) | ||
231 | await waitJobs(servers) | ||
232 | }) | ||
233 | |||
234 | it('Should have 2 webseed on the first video', function () { | ||
188 | this.timeout(40000) | 235 | this.timeout(40000) |
189 | 236 | ||
190 | return check2Webseeds() | 237 | return check2Webseeds() |