diff options
Diffstat (limited to 'server/tests/cli/prune-storage.ts')
-rw-r--r-- | server/tests/cli/prune-storage.ts | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/server/tests/cli/prune-storage.ts b/server/tests/cli/prune-storage.ts index 591ed217f..a0af09de8 100644 --- a/server/tests/cli/prune-storage.ts +++ b/server/tests/cli/prune-storage.ts | |||
@@ -2,7 +2,10 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { waitJobs } from '../../../shared/extra-utils/server/jobs' | 5 | import { createFile, readdir } from 'fs-extra' |
6 | import { join } from 'path' | ||
7 | import { buildUUID } from '@server/helpers/uuid' | ||
8 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' | ||
6 | import { | 9 | import { |
7 | buildServerDirectory, | 10 | buildServerDirectory, |
8 | cleanupTests, | 11 | cleanupTests, |
@@ -12,6 +15,7 @@ import { | |||
12 | flushAndRunMultipleServers, | 15 | flushAndRunMultipleServers, |
13 | getAccount, | 16 | getAccount, |
14 | getEnvCli, | 17 | getEnvCli, |
18 | killallServers, | ||
15 | makeGetRequest, | 19 | makeGetRequest, |
16 | ServerInfo, | 20 | ServerInfo, |
17 | setAccessTokensToServers, | 21 | setAccessTokensToServers, |
@@ -20,11 +24,8 @@ import { | |||
20 | uploadVideo, | 24 | uploadVideo, |
21 | wait | 25 | wait |
22 | } from '../../../shared/extra-utils' | 26 | } from '../../../shared/extra-utils' |
27 | import { waitJobs } from '../../../shared/extra-utils/server/jobs' | ||
23 | import { Account, VideoPlaylistPrivacy } from '../../../shared/models' | 28 | import { Account, VideoPlaylistPrivacy } from '../../../shared/models' |
24 | import { createFile, readdir } from 'fs-extra' | ||
25 | import { v4 as uuidv4 } from 'uuid' | ||
26 | import { join } from 'path' | ||
27 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' | ||
28 | 29 | ||
29 | const expect = chai.expect | 30 | const expect = chai.expect |
30 | 31 | ||
@@ -116,6 +117,9 @@ describe('Test prune storage scripts', function () { | |||
116 | await wait(1000) | 117 | await wait(1000) |
117 | 118 | ||
118 | await waitJobs(servers) | 119 | await waitJobs(servers) |
120 | killallServers(servers) | ||
121 | |||
122 | await wait(1000) | ||
119 | }) | 123 | }) |
120 | 124 | ||
121 | it('Should have the files on the disk', async function () { | 125 | it('Should have the files on the disk', async function () { |
@@ -127,8 +131,8 @@ describe('Test prune storage scripts', function () { | |||
127 | { | 131 | { |
128 | const base = buildServerDirectory(servers[0], 'videos') | 132 | const base = buildServerDirectory(servers[0], 'videos') |
129 | 133 | ||
130 | const n1 = uuidv4() + '.mp4' | 134 | const n1 = buildUUID() + '.mp4' |
131 | const n2 = uuidv4() + '.webm' | 135 | const n2 = buildUUID() + '.webm' |
132 | 136 | ||
133 | await createFile(join(base, n1)) | 137 | await createFile(join(base, n1)) |
134 | await createFile(join(base, n2)) | 138 | await createFile(join(base, n2)) |
@@ -139,8 +143,8 @@ describe('Test prune storage scripts', function () { | |||
139 | { | 143 | { |
140 | const base = buildServerDirectory(servers[0], 'torrents') | 144 | const base = buildServerDirectory(servers[0], 'torrents') |
141 | 145 | ||
142 | const n1 = uuidv4() + '-240.torrent' | 146 | const n1 = buildUUID() + '-240.torrent' |
143 | const n2 = uuidv4() + '-480.torrent' | 147 | const n2 = buildUUID() + '-480.torrent' |
144 | 148 | ||
145 | await createFile(join(base, n1)) | 149 | await createFile(join(base, n1)) |
146 | await createFile(join(base, n2)) | 150 | await createFile(join(base, n2)) |
@@ -151,8 +155,8 @@ describe('Test prune storage scripts', function () { | |||
151 | { | 155 | { |
152 | const base = buildServerDirectory(servers[0], 'thumbnails') | 156 | const base = buildServerDirectory(servers[0], 'thumbnails') |
153 | 157 | ||
154 | const n1 = uuidv4() + '.jpg' | 158 | const n1 = buildUUID() + '.jpg' |
155 | const n2 = uuidv4() + '.jpg' | 159 | const n2 = buildUUID() + '.jpg' |
156 | 160 | ||
157 | await createFile(join(base, n1)) | 161 | await createFile(join(base, n1)) |
158 | await createFile(join(base, n2)) | 162 | await createFile(join(base, n2)) |
@@ -163,8 +167,8 @@ describe('Test prune storage scripts', function () { | |||
163 | { | 167 | { |
164 | const base = buildServerDirectory(servers[0], 'previews') | 168 | const base = buildServerDirectory(servers[0], 'previews') |
165 | 169 | ||
166 | const n1 = uuidv4() + '.jpg' | 170 | const n1 = buildUUID() + '.jpg' |
167 | const n2 = uuidv4() + '.jpg' | 171 | const n2 = buildUUID() + '.jpg' |
168 | 172 | ||
169 | await createFile(join(base, n1)) | 173 | await createFile(join(base, n1)) |
170 | await createFile(join(base, n2)) | 174 | await createFile(join(base, n2)) |
@@ -175,8 +179,8 @@ describe('Test prune storage scripts', function () { | |||
175 | { | 179 | { |
176 | const base = buildServerDirectory(servers[0], 'avatars') | 180 | const base = buildServerDirectory(servers[0], 'avatars') |
177 | 181 | ||
178 | const n1 = uuidv4() + '.png' | 182 | const n1 = buildUUID() + '.png' |
179 | const n2 = uuidv4() + '.jpg' | 183 | const n2 = buildUUID() + '.jpg' |
180 | 184 | ||
181 | await createFile(join(base, n1)) | 185 | await createFile(join(base, n1)) |
182 | await createFile(join(base, n2)) | 186 | await createFile(join(base, n2)) |