aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/live
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-07 11:51:09 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:17 +0200
commit65e6e2602c0d5521f3a6740f7469bb92830ecb53 (patch)
treef89024ffff1dafb0281ee2fe028e89b95101bd44 /server/tests/api/live
parentbc8090411ddaa8d742ce4de3c83f9dba7bc18e2a (diff)
downloadPeerTube-65e6e2602c0d5521f3a6740f7469bb92830ecb53.tar.gz
PeerTube-65e6e2602c0d5521f3a6740f7469bb92830ecb53.tar.zst
PeerTube-65e6e2602c0d5521f3a6740f7469bb92830ecb53.zip
Introduce config command
Diffstat (limited to 'server/tests/api/live')
-rw-r--r--server/tests/api/live/live-constraints.ts33
-rw-r--r--server/tests/api/live/live-permanent.ts35
-rw-r--r--server/tests/api/live/live-save-replay.ts21
-rw-r--r--server/tests/api/live/live-socket-messages.ts15
-rw-r--r--server/tests/api/live/live-views.ts15
-rw-r--r--server/tests/api/live/live.ts43
6 files changed, 87 insertions, 75 deletions
diff --git a/server/tests/api/live/live-constraints.ts b/server/tests/api/live/live-constraints.ts
index cc635de33..c64d10dcd 100644
--- a/server/tests/api/live/live-constraints.ts
+++ b/server/tests/api/live/live-constraints.ts
@@ -6,17 +6,16 @@ import { VideoDetails, VideoPrivacy } from '@shared/models'
6import { 6import {
7 checkLiveCleanup, 7 checkLiveCleanup,
8 cleanupTests, 8 cleanupTests,
9 ConfigCommand,
9 createLive, 10 createLive,
10 doubleFollow, 11 doubleFollow,
11 flushAndRunMultipleServers, 12 flushAndRunMultipleServers,
12 generateUser, 13 generateUser,
13 getCustomConfigResolutions,
14 getVideo, 14 getVideo,
15 runAndTestFfmpegStreamError, 15 runAndTestFfmpegStreamError,
16 ServerInfo, 16 ServerInfo,
17 setAccessTokensToServers, 17 setAccessTokensToServers,
18 setDefaultVideoChannel, 18 setDefaultVideoChannel,
19 updateCustomSubConfig,
20 updateUser, 19 updateUser,
21 wait, 20 wait,
22 waitJobs, 21 waitJobs,
@@ -80,12 +79,14 @@ describe('Test live constraints', function () {
80 await setAccessTokensToServers(servers) 79 await setAccessTokensToServers(servers)
81 await setDefaultVideoChannel(servers) 80 await setDefaultVideoChannel(servers)
82 81
83 await updateCustomSubConfig(servers[0].url, servers[0].accessToken, { 82 await servers[0].configCommand.updateCustomSubConfig({
84 live: { 83 newConfig: {
85 enabled: true, 84 live: {
86 allowReplay: true, 85 enabled: true,
87 transcoding: { 86 allowReplay: true,
88 enabled: false 87 transcoding: {
88 enabled: false
89 }
89 } 90 }
90 } 91 }
91 }) 92 })
@@ -157,14 +158,16 @@ describe('Test live constraints', function () {
157 it('Should have max duration limit', async function () { 158 it('Should have max duration limit', async function () {
158 this.timeout(60000) 159 this.timeout(60000)
159 160
160 await updateCustomSubConfig(servers[0].url, servers[0].accessToken, { 161 await servers[0].configCommand.updateCustomSubConfig({
161 live: { 162 newConfig: {
162 enabled: true, 163 live: {
163 allowReplay: true,
164 maxDuration: 1,
165 transcoding: {
166 enabled: true, 164 enabled: true,
167 resolutions: getCustomConfigResolutions(true) 165 allowReplay: true,
166 maxDuration: 1,
167 transcoding: {
168 enabled: true,
169 resolutions: ConfigCommand.getCustomConfigResolutions(true)
170 }
168 } 171 }
169 } 172 }
170 }) 173 })
diff --git a/server/tests/api/live/live-permanent.ts b/server/tests/api/live/live-permanent.ts
index 71b7d28a8..b9e37c834 100644
--- a/server/tests/api/live/live-permanent.ts
+++ b/server/tests/api/live/live-permanent.ts
@@ -5,10 +5,10 @@ import * as chai from 'chai'
5import { LiveVideoCreate, VideoDetails, VideoPrivacy, VideoState } from '@shared/models' 5import { LiveVideoCreate, VideoDetails, VideoPrivacy, VideoState } from '@shared/models'
6import { 6import {
7 cleanupTests, 7 cleanupTests,
8 ConfigCommand,
8 createLive, 9 createLive,
9 doubleFollow, 10 doubleFollow,
10 flushAndRunMultipleServers, 11 flushAndRunMultipleServers,
11 getCustomConfigResolutions,
12 getLive, 12 getLive,
13 getPlaylistsCount, 13 getPlaylistsCount,
14 getVideo, 14 getVideo,
@@ -17,7 +17,6 @@ import {
17 setAccessTokensToServers, 17 setAccessTokensToServers,
18 setDefaultVideoChannel, 18 setDefaultVideoChannel,
19 stopFfmpeg, 19 stopFfmpeg,
20 updateCustomSubConfig,
21 updateLive, 20 updateLive,
22 wait, 21 wait,
23 waitJobs, 22 waitJobs,
@@ -63,14 +62,16 @@ describe('Permanent live', function () {
63 // Server 1 and server 2 follow each other 62 // Server 1 and server 2 follow each other
64 await doubleFollow(servers[0], servers[1]) 63 await doubleFollow(servers[0], servers[1])
65 64
66 await updateCustomSubConfig(servers[0].url, servers[0].accessToken, { 65 await servers[0].configCommand.updateCustomSubConfig({
67 live: { 66 newConfig: {
68 enabled: true, 67 live: {
69 allowReplay: true,
70 maxDuration: -1,
71 transcoding: {
72 enabled: true, 68 enabled: true,
73 resolutions: getCustomConfigResolutions(true) 69 allowReplay: true,
70 maxDuration: -1,
71 transcoding: {
72 enabled: true,
73 resolutions: ConfigCommand.getCustomConfigResolutions(true)
74 }
74 } 75 }
75 } 76 }
76 }) 77 })
@@ -145,14 +146,16 @@ describe('Permanent live', function () {
145 it('Should be able to stream again in the permanent live', async function () { 146 it('Should be able to stream again in the permanent live', async function () {
146 this.timeout(20000) 147 this.timeout(20000)
147 148
148 await updateCustomSubConfig(servers[0].url, servers[0].accessToken, { 149 await servers[0].configCommand.updateCustomSubConfig({
149 live: { 150 newConfig: {
150 enabled: true, 151 live: {
151 allowReplay: true,
152 maxDuration: -1,
153 transcoding: {
154 enabled: true, 152 enabled: true,
155 resolutions: getCustomConfigResolutions(false) 153 allowReplay: true,
154 maxDuration: -1,
155 transcoding: {
156 enabled: true,
157 resolutions: ConfigCommand.getCustomConfigResolutions(false)
158 }
156 } 159 }
157 } 160 }
158 }) 161 })
diff --git a/server/tests/api/live/live-save-replay.ts b/server/tests/api/live/live-save-replay.ts
index 3d4736c8f..e74bc3e8d 100644
--- a/server/tests/api/live/live-save-replay.ts
+++ b/server/tests/api/live/live-save-replay.ts
@@ -9,10 +9,10 @@ import {
9 addVideoToBlacklist, 9 addVideoToBlacklist,
10 checkLiveCleanup, 10 checkLiveCleanup,
11 cleanupTests, 11 cleanupTests,
12 ConfigCommand,
12 createLive, 13 createLive,
13 doubleFollow, 14 doubleFollow,
14 flushAndRunMultipleServers, 15 flushAndRunMultipleServers,
15 getCustomConfigResolutions,
16 getVideo, 16 getVideo,
17 getVideosList, 17 getVideosList,
18 removeVideo, 18 removeVideo,
@@ -22,7 +22,6 @@ import {
22 setDefaultVideoChannel, 22 setDefaultVideoChannel,
23 stopFfmpeg, 23 stopFfmpeg,
24 testFfmpegStreamError, 24 testFfmpegStreamError,
25 updateCustomSubConfig,
26 updateVideo, 25 updateVideo,
27 wait, 26 wait,
28 waitJobs, 27 waitJobs,
@@ -102,14 +101,16 @@ describe('Save replay setting', function () {
102 // Server 1 and server 2 follow each other 101 // Server 1 and server 2 follow each other
103 await doubleFollow(servers[0], servers[1]) 102 await doubleFollow(servers[0], servers[1])
104 103
105 await updateCustomSubConfig(servers[0].url, servers[0].accessToken, { 104 await servers[0].configCommand.updateCustomSubConfig({
106 live: { 105 newConfig: {
107 enabled: true, 106 live: {
108 allowReplay: true, 107 enabled: true,
109 maxDuration: -1, 108 allowReplay: true,
110 transcoding: { 109 maxDuration: -1,
111 enabled: false, 110 transcoding: {
112 resolutions: getCustomConfigResolutions(true) 111 enabled: false,
112 resolutions: ConfigCommand.getCustomConfigResolutions(true)
113 }
113 } 114 }
114 } 115 }
115 }) 116 })
diff --git a/server/tests/api/live/live-socket-messages.ts b/server/tests/api/live/live-socket-messages.ts
index e00909ade..0159d5199 100644
--- a/server/tests/api/live/live-socket-messages.ts
+++ b/server/tests/api/live/live-socket-messages.ts
@@ -15,7 +15,6 @@ import {
15 setAccessTokensToServers, 15 setAccessTokensToServers,
16 setDefaultVideoChannel, 16 setDefaultVideoChannel,
17 stopFfmpeg, 17 stopFfmpeg,
18 updateCustomSubConfig,
19 viewVideo, 18 viewVideo,
20 wait, 19 wait,
21 waitJobs, 20 waitJobs,
@@ -37,12 +36,14 @@ describe('Test live', function () {
37 await setAccessTokensToServers(servers) 36 await setAccessTokensToServers(servers)
38 await setDefaultVideoChannel(servers) 37 await setDefaultVideoChannel(servers)
39 38
40 await updateCustomSubConfig(servers[0].url, servers[0].accessToken, { 39 await servers[0].configCommand.updateCustomSubConfig({
41 live: { 40 newConfig: {
42 enabled: true, 41 live: {
43 allowReplay: true, 42 enabled: true,
44 transcoding: { 43 allowReplay: true,
45 enabled: false 44 transcoding: {
45 enabled: false
46 }
46 } 47 }
47 } 48 }
48 }) 49 })
diff --git a/server/tests/api/live/live-views.ts b/server/tests/api/live/live-views.ts
index a44d21ffa..ca571c962 100644
--- a/server/tests/api/live/live-views.ts
+++ b/server/tests/api/live/live-views.ts
@@ -15,7 +15,6 @@ import {
15 setAccessTokensToServers, 15 setAccessTokensToServers,
16 setDefaultVideoChannel, 16 setDefaultVideoChannel,
17 stopFfmpeg, 17 stopFfmpeg,
18 updateCustomSubConfig,
19 viewVideo, 18 viewVideo,
20 wait, 19 wait,
21 waitJobs, 20 waitJobs,
@@ -36,12 +35,14 @@ describe('Test live', function () {
36 await setAccessTokensToServers(servers) 35 await setAccessTokensToServers(servers)
37 await setDefaultVideoChannel(servers) 36 await setDefaultVideoChannel(servers)
38 37
39 await updateCustomSubConfig(servers[0].url, servers[0].accessToken, { 38 await servers[0].configCommand.updateCustomSubConfig({
40 live: { 39 newConfig: {
41 enabled: true, 40 live: {
42 allowReplay: true, 41 enabled: true,
43 transcoding: { 42 allowReplay: true,
44 enabled: false 43 transcoding: {
44 enabled: false
45 }
45 } 46 }
46 } 47 }
47 }) 48 })
diff --git a/server/tests/api/live/live.ts b/server/tests/api/live/live.ts
index 50397924e..2c3102994 100644
--- a/server/tests/api/live/live.ts
+++ b/server/tests/api/live/live.ts
@@ -34,7 +34,6 @@ import {
34 stopFfmpeg, 34 stopFfmpeg,
35 testFfmpegStreamError, 35 testFfmpegStreamError,
36 testImage, 36 testImage,
37 updateCustomSubConfig,
38 updateLive, 37 updateLive,
39 uploadVideoAndGetId, 38 uploadVideoAndGetId,
40 wait, 39 wait,
@@ -59,12 +58,14 @@ describe('Test live', function () {
59 await setAccessTokensToServers(servers) 58 await setAccessTokensToServers(servers)
60 await setDefaultVideoChannel(servers) 59 await setDefaultVideoChannel(servers)
61 60
62 await updateCustomSubConfig(servers[0].url, servers[0].accessToken, { 61 await servers[0].configCommand.updateCustomSubConfig({
63 live: { 62 newConfig: {
64 enabled: true, 63 live: {
65 allowReplay: true, 64 enabled: true,
66 transcoding: { 65 allowReplay: true,
67 enabled: false 66 transcoding: {
67 enabled: false
68 }
68 } 69 }
69 } 70 }
70 }) 71 })
@@ -422,20 +423,22 @@ describe('Test live', function () {
422 } 423 }
423 424
424 function updateConf (resolutions: number[]) { 425 function updateConf (resolutions: number[]) {
425 return updateCustomSubConfig(servers[0].url, servers[0].accessToken, { 426 return servers[0].configCommand.updateCustomSubConfig({
426 live: { 427 newConfig: {
427 enabled: true, 428 live: {
428 allowReplay: true,
429 maxDuration: -1,
430 transcoding: {
431 enabled: true, 429 enabled: true,
432 resolutions: { 430 allowReplay: true,
433 '240p': resolutions.includes(240), 431 maxDuration: -1,
434 '360p': resolutions.includes(360), 432 transcoding: {
435 '480p': resolutions.includes(480), 433 enabled: true,
436 '720p': resolutions.includes(720), 434 resolutions: {
437 '1080p': resolutions.includes(1080), 435 '240p': resolutions.includes(240),
438 '2160p': resolutions.includes(2160) 436 '360p': resolutions.includes(360),
437 '480p': resolutions.includes(480),
438 '720p': resolutions.includes(720),
439 '1080p': resolutions.includes(1080),
440 '2160p': resolutions.includes(2160)
441 }
439 } 442 }
440 } 443 }
441 } 444 }