aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/cli
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-08-17 11:06:10 +0200
committerChocobozzz <me@florianbigard.com>2021-08-17 11:06:10 +0200
commitc186a67f90203af6bfa434f026efdc99193bcd65 (patch)
tree54e715f1afba3aaa14d6448fdbc14d699b7ae775 /server/tests/cli
parent66a7fc947321b923fa1e7182202e03d0e21ffb3e (diff)
downloadPeerTube-c186a67f90203af6bfa434f026efdc99193bcd65.tar.gz
PeerTube-c186a67f90203af6bfa434f026efdc99193bcd65.tar.zst
PeerTube-c186a67f90203af6bfa434f026efdc99193bcd65.zip
Support short uuid for scripts
Diffstat (limited to 'server/tests/cli')
-rw-r--r--server/tests/cli/create-import-video-file-job.ts16
-rw-r--r--server/tests/cli/create-transcoding-job.ts11
2 files changed, 16 insertions, 11 deletions
diff --git a/server/tests/cli/create-import-video-file-job.ts b/server/tests/cli/create-import-video-file-job.ts
index 9f1b57a2e..01817216e 100644
--- a/server/tests/cli/create-import-video-file-job.ts
+++ b/server/tests/cli/create-import-video-file-job.ts
@@ -37,7 +37,7 @@ async function checkFiles (video: VideoDetails, objectStorage: boolean) {
37} 37}
38 38
39function runTests (objectStorage: boolean) { 39function runTests (objectStorage: boolean) {
40 let video1UUID: string 40 let video1ShortId: string
41 let video2UUID: string 41 let video2UUID: string
42 42
43 let servers: PeerTubeServer[] = [] 43 let servers: PeerTubeServer[] = []
@@ -59,8 +59,8 @@ function runTests (objectStorage: boolean) {
59 59
60 // Upload two videos for our needs 60 // Upload two videos for our needs
61 { 61 {
62 const { uuid } = await servers[0].videos.upload({ attributes: { name: 'video1' } }) 62 const { shortUUID } = await servers[0].videos.upload({ attributes: { name: 'video1' } })
63 video1UUID = uuid 63 video1ShortId = shortUUID
64 } 64 }
65 65
66 { 66 {
@@ -72,7 +72,7 @@ function runTests (objectStorage: boolean) {
72 }) 72 })
73 73
74 it('Should run a import job on video 1 with a lower resolution', async function () { 74 it('Should run a import job on video 1 with a lower resolution', async function () {
75 const command = `npm run create-import-video-file-job -- -v ${video1UUID} -i server/tests/fixtures/video_short-480.webm` 75 const command = `npm run create-import-video-file-job -- -v ${video1ShortId} -i server/tests/fixtures/video_short-480.webm`
76 await servers[0].cli.execWithEnv(command) 76 await servers[0].cli.execWithEnv(command)
77 77
78 await waitJobs(servers) 78 await waitJobs(servers)
@@ -81,8 +81,8 @@ function runTests (objectStorage: boolean) {
81 const { data: videos } = await server.videos.list() 81 const { data: videos } = await server.videos.list()
82 expect(videos).to.have.lengthOf(2) 82 expect(videos).to.have.lengthOf(2)
83 83
84 const video = videos.find(({ uuid }) => uuid === video1UUID) 84 const video = videos.find(({ shortUUID }) => shortUUID === video1ShortId)
85 const videoDetails = await server.videos.get({ id: video.uuid }) 85 const videoDetails = await server.videos.get({ id: video.shortUUID })
86 86
87 expect(videoDetails.files).to.have.lengthOf(2) 87 expect(videoDetails.files).to.have.lengthOf(2)
88 const [ originalVideo, transcodedVideo ] = videoDetails.files 88 const [ originalVideo, transcodedVideo ] = videoDetails.files
@@ -118,7 +118,7 @@ function runTests (objectStorage: boolean) {
118 }) 118 })
119 119
120 it('Should run a import job on video 2 with the same resolution and the same extension', async function () { 120 it('Should run a import job on video 2 with the same resolution and the same extension', async function () {
121 const command = `npm run create-import-video-file-job -- -v ${video1UUID} -i server/tests/fixtures/video_short2.webm` 121 const command = `npm run create-import-video-file-job -- -v ${video1ShortId} -i server/tests/fixtures/video_short2.webm`
122 await servers[0].cli.execWithEnv(command) 122 await servers[0].cli.execWithEnv(command)
123 123
124 await waitJobs(servers) 124 await waitJobs(servers)
@@ -127,7 +127,7 @@ function runTests (objectStorage: boolean) {
127 const { data: videos } = await server.videos.list() 127 const { data: videos } = await server.videos.list()
128 expect(videos).to.have.lengthOf(2) 128 expect(videos).to.have.lengthOf(2)
129 129
130 const video = videos.find(({ uuid }) => uuid === video1UUID) 130 const video = videos.find(({ shortUUID }) => shortUUID === video1ShortId)
131 const videoDetails = await server.videos.get({ id: video.uuid }) 131 const videoDetails = await server.videos.get({ id: video.uuid })
132 132
133 expect(videoDetails.files).to.have.lengthOf(2) 133 expect(videoDetails.files).to.have.lengthOf(2)
diff --git a/server/tests/cli/create-transcoding-job.ts b/server/tests/cli/create-transcoding-job.ts
index 3313a492f..3fd624091 100644
--- a/server/tests/cli/create-transcoding-job.ts
+++ b/server/tests/cli/create-transcoding-job.ts
@@ -52,8 +52,13 @@ function runTests (objectStorage: boolean) {
52 if (objectStorage) await ObjectStorageCommand.prepareDefaultBuckets() 52 if (objectStorage) await ObjectStorageCommand.prepareDefaultBuckets()
53 53
54 for (let i = 1; i <= 5; i++) { 54 for (let i = 1; i <= 5; i++) {
55 const { uuid } = await servers[0].videos.upload({ attributes: { name: 'video' + i } }) 55 const { uuid, shortUUID } = await servers[0].videos.upload({ attributes: { name: 'video' + i } })
56 videosUUID.push(uuid) 56
57 if (i > 2) {
58 videosUUID.push(uuid)
59 } else {
60 videosUUID.push(shortUUID)
61 }
57 } 62 }
58 63
59 await waitJobs(servers) 64 await waitJobs(servers)
@@ -88,7 +93,7 @@ function runTests (objectStorage: boolean) {
88 for (const video of data) { 93 for (const video of data) {
89 const videoDetails = await server.videos.get({ id: video.uuid }) 94 const videoDetails = await server.videos.get({ id: video.uuid })
90 95
91 if (video.uuid === videosUUID[1]) { 96 if (video.shortUUID === videosUUID[1] || video.uuid === videosUUID[1]) {
92 expect(videoDetails.files).to.have.lengthOf(4) 97 expect(videoDetails.files).to.have.lengthOf(4)
93 expect(videoDetails.streamingPlaylists).to.have.lengthOf(0) 98 expect(videoDetails.streamingPlaylists).to.have.lengthOf(0)
94 99