diff options
author | Chocobozzz <me@florianbigard.com> | 2018-10-03 16:43:57 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-10-03 16:43:57 +0200 |
commit | 25378bc866a69002d7447e5edc254ec7e469a1ec (patch) | |
tree | fd12d97cb571de83b1281554baba9c28606eaab9 /server/tests | |
parent | be691a57c590348fd36d6e11dc1fe4cc8eaa0719 (diff) | |
download | PeerTube-25378bc866a69002d7447e5edc254ec7e469a1ec.tar.gz PeerTube-25378bc866a69002d7447e5edc254ec7e469a1ec.tar.zst PeerTube-25378bc866a69002d7447e5edc254ec7e469a1ec.zip |
Delete correctly redundancy files
Diffstat (limited to 'server/tests')
-rw-r--r-- | server/tests/api/server/redundancy.ts | 19 | ||||
-rw-r--r-- | server/tests/utils/videos/videos.ts | 8 |
2 files changed, 24 insertions, 3 deletions
diff --git a/server/tests/api/server/redundancy.ts b/server/tests/api/server/redundancy.ts index d60319657..1960854b6 100644 --- a/server/tests/api/server/redundancy.ts +++ b/server/tests/api/server/redundancy.ts | |||
@@ -16,7 +16,8 @@ import { | |||
16 | uploadVideo, | 16 | uploadVideo, |
17 | viewVideo, | 17 | viewVideo, |
18 | wait, | 18 | wait, |
19 | waitUntilLog | 19 | waitUntilLog, |
20 | checkVideoFilesWereRemoved, removeVideo | ||
20 | } from '../../utils' | 21 | } from '../../utils' |
21 | import { waitJobs } from '../../utils/server/jobs' | 22 | import { waitJobs } from '../../utils/server/jobs' |
22 | import * as magnetUtil from 'magnet-uri' | 23 | import * as magnetUtil from 'magnet-uri' |
@@ -242,6 +243,8 @@ describe('Test videos redundancy', function () { | |||
242 | await wait(5000) | 243 | await wait(5000) |
243 | 244 | ||
244 | await check1WebSeed(strategy) | 245 | await check1WebSeed(strategy) |
246 | |||
247 | await checkVideoFilesWereRemoved(video1Server2UUID, servers[0].serverNumber, [ 'videos' ]) | ||
245 | }) | 248 | }) |
246 | 249 | ||
247 | after(function () { | 250 | after(function () { |
@@ -287,6 +290,8 @@ describe('Test videos redundancy', function () { | |||
287 | await wait(5000) | 290 | await wait(5000) |
288 | 291 | ||
289 | await check1WebSeed(strategy) | 292 | await check1WebSeed(strategy) |
293 | |||
294 | await checkVideoFilesWereRemoved(video1Server2UUID, servers[0].serverNumber, [ 'videos' ]) | ||
290 | }) | 295 | }) |
291 | 296 | ||
292 | after(function () { | 297 | after(function () { |
@@ -344,6 +349,18 @@ describe('Test videos redundancy', function () { | |||
344 | await checkStatsWith2Webseed(strategy) | 349 | await checkStatsWith2Webseed(strategy) |
345 | }) | 350 | }) |
346 | 351 | ||
352 | it('Should remove the video and the redundancy files', async function () { | ||
353 | this.timeout(20000) | ||
354 | |||
355 | await removeVideo(servers[1].url, servers[1].accessToken, video1Server2UUID) | ||
356 | |||
357 | await waitJobs(servers) | ||
358 | |||
359 | for (const server of servers) { | ||
360 | await checkVideoFilesWereRemoved(video1Server2UUID, server.serverNumber) | ||
361 | } | ||
362 | }) | ||
363 | |||
347 | after(function () { | 364 | after(function () { |
348 | return cleanServers() | 365 | return cleanServers() |
349 | }) | 366 | }) |
diff --git a/server/tests/utils/videos/videos.ts b/server/tests/utils/videos/videos.ts index 7eee25402..87c385f38 100644 --- a/server/tests/utils/videos/videos.ts +++ b/server/tests/utils/videos/videos.ts | |||
@@ -267,10 +267,14 @@ function removeVideo (url: string, token: string, id: number | string, expectedS | |||
267 | .expect(expectedStatus) | 267 | .expect(expectedStatus) |
268 | } | 268 | } |
269 | 269 | ||
270 | async function checkVideoFilesWereRemoved (videoUUID: string, serverNumber: number) { | 270 | async function checkVideoFilesWereRemoved ( |
271 | videoUUID: string, | ||
272 | serverNumber: number, | ||
273 | directories = [ 'videos', 'thumbnails', 'torrents', 'previews', 'captions' ] | ||
274 | ) { | ||
271 | const testDirectory = 'test' + serverNumber | 275 | const testDirectory = 'test' + serverNumber |
272 | 276 | ||
273 | for (const directory of [ 'videos', 'thumbnails', 'torrents', 'previews', 'captions' ]) { | 277 | for (const directory of directories) { |
274 | const directoryPath = join(root(), testDirectory, directory) | 278 | const directoryPath = join(root(), testDirectory, directory) |
275 | 279 | ||
276 | const directoryExists = existsSync(directoryPath) | 280 | const directoryExists = existsSync(directoryPath) |