diff options
Diffstat (limited to 'server/tests/cli/prune-storage.ts')
-rw-r--r-- | server/tests/cli/prune-storage.ts | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/server/tests/cli/prune-storage.ts b/server/tests/cli/prune-storage.ts index 00f63570f..72a4b1332 100644 --- a/server/tests/cli/prune-storage.ts +++ b/server/tests/cli/prune-storage.ts | |||
@@ -19,12 +19,6 @@ import { | |||
19 | waitJobs | 19 | waitJobs |
20 | } from '@shared/server-commands' | 20 | } from '@shared/server-commands' |
21 | 21 | ||
22 | async function countFiles (server: PeerTubeServer, directory: string) { | ||
23 | const files = await readdir(server.servers.buildDirectory(directory)) | ||
24 | |||
25 | return files.length | ||
26 | } | ||
27 | |||
28 | async function assertNotExists (server: PeerTubeServer, directory: string, substring: string) { | 22 | async function assertNotExists (server: PeerTubeServer, directory: string, substring: string) { |
29 | const files = await readdir(server.servers.buildDirectory(directory)) | 23 | const files = await readdir(server.servers.buildDirectory(directory)) |
30 | 24 | ||
@@ -35,28 +29,28 @@ async function assertNotExists (server: PeerTubeServer, directory: string, subst | |||
35 | 29 | ||
36 | async function assertCountAreOkay (servers: PeerTubeServer[]) { | 30 | async function assertCountAreOkay (servers: PeerTubeServer[]) { |
37 | for (const server of servers) { | 31 | for (const server of servers) { |
38 | const videosCount = await countFiles(server, 'web-videos') | 32 | const videosCount = await server.servers.countFiles('web-videos') |
39 | expect(videosCount).to.equal(9) // 2 videos with 4 resolutions + private directory | 33 | expect(videosCount).to.equal(9) // 2 videos with 4 resolutions + private directory |
40 | 34 | ||
41 | const privateVideosCount = await countFiles(server, 'web-videos/private') | 35 | const privateVideosCount = await server.servers.countFiles('web-videos/private') |
42 | expect(privateVideosCount).to.equal(4) | 36 | expect(privateVideosCount).to.equal(4) |
43 | 37 | ||
44 | const torrentsCount = await countFiles(server, 'torrents') | 38 | const torrentsCount = await server.servers.countFiles('torrents') |
45 | expect(torrentsCount).to.equal(24) | 39 | expect(torrentsCount).to.equal(24) |
46 | 40 | ||
47 | const previewsCount = await countFiles(server, 'previews') | 41 | const previewsCount = await server.servers.countFiles('previews') |
48 | expect(previewsCount).to.equal(3) | 42 | expect(previewsCount).to.equal(3) |
49 | 43 | ||
50 | const thumbnailsCount = await countFiles(server, 'thumbnails') | 44 | const thumbnailsCount = await server.servers.countFiles('thumbnails') |
51 | expect(thumbnailsCount).to.equal(5) // 3 local videos, 1 local playlist, 2 remotes videos (lazy downloaded) and 1 remote playlist | 45 | expect(thumbnailsCount).to.equal(5) // 3 local videos, 1 local playlist, 2 remotes videos (lazy downloaded) and 1 remote playlist |
52 | 46 | ||
53 | const avatarsCount = await countFiles(server, 'avatars') | 47 | const avatarsCount = await server.servers.countFiles('avatars') |
54 | expect(avatarsCount).to.equal(4) | 48 | expect(avatarsCount).to.equal(4) |
55 | 49 | ||
56 | const hlsRootCount = await countFiles(server, join('streaming-playlists', 'hls')) | 50 | const hlsRootCount = await server.servers.countFiles(join('streaming-playlists', 'hls')) |
57 | expect(hlsRootCount).to.equal(3) // 2 videos + private directory | 51 | expect(hlsRootCount).to.equal(3) // 2 videos + private directory |
58 | 52 | ||
59 | const hlsPrivateRootCount = await countFiles(server, join('streaming-playlists', 'hls', 'private')) | 53 | const hlsPrivateRootCount = await server.servers.countFiles(join('streaming-playlists', 'hls', 'private')) |
60 | expect(hlsPrivateRootCount).to.equal(1) | 54 | expect(hlsPrivateRootCount).to.equal(1) |
61 | } | 55 | } |
62 | } | 56 | } |