aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/live/live-save-replay.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-08 10:18:40 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:17 +0200
commit4f2199144e428c16460750305f737b890c1ac322 (patch)
treea19c5c0f254ab0b32d6c8838af33a1ba260e4877 /server/tests/api/live/live-save-replay.ts
parent2c27e70471120c92e0bc8c8114141fbb31ff98ac (diff)
downloadPeerTube-4f2199144e428c16460750305f737b890c1ac322.tar.gz
PeerTube-4f2199144e428c16460750305f737b890c1ac322.tar.zst
PeerTube-4f2199144e428c16460750305f737b890c1ac322.zip
Introduce live command
Diffstat (limited to 'server/tests/api/live/live-save-replay.ts')
-rw-r--r--server/tests/api/live/live-save-replay.ts29
1 files changed, 12 insertions, 17 deletions
diff --git a/server/tests/api/live/live-save-replay.ts b/server/tests/api/live/live-save-replay.ts
index e74bc3e8d..d3c252ffd 100644
--- a/server/tests/api/live/live-save-replay.ts
+++ b/server/tests/api/live/live-save-replay.ts
@@ -10,13 +10,11 @@ import {
10 checkLiveCleanup, 10 checkLiveCleanup,
11 cleanupTests, 11 cleanupTests,
12 ConfigCommand, 12 ConfigCommand,
13 createLive,
14 doubleFollow, 13 doubleFollow,
15 flushAndRunMultipleServers, 14 flushAndRunMultipleServers,
16 getVideo, 15 getVideo,
17 getVideosList, 16 getVideosList,
18 removeVideo, 17 removeVideo,
19 sendRTMPStreamInVideo,
20 ServerInfo, 18 ServerInfo,
21 setAccessTokensToServers, 19 setAccessTokensToServers,
22 setDefaultVideoChannel, 20 setDefaultVideoChannel,
@@ -24,10 +22,7 @@ import {
24 testFfmpegStreamError, 22 testFfmpegStreamError,
25 updateVideo, 23 updateVideo,
26 wait, 24 wait,
27 waitJobs, 25 waitJobs
28 waitUntilLiveEnded,
29 waitUntilLivePublished,
30 waitUntilLiveSaved
31} from '../../../../shared/extra-utils' 26} from '../../../../shared/extra-utils'
32 27
33const expect = chai.expect 28const expect = chai.expect
@@ -52,8 +47,8 @@ describe('Save replay setting', function () {
52 saveReplay 47 saveReplay
53 } 48 }
54 49
55 const res = await createLive(servers[0].url, servers[0].accessToken, attributes) 50 const { uuid } = await servers[0].liveCommand.createLive({ fields: attributes })
56 return res.body.video.uuid 51 return uuid
57 } 52 }
58 53
59 async function checkVideosExist (videoId: string, existsInList: boolean, getStatus?: number) { 54 async function checkVideosExist (videoId: string, existsInList: boolean, getStatus?: number) {
@@ -79,13 +74,13 @@ describe('Save replay setting', function () {
79 74
80 async function waitUntilLivePublishedOnAllServers (videoId: string) { 75 async function waitUntilLivePublishedOnAllServers (videoId: string) {
81 for (const server of servers) { 76 for (const server of servers) {
82 await waitUntilLivePublished(server.url, server.accessToken, videoId) 77 await server.liveCommand.waitUntilLivePublished({ videoId })
83 } 78 }
84 } 79 }
85 80
86 async function waitUntilLiveSavedOnAllServers (videoId: string) { 81 async function waitUntilLiveSavedOnAllServers (videoId: string) {
87 for (const server of servers) { 82 for (const server of servers) {
88 await waitUntilLiveSaved(server.url, server.accessToken, videoId) 83 await server.liveCommand.waitUntilLiveSaved({ videoId })
89 } 84 }
90 } 85 }
91 86
@@ -136,7 +131,7 @@ describe('Save replay setting', function () {
136 it('Should correctly have updated the live and federated it when streaming in the live', async function () { 131 it('Should correctly have updated the live and federated it when streaming in the live', async function () {
137 this.timeout(30000) 132 this.timeout(30000)
138 133
139 ffmpegCommand = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID) 134 ffmpegCommand = await servers[0].liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoUUID })
140 135
141 await waitUntilLivePublishedOnAllServers(liveVideoUUID) 136 await waitUntilLivePublishedOnAllServers(liveVideoUUID)
142 137
@@ -152,7 +147,7 @@ describe('Save replay setting', function () {
152 await stopFfmpeg(ffmpegCommand) 147 await stopFfmpeg(ffmpegCommand)
153 148
154 for (const server of servers) { 149 for (const server of servers) {
155 await waitUntilLiveEnded(server.url, server.accessToken, liveVideoUUID) 150 await server.liveCommand.waitUntilLiveEnded({ videoId: liveVideoUUID })
156 } 151 }
157 await waitJobs(servers) 152 await waitJobs(servers)
158 153
@@ -169,7 +164,7 @@ describe('Save replay setting', function () {
169 164
170 liveVideoUUID = await createLiveWrapper(false) 165 liveVideoUUID = await createLiveWrapper(false)
171 166
172 ffmpegCommand = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID) 167 ffmpegCommand = await servers[0].liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoUUID })
173 168
174 await waitUntilLivePublishedOnAllServers(liveVideoUUID) 169 await waitUntilLivePublishedOnAllServers(liveVideoUUID)
175 170
@@ -198,7 +193,7 @@ describe('Save replay setting', function () {
198 193
199 liveVideoUUID = await createLiveWrapper(false) 194 liveVideoUUID = await createLiveWrapper(false)
200 195
201 ffmpegCommand = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID) 196 ffmpegCommand = await servers[0].liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoUUID })
202 197
203 await waitUntilLivePublishedOnAllServers(liveVideoUUID) 198 await waitUntilLivePublishedOnAllServers(liveVideoUUID)
204 199
@@ -234,7 +229,7 @@ describe('Save replay setting', function () {
234 it('Should correctly have updated the live and federated it when streaming in the live', async function () { 229 it('Should correctly have updated the live and federated it when streaming in the live', async function () {
235 this.timeout(20000) 230 this.timeout(20000)
236 231
237 ffmpegCommand = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID) 232 ffmpegCommand = await servers[0].liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoUUID })
238 await waitUntilLivePublishedOnAllServers(liveVideoUUID) 233 await waitUntilLivePublishedOnAllServers(liveVideoUUID)
239 234
240 await waitJobs(servers) 235 await waitJobs(servers)
@@ -278,7 +273,7 @@ describe('Save replay setting', function () {
278 273
279 liveVideoUUID = await createLiveWrapper(true) 274 liveVideoUUID = await createLiveWrapper(true)
280 275
281 ffmpegCommand = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID) 276 ffmpegCommand = await servers[0].liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoUUID })
282 await waitUntilLivePublishedOnAllServers(liveVideoUUID) 277 await waitUntilLivePublishedOnAllServers(liveVideoUUID)
283 278
284 await waitJobs(servers) 279 await waitJobs(servers)
@@ -306,7 +301,7 @@ describe('Save replay setting', function () {
306 301
307 liveVideoUUID = await createLiveWrapper(true) 302 liveVideoUUID = await createLiveWrapper(true)
308 303
309 ffmpegCommand = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID) 304 ffmpegCommand = await servers[0].liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoUUID })
310 await waitUntilLivePublishedOnAllServers(liveVideoUUID) 305 await waitUntilLivePublishedOnAllServers(liveVideoUUID)
311 306
312 await waitJobs(servers) 307 await waitJobs(servers)