aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/live/live-save-replay.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/live/live-save-replay.ts')
-rw-r--r--server/tests/api/live/live-save-replay.ts52
1 files changed, 26 insertions, 26 deletions
diff --git a/server/tests/api/live/live-save-replay.ts b/server/tests/api/live/live-save-replay.ts
index a87a2cd12..7a33df90a 100644
--- a/server/tests/api/live/live-save-replay.ts
+++ b/server/tests/api/live/live-save-replay.ts
@@ -30,19 +30,19 @@ describe('Save replay setting', function () {
30 async function createLiveWrapper (saveReplay: boolean) { 30 async function createLiveWrapper (saveReplay: boolean) {
31 if (liveVideoUUID) { 31 if (liveVideoUUID) {
32 try { 32 try {
33 await servers[0].videosCommand.remove({ id: liveVideoUUID }) 33 await servers[0].videos.remove({ id: liveVideoUUID })
34 await waitJobs(servers) 34 await waitJobs(servers)
35 } catch {} 35 } catch {}
36 } 36 }
37 37
38 const attributes: LiveVideoCreate = { 38 const attributes: LiveVideoCreate = {
39 channelId: servers[0].videoChannel.id, 39 channelId: servers[0].store.channel.id,
40 privacy: VideoPrivacy.PUBLIC, 40 privacy: VideoPrivacy.PUBLIC,
41 name: 'my super live', 41 name: 'my super live',
42 saveReplay 42 saveReplay
43 } 43 }
44 44
45 const { uuid } = await servers[0].liveCommand.create({ fields: attributes }) 45 const { uuid } = await servers[0].live.create({ fields: attributes })
46 return uuid 46 return uuid
47 } 47 }
48 48
@@ -50,32 +50,32 @@ describe('Save replay setting', function () {
50 for (const server of servers) { 50 for (const server of servers) {
51 const length = existsInList ? 1 : 0 51 const length = existsInList ? 1 : 0
52 52
53 const { data, total } = await server.videosCommand.list() 53 const { data, total } = await server.videos.list()
54 expect(data).to.have.lengthOf(length) 54 expect(data).to.have.lengthOf(length)
55 expect(total).to.equal(length) 55 expect(total).to.equal(length)
56 56
57 if (expectedStatus) { 57 if (expectedStatus) {
58 await server.videosCommand.get({ id: videoId, expectedStatus }) 58 await server.videos.get({ id: videoId, expectedStatus })
59 } 59 }
60 } 60 }
61 } 61 }
62 62
63 async function checkVideoState (videoId: string, state: VideoState) { 63 async function checkVideoState (videoId: string, state: VideoState) {
64 for (const server of servers) { 64 for (const server of servers) {
65 const video = await server.videosCommand.get({ id: videoId }) 65 const video = await server.videos.get({ id: videoId })
66 expect(video.state.id).to.equal(state) 66 expect(video.state.id).to.equal(state)
67 } 67 }
68 } 68 }
69 69
70 async function waitUntilLivePublishedOnAllServers (videoId: string) { 70 async function waitUntilLivePublishedOnAllServers (videoId: string) {
71 for (const server of servers) { 71 for (const server of servers) {
72 await server.liveCommand.waitUntilPublished({ videoId }) 72 await server.live.waitUntilPublished({ videoId })
73 } 73 }
74 } 74 }
75 75
76 async function waitUntilLiveSavedOnAllServers (videoId: string) { 76 async function waitUntilLiveSavedOnAllServers (videoId: string) {
77 for (const server of servers) { 77 for (const server of servers) {
78 await server.liveCommand.waitUntilSaved({ videoId }) 78 await server.live.waitUntilSaved({ videoId })
79 } 79 }
80 } 80 }
81 81
@@ -91,7 +91,7 @@ describe('Save replay setting', function () {
91 // Server 1 and server 2 follow each other 91 // Server 1 and server 2 follow each other
92 await doubleFollow(servers[0], servers[1]) 92 await doubleFollow(servers[0], servers[1])
93 93
94 await servers[0].configCommand.updateCustomSubConfig({ 94 await servers[0].config.updateCustomSubConfig({
95 newConfig: { 95 newConfig: {
96 live: { 96 live: {
97 enabled: true, 97 enabled: true,
@@ -126,7 +126,7 @@ describe('Save replay setting', function () {
126 it('Should correctly have updated the live and federated it when streaming in the live', async function () { 126 it('Should correctly have updated the live and federated it when streaming in the live', async function () {
127 this.timeout(30000) 127 this.timeout(30000)
128 128
129 ffmpegCommand = await servers[0].liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoUUID }) 129 ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: liveVideoUUID })
130 130
131 await waitUntilLivePublishedOnAllServers(liveVideoUUID) 131 await waitUntilLivePublishedOnAllServers(liveVideoUUID)
132 132
@@ -142,7 +142,7 @@ describe('Save replay setting', function () {
142 await stopFfmpeg(ffmpegCommand) 142 await stopFfmpeg(ffmpegCommand)
143 143
144 for (const server of servers) { 144 for (const server of servers) {
145 await server.liveCommand.waitUntilEnded({ videoId: liveVideoUUID }) 145 await server.live.waitUntilEnded({ videoId: liveVideoUUID })
146 } 146 }
147 await waitJobs(servers) 147 await waitJobs(servers)
148 148
@@ -159,7 +159,7 @@ describe('Save replay setting', function () {
159 159
160 liveVideoUUID = await createLiveWrapper(false) 160 liveVideoUUID = await createLiveWrapper(false)
161 161
162 ffmpegCommand = await servers[0].liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoUUID }) 162 ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: liveVideoUUID })
163 163
164 await waitUntilLivePublishedOnAllServers(liveVideoUUID) 164 await waitUntilLivePublishedOnAllServers(liveVideoUUID)
165 165
@@ -167,7 +167,7 @@ describe('Save replay setting', function () {
167 await checkVideosExist(liveVideoUUID, true, HttpStatusCode.OK_200) 167 await checkVideosExist(liveVideoUUID, true, HttpStatusCode.OK_200)
168 168
169 await Promise.all([ 169 await Promise.all([
170 servers[0].blacklistCommand.add({ videoId: liveVideoUUID, reason: 'bad live', unfederate: true }), 170 servers[0].blacklist.add({ videoId: liveVideoUUID, reason: 'bad live', unfederate: true }),
171 testFfmpegStreamError(ffmpegCommand, true) 171 testFfmpegStreamError(ffmpegCommand, true)
172 ]) 172 ])
173 173
@@ -175,8 +175,8 @@ describe('Save replay setting', function () {
175 175
176 await checkVideosExist(liveVideoUUID, false) 176 await checkVideosExist(liveVideoUUID, false)
177 177
178 await servers[0].videosCommand.get({ id: liveVideoUUID, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 }) 178 await servers[0].videos.get({ id: liveVideoUUID, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 })
179 await servers[1].videosCommand.get({ id: liveVideoUUID, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) 179 await servers[1].videos.get({ id: liveVideoUUID, expectedStatus: HttpStatusCode.NOT_FOUND_404 })
180 180
181 await wait(5000) 181 await wait(5000)
182 await waitJobs(servers) 182 await waitJobs(servers)
@@ -188,7 +188,7 @@ describe('Save replay setting', function () {
188 188
189 liveVideoUUID = await createLiveWrapper(false) 189 liveVideoUUID = await createLiveWrapper(false)
190 190
191 ffmpegCommand = await servers[0].liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoUUID }) 191 ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: liveVideoUUID })
192 192
193 await waitUntilLivePublishedOnAllServers(liveVideoUUID) 193 await waitUntilLivePublishedOnAllServers(liveVideoUUID)
194 194
@@ -197,7 +197,7 @@ describe('Save replay setting', function () {
197 197
198 await Promise.all([ 198 await Promise.all([
199 testFfmpegStreamError(ffmpegCommand, true), 199 testFfmpegStreamError(ffmpegCommand, true),
200 servers[0].videosCommand.remove({ id: liveVideoUUID }) 200 servers[0].videos.remove({ id: liveVideoUUID })
201 ]) 201 ])
202 202
203 await wait(5000) 203 await wait(5000)
@@ -224,7 +224,7 @@ describe('Save replay setting', function () {
224 it('Should correctly have updated the live and federated it when streaming in the live', async function () { 224 it('Should correctly have updated the live and federated it when streaming in the live', async function () {
225 this.timeout(20000) 225 this.timeout(20000)
226 226
227 ffmpegCommand = await servers[0].liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoUUID }) 227 ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: liveVideoUUID })
228 await waitUntilLivePublishedOnAllServers(liveVideoUUID) 228 await waitUntilLivePublishedOnAllServers(liveVideoUUID)
229 229
230 await waitJobs(servers) 230 await waitJobs(servers)
@@ -249,11 +249,11 @@ describe('Save replay setting', function () {
249 it('Should update the saved live and correctly federate the updated attributes', async function () { 249 it('Should update the saved live and correctly federate the updated attributes', async function () {
250 this.timeout(30000) 250 this.timeout(30000)
251 251
252 await servers[0].videosCommand.update({ id: liveVideoUUID, attributes: { name: 'video updated' } }) 252 await servers[0].videos.update({ id: liveVideoUUID, attributes: { name: 'video updated' } })
253 await waitJobs(servers) 253 await waitJobs(servers)
254 254
255 for (const server of servers) { 255 for (const server of servers) {
256 const video = await server.videosCommand.get({ id: liveVideoUUID }) 256 const video = await server.videos.get({ id: liveVideoUUID })
257 expect(video.name).to.equal('video updated') 257 expect(video.name).to.equal('video updated')
258 expect(video.isLive).to.be.false 258 expect(video.isLive).to.be.false
259 } 259 }
@@ -268,14 +268,14 @@ describe('Save replay setting', function () {
268 268
269 liveVideoUUID = await createLiveWrapper(true) 269 liveVideoUUID = await createLiveWrapper(true)
270 270
271 ffmpegCommand = await servers[0].liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoUUID }) 271 ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: liveVideoUUID })
272 await waitUntilLivePublishedOnAllServers(liveVideoUUID) 272 await waitUntilLivePublishedOnAllServers(liveVideoUUID)
273 273
274 await waitJobs(servers) 274 await waitJobs(servers)
275 await checkVideosExist(liveVideoUUID, true, HttpStatusCode.OK_200) 275 await checkVideosExist(liveVideoUUID, true, HttpStatusCode.OK_200)
276 276
277 await Promise.all([ 277 await Promise.all([
278 servers[0].blacklistCommand.add({ videoId: liveVideoUUID, reason: 'bad live', unfederate: true }), 278 servers[0].blacklist.add({ videoId: liveVideoUUID, reason: 'bad live', unfederate: true }),
279 testFfmpegStreamError(ffmpegCommand, true) 279 testFfmpegStreamError(ffmpegCommand, true)
280 ]) 280 ])
281 281
@@ -283,8 +283,8 @@ describe('Save replay setting', function () {
283 283
284 await checkVideosExist(liveVideoUUID, false) 284 await checkVideosExist(liveVideoUUID, false)
285 285
286 await servers[0].videosCommand.get({ id: liveVideoUUID, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 }) 286 await servers[0].videos.get({ id: liveVideoUUID, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 })
287 await servers[1].videosCommand.get({ id: liveVideoUUID, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) 287 await servers[1].videos.get({ id: liveVideoUUID, expectedStatus: HttpStatusCode.NOT_FOUND_404 })
288 288
289 await wait(5000) 289 await wait(5000)
290 await waitJobs(servers) 290 await waitJobs(servers)
@@ -296,14 +296,14 @@ describe('Save replay setting', function () {
296 296
297 liveVideoUUID = await createLiveWrapper(true) 297 liveVideoUUID = await createLiveWrapper(true)
298 298
299 ffmpegCommand = await servers[0].liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoUUID }) 299 ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: liveVideoUUID })
300 await waitUntilLivePublishedOnAllServers(liveVideoUUID) 300 await waitUntilLivePublishedOnAllServers(liveVideoUUID)
301 301
302 await waitJobs(servers) 302 await waitJobs(servers)
303 await checkVideosExist(liveVideoUUID, true, HttpStatusCode.OK_200) 303 await checkVideosExist(liveVideoUUID, true, HttpStatusCode.OK_200)
304 304
305 await Promise.all([ 305 await Promise.all([
306 servers[0].videosCommand.remove({ id: liveVideoUUID }), 306 servers[0].videos.remove({ id: liveVideoUUID }),
307 testFfmpegStreamError(ffmpegCommand, true) 307 testFfmpegStreamError(ffmpegCommand, true)
308 ]) 308 ])
309 309