aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/cli/create-move-video-storage-job.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/cli/create-move-video-storage-job.ts')
-rw-r--r--server/tests/cli/create-move-video-storage-job.ts25
1 files changed, 13 insertions, 12 deletions
diff --git a/server/tests/cli/create-move-video-storage-job.ts b/server/tests/cli/create-move-video-storage-job.ts
index 4927e0309..33a8cb9f9 100644
--- a/server/tests/cli/create-move-video-storage-job.ts
+++ b/server/tests/cli/create-move-video-storage-job.ts
@@ -15,10 +15,10 @@ import {
15} from '@shared/server-commands' 15} from '@shared/server-commands'
16import { checkDirectoryIsEmpty, expectStartWith } from '../shared' 16import { checkDirectoryIsEmpty, expectStartWith } from '../shared'
17 17
18async function checkFiles (origin: PeerTubeServer, video: VideoDetails, inObjectStorage: boolean) { 18async function checkFiles (origin: PeerTubeServer, video: VideoDetails, objectStorage?: ObjectStorageCommand) {
19 for (const file of video.files) { 19 for (const file of video.files) {
20 const start = inObjectStorage 20 const start = objectStorage
21 ? ObjectStorageCommand.getMockWebTorrentBaseUrl() 21 ? objectStorage.getMockWebVideosBaseUrl()
22 : origin.url 22 : origin.url
23 23
24 expectStartWith(file.fileUrl, start) 24 expectStartWith(file.fileUrl, start)
@@ -26,8 +26,8 @@ async function checkFiles (origin: PeerTubeServer, video: VideoDetails, inObject
26 await makeRawRequest({ url: file.fileUrl, expectedStatus: HttpStatusCode.OK_200 }) 26 await makeRawRequest({ url: file.fileUrl, expectedStatus: HttpStatusCode.OK_200 })
27 } 27 }
28 28
29 const start = inObjectStorage 29 const start = objectStorage
30 ? ObjectStorageCommand.getMockPlaylistBaseUrl() 30 ? objectStorage.getMockPlaylistBaseUrl()
31 : origin.url 31 : origin.url
32 32
33 const hls = video.streamingPlaylists[0] 33 const hls = video.streamingPlaylists[0]
@@ -46,6 +46,7 @@ describe('Test create move video storage job', function () {
46 46
47 let servers: PeerTubeServer[] = [] 47 let servers: PeerTubeServer[] = []
48 const uuids: string[] = [] 48 const uuids: string[] = []
49 const objectStorage = new ObjectStorageCommand()
49 50
50 before(async function () { 51 before(async function () {
51 this.timeout(360000) 52 this.timeout(360000)
@@ -56,7 +57,7 @@ describe('Test create move video storage job', function () {
56 57
57 await doubleFollow(servers[0], servers[1]) 58 await doubleFollow(servers[0], servers[1])
58 59
59 await ObjectStorageCommand.prepareDefaultMockBuckets() 60 await objectStorage.prepareDefaultMockBuckets()
60 61
61 await servers[0].config.enableTranscoding() 62 await servers[0].config.enableTranscoding()
62 63
@@ -68,25 +69,25 @@ describe('Test create move video storage job', function () {
68 await waitJobs(servers) 69 await waitJobs(servers)
69 70
70 await servers[0].kill() 71 await servers[0].kill()
71 await servers[0].run(ObjectStorageCommand.getDefaultMockConfig()) 72 await servers[0].run(objectStorage.getDefaultMockConfig())
72 }) 73 })
73 74
74 it('Should move only one file', async function () { 75 it('Should move only one file', async function () {
75 this.timeout(120000) 76 this.timeout(120000)
76 77
77 const command = `npm run create-move-video-storage-job -- --to-object-storage -v ${uuids[1]}` 78 const command = `npm run create-move-video-storage-job -- --to-object-storage -v ${uuids[1]}`
78 await servers[0].cli.execWithEnv(command, ObjectStorageCommand.getDefaultMockConfig()) 79 await servers[0].cli.execWithEnv(command, objectStorage.getDefaultMockConfig())
79 await waitJobs(servers) 80 await waitJobs(servers)
80 81
81 for (const server of servers) { 82 for (const server of servers) {
82 const video = await server.videos.get({ id: uuids[1] }) 83 const video = await server.videos.get({ id: uuids[1] })
83 84
84 await checkFiles(servers[0], video, true) 85 await checkFiles(servers[0], video, objectStorage)
85 86
86 for (const id of [ uuids[0], uuids[2] ]) { 87 for (const id of [ uuids[0], uuids[2] ]) {
87 const video = await server.videos.get({ id }) 88 const video = await server.videos.get({ id })
88 89
89 await checkFiles(servers[0], video, false) 90 await checkFiles(servers[0], video)
90 } 91 }
91 } 92 }
92 }) 93 })
@@ -95,14 +96,14 @@ describe('Test create move video storage job', function () {
95 this.timeout(120000) 96 this.timeout(120000)
96 97
97 const command = `npm run create-move-video-storage-job -- --to-object-storage --all-videos` 98 const command = `npm run create-move-video-storage-job -- --to-object-storage --all-videos`
98 await servers[0].cli.execWithEnv(command, ObjectStorageCommand.getDefaultMockConfig()) 99 await servers[0].cli.execWithEnv(command, objectStorage.getDefaultMockConfig())
99 await waitJobs(servers) 100 await waitJobs(servers)
100 101
101 for (const server of servers) { 102 for (const server of servers) {
102 for (const id of [ uuids[0], uuids[2] ]) { 103 for (const id of [ uuids[0], uuids[2] ]) {
103 const video = await server.videos.get({ id }) 104 const video = await server.videos.get({ id })
104 105
105 await checkFiles(servers[0], video, true) 106 await checkFiles(servers[0], video, objectStorage)
106 } 107 }
107 } 108 }
108 }) 109 })