aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/cli/create-transcoding-job.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/cli/create-transcoding-job.ts')
-rw-r--r--server/tests/cli/create-transcoding-job.ts76
1 files changed, 31 insertions, 45 deletions
diff --git a/server/tests/cli/create-transcoding-job.ts b/server/tests/cli/create-transcoding-job.ts
index e3211882d..f629306e6 100644
--- a/server/tests/cli/create-transcoding-job.ts
+++ b/server/tests/cli/create-transcoding-job.ts
@@ -6,14 +6,10 @@ import {
6 cleanupTests, 6 cleanupTests,
7 doubleFollow, 7 doubleFollow,
8 flushAndRunMultipleServers, 8 flushAndRunMultipleServers,
9 getVideo,
10 getVideosList,
11 ServerInfo, 9 ServerInfo,
12 setAccessTokensToServers, 10 setAccessTokensToServers,
13 uploadVideo 11 waitJobs
14} from '../../../shared/extra-utils' 12} from '../../../shared/extra-utils'
15import { waitJobs } from '../../../shared/extra-utils/server/jobs'
16import { VideoDetails } from '../../../shared/models/videos'
17 13
18const expect = chai.expect 14const expect = chai.expect
19 15
@@ -51,8 +47,8 @@ describe('Test create transcoding jobs', function () {
51 await doubleFollow(servers[0], servers[1]) 47 await doubleFollow(servers[0], servers[1])
52 48
53 for (let i = 1; i <= 5; i++) { 49 for (let i = 1; i <= 5; i++) {
54 const res = await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'video' + i }) 50 const { uuid } = await servers[0].videosCommand.upload({ attributes: { name: 'video' + i } })
55 videosUUID.push(res.body.video.uuid) 51 videosUUID.push(uuid)
56 } 52 }
57 53
58 await waitJobs(servers) 54 await waitJobs(servers)
@@ -62,13 +58,11 @@ describe('Test create transcoding jobs', function () {
62 this.timeout(30000) 58 this.timeout(30000)
63 59
64 for (const server of servers) { 60 for (const server of servers) {
65 const res = await getVideosList(server.url) 61 const { data } = await server.videosCommand.list()
66 const videos = res.body.data 62 expect(data).to.have.lengthOf(videosUUID.length)
67 expect(videos).to.have.lengthOf(videosUUID.length)
68 63
69 for (const video of videos) { 64 for (const video of data) {
70 const res2 = await getVideo(server.url, video.uuid) 65 const videoDetail = await server.videosCommand.get({ id: video.uuid })
71 const videoDetail: VideoDetails = res2.body
72 expect(videoDetail.files).to.have.lengthOf(1) 66 expect(videoDetail.files).to.have.lengthOf(1)
73 expect(videoDetail.streamingPlaylists).to.have.lengthOf(0) 67 expect(videoDetail.streamingPlaylists).to.have.lengthOf(0)
74 } 68 }
@@ -82,14 +76,12 @@ describe('Test create transcoding jobs', function () {
82 await waitJobs(servers) 76 await waitJobs(servers)
83 77
84 for (const server of servers) { 78 for (const server of servers) {
85 const res = await getVideosList(server.url) 79 const { data } = await server.videosCommand.list()
86 const videos = res.body.data
87 80
88 let infoHashes: { [id: number]: string } 81 let infoHashes: { [id: number]: string }
89 82
90 for (const video of videos) { 83 for (const video of data) {
91 const res2 = await getVideo(server.url, video.uuid) 84 const videoDetail = await server.videosCommand.get({ id: video.uuid })
92 const videoDetail: VideoDetails = res2.body
93 85
94 if (video.uuid === videosUUID[1]) { 86 if (video.uuid === videosUUID[1]) {
95 expect(videoDetail.files).to.have.lengthOf(4) 87 expect(videoDetail.files).to.have.lengthOf(4)
@@ -123,18 +115,16 @@ describe('Test create transcoding jobs', function () {
123 await waitJobs(servers) 115 await waitJobs(servers)
124 116
125 for (const server of servers) { 117 for (const server of servers) {
126 const res = await getVideosList(server.url) 118 const { data } = await server.videosCommand.list()
127 const videos = res.body.data 119 expect(data).to.have.lengthOf(videosUUID.length)
128 expect(videos).to.have.lengthOf(videosUUID.length)
129 120
130 const res2 = await getVideo(server.url, videosUUID[0]) 121 const videoDetails = await server.videosCommand.get({ id: videosUUID[0] })
131 const videoDetail: VideoDetails = res2.body
132 122
133 expect(videoDetail.files).to.have.lengthOf(2) 123 expect(videoDetails.files).to.have.lengthOf(2)
134 expect(videoDetail.files[0].resolution.id).to.equal(720) 124 expect(videoDetails.files[0].resolution.id).to.equal(720)
135 expect(videoDetail.files[1].resolution.id).to.equal(480) 125 expect(videoDetails.files[1].resolution.id).to.equal(480)
136 126
137 expect(videoDetail.streamingPlaylists).to.have.lengthOf(0) 127 expect(videoDetails.streamingPlaylists).to.have.lengthOf(0)
138 } 128 }
139 }) 129 })
140 130
@@ -146,13 +136,12 @@ describe('Test create transcoding jobs', function () {
146 await waitJobs(servers) 136 await waitJobs(servers)
147 137
148 for (const server of servers) { 138 for (const server of servers) {
149 const res = await getVideo(server.url, videosUUID[2]) 139 const videoDetails = await server.videosCommand.get({ id: videosUUID[2] })
150 const videoDetail: VideoDetails = res.body
151 140
152 expect(videoDetail.files).to.have.lengthOf(1) 141 expect(videoDetails.files).to.have.lengthOf(1)
153 expect(videoDetail.streamingPlaylists).to.have.lengthOf(1) 142 expect(videoDetails.streamingPlaylists).to.have.lengthOf(1)
154 143
155 const files = videoDetail.streamingPlaylists[0].files 144 const files = videoDetails.streamingPlaylists[0].files
156 expect(files).to.have.lengthOf(1) 145 expect(files).to.have.lengthOf(1)
157 expect(files[0].resolution.id).to.equal(480) 146 expect(files[0].resolution.id).to.equal(480)
158 } 147 }
@@ -166,10 +155,9 @@ describe('Test create transcoding jobs', function () {
166 await waitJobs(servers) 155 await waitJobs(servers)
167 156
168 for (const server of servers) { 157 for (const server of servers) {
169 const res = await getVideo(server.url, videosUUID[2]) 158 const videoDetails = await server.videosCommand.get({ id: videosUUID[2] })
170 const videoDetail: VideoDetails = res.body
171 159
172 const files = videoDetail.streamingPlaylists[0].files 160 const files = videoDetails.streamingPlaylists[0].files
173 expect(files).to.have.lengthOf(1) 161 expect(files).to.have.lengthOf(1)
174 expect(files[0].resolution.id).to.equal(480) 162 expect(files[0].resolution.id).to.equal(480)
175 } 163 }
@@ -183,13 +171,12 @@ describe('Test create transcoding jobs', function () {
183 await waitJobs(servers) 171 await waitJobs(servers)
184 172
185 for (const server of servers) { 173 for (const server of servers) {
186 const res = await getVideo(server.url, videosUUID[3]) 174 const videoDetails = await server.videosCommand.get({ id: videosUUID[3] })
187 const videoDetail: VideoDetails = res.body
188 175
189 expect(videoDetail.files).to.have.lengthOf(1) 176 expect(videoDetails.files).to.have.lengthOf(1)
190 expect(videoDetail.streamingPlaylists).to.have.lengthOf(1) 177 expect(videoDetails.streamingPlaylists).to.have.lengthOf(1)
191 178
192 const files = videoDetail.streamingPlaylists[0].files 179 const files = videoDetails.streamingPlaylists[0].files
193 expect(files).to.have.lengthOf(4) 180 expect(files).to.have.lengthOf(4)
194 } 181 }
195 }) 182 })
@@ -205,12 +192,11 @@ describe('Test create transcoding jobs', function () {
205 await waitJobs(servers) 192 await waitJobs(servers)
206 193
207 for (const server of servers) { 194 for (const server of servers) {
208 const res = await getVideo(server.url, videosUUID[4]) 195 const videoDetails = await server.videosCommand.get({ id: videosUUID[4] })
209 const videoDetail: VideoDetails = res.body
210 196
211 expect(videoDetail.files).to.have.lengthOf(4) 197 expect(videoDetails.files).to.have.lengthOf(4)
212 expect(videoDetail.streamingPlaylists).to.have.lengthOf(1) 198 expect(videoDetails.streamingPlaylists).to.have.lengthOf(1)
213 expect(videoDetail.streamingPlaylists[0].files).to.have.lengthOf(4) 199 expect(videoDetails.streamingPlaylists[0].files).to.have.lengthOf(4)
214 } 200 }
215 }) 201 })
216 202