diff options
Diffstat (limited to 'server/tests/api/redundancy/redundancy.ts')
-rw-r--r-- | server/tests/api/redundancy/redundancy.ts | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/server/tests/api/redundancy/redundancy.ts b/server/tests/api/redundancy/redundancy.ts index a8a2f305f..9d3ce8153 100644 --- a/server/tests/api/redundancy/redundancy.ts +++ b/server/tests/api/redundancy/redundancy.ts | |||
@@ -18,15 +18,16 @@ import { | |||
18 | wait, | 18 | wait, |
19 | waitUntilLog, | 19 | waitUntilLog, |
20 | checkVideoFilesWereRemoved, removeVideo, getVideoWithToken | 20 | checkVideoFilesWereRemoved, removeVideo, getVideoWithToken |
21 | } from '../../utils' | 21 | } from '../../../../shared/utils' |
22 | import { waitJobs } from '../../utils/server/jobs' | 22 | import { waitJobs } from '../../../../shared/utils/server/jobs' |
23 | |||
23 | import * as magnetUtil from 'magnet-uri' | 24 | import * as magnetUtil from 'magnet-uri' |
24 | import { updateRedundancy } from '../../utils/server/redundancy' | 25 | import { updateRedundancy } from '../../../../shared/utils/server/redundancy' |
25 | import { ActorFollow } from '../../../../shared/models/actors' | 26 | import { ActorFollow } from '../../../../shared/models/actors' |
26 | import { readdir } from 'fs-extra' | 27 | import { readdir } from 'fs-extra' |
27 | import { join } from 'path' | 28 | import { join } from 'path' |
28 | import { VideoRedundancyStrategy } from '../../../../shared/models/redundancy' | 29 | import { VideoRedundancyStrategy } from '../../../../shared/models/redundancy' |
29 | import { getStats } from '../../utils/server/stats' | 30 | import { getStats } from '../../../../shared/utils/server/stats' |
30 | import { ServerStats } from '../../../../shared/models/server/server-stats.model' | 31 | import { ServerStats } from '../../../../shared/models/server/server-stats.model' |
31 | 32 | ||
32 | const expect = chai.expect | 33 | const expect = chai.expect |
@@ -136,7 +137,7 @@ async function check2Webseeds (strategy: VideoRedundancyStrategy, videoUUID?: st | |||
136 | if (!videoUUID) videoUUID = video1Server2UUID | 137 | if (!videoUUID) videoUUID = video1Server2UUID |
137 | 138 | ||
138 | const webseeds = [ | 139 | const webseeds = [ |
139 | 'http://localhost:9001/static/webseed/' + videoUUID, | 140 | 'http://localhost:9001/static/redundancy/' + videoUUID, |
140 | 'http://localhost:9002/static/webseed/' + videoUUID | 141 | 'http://localhost:9002/static/webseed/' + videoUUID |
141 | ] | 142 | ] |
142 | 143 | ||
@@ -148,20 +149,23 @@ async function check2Webseeds (strategy: VideoRedundancyStrategy, videoUUID?: st | |||
148 | for (const file of video.files) { | 149 | for (const file of video.files) { |
149 | checkMagnetWebseeds(file, webseeds, server) | 150 | checkMagnetWebseeds(file, webseeds, server) |
150 | 151 | ||
151 | // Only servers 1 and 2 have the video | 152 | await makeGetRequest({ |
152 | if (server.serverNumber !== 3) { | 153 | url: servers[0].url, |
153 | await makeGetRequest({ | 154 | statusCodeExpected: 200, |
154 | url: server.url, | 155 | path: '/static/redundancy/' + `${videoUUID}-${file.resolution.id}.mp4`, |
155 | statusCodeExpected: 200, | 156 | contentType: null |
156 | path: '/static/webseed/' + `${videoUUID}-${file.resolution.id}.mp4`, | 157 | }) |
157 | contentType: null | 158 | await makeGetRequest({ |
158 | }) | 159 | url: servers[1].url, |
159 | } | 160 | statusCodeExpected: 200, |
161 | path: '/static/webseed/' + `${videoUUID}-${file.resolution.id}.mp4`, | ||
162 | contentType: null | ||
163 | }) | ||
160 | } | 164 | } |
161 | } | 165 | } |
162 | 166 | ||
163 | for (const directory of [ 'test1', 'test2' ]) { | 167 | for (const directory of [ 'test1/redundancy', 'test2/videos' ]) { |
164 | const files = await readdir(join(root(), directory, 'videos')) | 168 | const files = await readdir(join(root(), directory)) |
165 | expect(files).to.have.length.at.least(4) | 169 | expect(files).to.have.length.at.least(4) |
166 | 170 | ||
167 | for (const resolution of [ 240, 360, 480, 720 ]) { | 171 | for (const resolution of [ 240, 360, 480, 720 ]) { |