aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/cli/prune-storage.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/cli/prune-storage.ts')
-rw-r--r--server/tests/cli/prune-storage.ts34
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
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { waitJobs } from '../../../shared/extra-utils/server/jobs' 5import { createFile, readdir } from 'fs-extra'
6import { join } from 'path'
7import { buildUUID } from '@server/helpers/uuid'
8import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
6import { 9import {
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'
27import { waitJobs } from '../../../shared/extra-utils/server/jobs'
23import { Account, VideoPlaylistPrivacy } from '../../../shared/models' 28import { Account, VideoPlaylistPrivacy } from '../../../shared/models'
24import { createFile, readdir } from 'fs-extra'
25import { v4 as uuidv4 } from 'uuid'
26import { join } from 'path'
27import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
28 29
29const expect = chai.expect 30const 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))