aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/live/live-constraints.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-constraints.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-constraints.ts')
-rw-r--r--server/tests/api/live/live-constraints.ts21
1 files changed, 9 insertions, 12 deletions
diff --git a/server/tests/api/live/live-constraints.ts b/server/tests/api/live/live-constraints.ts
index c64d10dcd..5c4817b40 100644
--- a/server/tests/api/live/live-constraints.ts
+++ b/server/tests/api/live/live-constraints.ts
@@ -7,19 +7,16 @@ import {
7 checkLiveCleanup, 7 checkLiveCleanup,
8 cleanupTests, 8 cleanupTests,
9 ConfigCommand, 9 ConfigCommand,
10 createLive,
11 doubleFollow, 10 doubleFollow,
12 flushAndRunMultipleServers, 11 flushAndRunMultipleServers,
13 generateUser, 12 generateUser,
14 getVideo, 13 getVideo,
15 runAndTestFfmpegStreamError,
16 ServerInfo, 14 ServerInfo,
17 setAccessTokensToServers, 15 setAccessTokensToServers,
18 setDefaultVideoChannel, 16 setDefaultVideoChannel,
19 updateUser, 17 updateUser,
20 wait, 18 wait,
21 waitJobs, 19 waitJobs
22 waitUntilLivePublished
23} from '../../../../shared/extra-utils' 20} from '../../../../shared/extra-utils'
24 21
25const expect = chai.expect 22const expect = chai.expect
@@ -38,8 +35,8 @@ describe('Test live constraints', function () {
38 saveReplay 35 saveReplay
39 } 36 }
40 37
41 const res = await createLive(servers[0].url, userAccessToken, liveAttributes) 38 const { uuid } = await servers[0].liveCommand.createLive({ token: userAccessToken, fields: liveAttributes })
42 return res.body.video.uuid as string 39 return uuid
43 } 40 }
44 41
45 async function checkSaveReplay (videoId: string, resolutions = [ 720 ]) { 42 async function checkSaveReplay (videoId: string, resolutions = [ 720 ]) {
@@ -56,7 +53,7 @@ describe('Test live constraints', function () {
56 53
57 async function waitUntilLivePublishedOnAllServers (videoId: string) { 54 async function waitUntilLivePublishedOnAllServers (videoId: string) {
58 for (const server of servers) { 55 for (const server of servers) {
59 await waitUntilLivePublished(server.url, server.accessToken, videoId) 56 await server.liveCommand.waitUntilLivePublished({ videoId })
60 } 57 }
61 } 58 }
62 59
@@ -108,7 +105,7 @@ describe('Test live constraints', function () {
108 this.timeout(60000) 105 this.timeout(60000)
109 106
110 const userVideoLiveoId = await createLiveWrapper(false) 107 const userVideoLiveoId = await createLiveWrapper(false)
111 await runAndTestFfmpegStreamError(servers[0].url, userAccessToken, userVideoLiveoId, false) 108 await servers[0].liveCommand.runAndTestFfmpegStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: false })
112 }) 109 })
113 110
114 it('Should have size limit depending on user global quota if save replay is enabled', async function () { 111 it('Should have size limit depending on user global quota if save replay is enabled', async function () {
@@ -118,7 +115,7 @@ describe('Test live constraints', function () {
118 await wait(5000) 115 await wait(5000)
119 116
120 const userVideoLiveoId = await createLiveWrapper(true) 117 const userVideoLiveoId = await createLiveWrapper(true)
121 await runAndTestFfmpegStreamError(servers[0].url, userAccessToken, userVideoLiveoId, true) 118 await servers[0].liveCommand.runAndTestFfmpegStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: true })
122 119
123 await waitUntilLivePublishedOnAllServers(userVideoLiveoId) 120 await waitUntilLivePublishedOnAllServers(userVideoLiveoId)
124 await waitJobs(servers) 121 await waitJobs(servers)
@@ -135,7 +132,7 @@ describe('Test live constraints', function () {
135 await updateQuota({ total: -1, daily: 1 }) 132 await updateQuota({ total: -1, daily: 1 })
136 133
137 const userVideoLiveoId = await createLiveWrapper(true) 134 const userVideoLiveoId = await createLiveWrapper(true)
138 await runAndTestFfmpegStreamError(servers[0].url, userAccessToken, userVideoLiveoId, true) 135 await servers[0].liveCommand.runAndTestFfmpegStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: true })
139 136
140 await waitUntilLivePublishedOnAllServers(userVideoLiveoId) 137 await waitUntilLivePublishedOnAllServers(userVideoLiveoId)
141 await waitJobs(servers) 138 await waitJobs(servers)
@@ -152,7 +149,7 @@ describe('Test live constraints', function () {
152 await updateQuota({ total: 10 * 1000 * 1000, daily: -1 }) 149 await updateQuota({ total: 10 * 1000 * 1000, daily: -1 })
153 150
154 const userVideoLiveoId = await createLiveWrapper(true) 151 const userVideoLiveoId = await createLiveWrapper(true)
155 await runAndTestFfmpegStreamError(servers[0].url, userAccessToken, userVideoLiveoId, false) 152 await servers[0].liveCommand.runAndTestFfmpegStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: false })
156 }) 153 })
157 154
158 it('Should have max duration limit', async function () { 155 it('Should have max duration limit', async function () {
@@ -173,7 +170,7 @@ describe('Test live constraints', function () {
173 }) 170 })
174 171
175 const userVideoLiveoId = await createLiveWrapper(true) 172 const userVideoLiveoId = await createLiveWrapper(true)
176 await runAndTestFfmpegStreamError(servers[0].url, userAccessToken, userVideoLiveoId, true) 173 await servers[0].liveCommand.runAndTestFfmpegStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: true })
177 174
178 await waitUntilLivePublishedOnAllServers(userVideoLiveoId) 175 await waitUntilLivePublishedOnAllServers(userVideoLiveoId)
179 await waitJobs(servers) 176 await waitJobs(servers)