diff options
author | Chocobozzz <me@florianbigard.com> | 2021-05-27 16:12:41 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-05-27 16:12:41 +0200 |
commit | 8f608a4cb22ab232cfab20665050764b38bac9c7 (patch) | |
tree | 6a6785aae79bf5939ad7b7a50a1bd8031268d2b4 /server/tests/api/live | |
parent | 030ccfce59a8cb8f2fee6ea8dd363ba635c5c5c2 (diff) | |
parent | c215e627b575d2c4085ccb222f4ca8d0237b7552 (diff) | |
download | PeerTube-8f608a4cb22ab232cfab20665050764b38bac9c7.tar.gz PeerTube-8f608a4cb22ab232cfab20665050764b38bac9c7.tar.zst PeerTube-8f608a4cb22ab232cfab20665050764b38bac9c7.zip |
Merge branch 'develop' into shorter-URLs-channels-accounts
Diffstat (limited to 'server/tests/api/live')
-rw-r--r-- | server/tests/api/live/live-constraints.ts | 70 | ||||
-rw-r--r-- | server/tests/api/live/live-permanent.ts | 21 | ||||
-rw-r--r-- | server/tests/api/live/live-save-replay.ts | 11 |
3 files changed, 27 insertions, 75 deletions
diff --git a/server/tests/api/live/live-constraints.ts b/server/tests/api/live/live-constraints.ts index 5569e6066..cc635de33 100644 --- a/server/tests/api/live/live-constraints.ts +++ b/server/tests/api/live/live-constraints.ts | |||
@@ -2,15 +2,15 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { User, VideoDetails, VideoPrivacy } from '@shared/models' | 5 | import { VideoDetails, VideoPrivacy } from '@shared/models' |
6 | import { | 6 | import { |
7 | checkLiveCleanup, | 7 | checkLiveCleanup, |
8 | cleanupTests, | 8 | cleanupTests, |
9 | createLive, | 9 | createLive, |
10 | createUser, | ||
11 | doubleFollow, | 10 | doubleFollow, |
12 | flushAndRunMultipleServers, | 11 | flushAndRunMultipleServers, |
13 | getMyUserInformation, | 12 | generateUser, |
13 | getCustomConfigResolutions, | ||
14 | getVideo, | 14 | getVideo, |
15 | runAndTestFfmpegStreamError, | 15 | runAndTestFfmpegStreamError, |
16 | ServerInfo, | 16 | ServerInfo, |
@@ -18,7 +18,6 @@ import { | |||
18 | setDefaultVideoChannel, | 18 | setDefaultVideoChannel, |
19 | updateCustomSubConfig, | 19 | updateCustomSubConfig, |
20 | updateUser, | 20 | updateUser, |
21 | userLogin, | ||
22 | wait, | 21 | wait, |
23 | waitJobs, | 22 | waitJobs, |
24 | waitUntilLivePublished | 23 | waitUntilLivePublished |
@@ -62,6 +61,16 @@ describe('Test live constraints', function () { | |||
62 | } | 61 | } |
63 | } | 62 | } |
64 | 63 | ||
64 | function updateQuota (options: { total: number, daily: number }) { | ||
65 | return updateUser({ | ||
66 | url: servers[0].url, | ||
67 | accessToken: servers[0].accessToken, | ||
68 | userId, | ||
69 | videoQuota: options.total, | ||
70 | videoQuotaDaily: options.daily | ||
71 | }) | ||
72 | } | ||
73 | |||
65 | before(async function () { | 74 | before(async function () { |
66 | this.timeout(120000) | 75 | this.timeout(120000) |
67 | 76 | ||
@@ -82,27 +91,12 @@ describe('Test live constraints', function () { | |||
82 | }) | 91 | }) |
83 | 92 | ||
84 | { | 93 | { |
85 | const user = { username: 'user1', password: 'superpassword' } | 94 | const res = await generateUser(servers[0], 'user1') |
86 | const res = await createUser({ | 95 | userId = res.userId |
87 | url: servers[0].url, | 96 | userChannelId = res.userChannelId |
88 | accessToken: servers[0].accessToken, | 97 | userAccessToken = res.token |
89 | username: user.username, | 98 | |
90 | password: user.password | 99 | await updateQuota({ total: 1, daily: -1 }) |
91 | }) | ||
92 | userId = res.body.user.id | ||
93 | |||
94 | userAccessToken = await userLogin(servers[0], user) | ||
95 | |||
96 | const resMe = await getMyUserInformation(servers[0].url, userAccessToken) | ||
97 | userChannelId = (resMe.body as User).videoChannels[0].id | ||
98 | |||
99 | await updateUser({ | ||
100 | url: servers[0].url, | ||
101 | userId, | ||
102 | accessToken: servers[0].accessToken, | ||
103 | videoQuota: 1, | ||
104 | videoQuotaDaily: -1 | ||
105 | }) | ||
106 | } | 100 | } |
107 | 101 | ||
108 | // Server 1 and server 2 follow each other | 102 | // Server 1 and server 2 follow each other |
@@ -137,13 +131,7 @@ describe('Test live constraints', function () { | |||
137 | // Wait for user quota memoize cache invalidation | 131 | // Wait for user quota memoize cache invalidation |
138 | await wait(5000) | 132 | await wait(5000) |
139 | 133 | ||
140 | await updateUser({ | 134 | await updateQuota({ total: -1, daily: 1 }) |
141 | url: servers[0].url, | ||
142 | userId, | ||
143 | accessToken: servers[0].accessToken, | ||
144 | videoQuota: -1, | ||
145 | videoQuotaDaily: 1 | ||
146 | }) | ||
147 | 135 | ||
148 | const userVideoLiveoId = await createLiveWrapper(true) | 136 | const userVideoLiveoId = await createLiveWrapper(true) |
149 | await runAndTestFfmpegStreamError(servers[0].url, userAccessToken, userVideoLiveoId, true) | 137 | await runAndTestFfmpegStreamError(servers[0].url, userAccessToken, userVideoLiveoId, true) |
@@ -160,13 +148,7 @@ describe('Test live constraints', function () { | |||
160 | // Wait for user quota memoize cache invalidation | 148 | // Wait for user quota memoize cache invalidation |
161 | await wait(5000) | 149 | await wait(5000) |
162 | 150 | ||
163 | await updateUser({ | 151 | await updateQuota({ total: 10 * 1000 * 1000, daily: -1 }) |
164 | url: servers[0].url, | ||
165 | userId, | ||
166 | accessToken: servers[0].accessToken, | ||
167 | videoQuota: 10 * 1000 * 1000, | ||
168 | videoQuotaDaily: -1 | ||
169 | }) | ||
170 | 152 | ||
171 | const userVideoLiveoId = await createLiveWrapper(true) | 153 | const userVideoLiveoId = await createLiveWrapper(true) |
172 | await runAndTestFfmpegStreamError(servers[0].url, userAccessToken, userVideoLiveoId, false) | 154 | await runAndTestFfmpegStreamError(servers[0].url, userAccessToken, userVideoLiveoId, false) |
@@ -182,15 +164,7 @@ describe('Test live constraints', function () { | |||
182 | maxDuration: 1, | 164 | maxDuration: 1, |
183 | transcoding: { | 165 | transcoding: { |
184 | enabled: true, | 166 | enabled: true, |
185 | resolutions: { | 167 | resolutions: getCustomConfigResolutions(true) |
186 | '240p': true, | ||
187 | '360p': true, | ||
188 | '480p': true, | ||
189 | '720p': true, | ||
190 | '1080p': true, | ||
191 | '1440p': true, | ||
192 | '2160p': true | ||
193 | } | ||
194 | } | 168 | } |
195 | } | 169 | } |
196 | }) | 170 | }) |
diff --git a/server/tests/api/live/live-permanent.ts b/server/tests/api/live/live-permanent.ts index a5bda009f..d52e8c7e4 100644 --- a/server/tests/api/live/live-permanent.ts +++ b/server/tests/api/live/live-permanent.ts | |||
@@ -8,6 +8,7 @@ import { | |||
8 | createLive, | 8 | createLive, |
9 | doubleFollow, | 9 | doubleFollow, |
10 | flushAndRunMultipleServers, | 10 | flushAndRunMultipleServers, |
11 | getCustomConfigResolutions, | ||
11 | getLive, | 12 | getLive, |
12 | getPlaylistsCount, | 13 | getPlaylistsCount, |
13 | getVideo, | 14 | getVideo, |
@@ -69,15 +70,7 @@ describe('Permenant live', function () { | |||
69 | maxDuration: -1, | 70 | maxDuration: -1, |
70 | transcoding: { | 71 | transcoding: { |
71 | enabled: true, | 72 | enabled: true, |
72 | resolutions: { | 73 | resolutions: getCustomConfigResolutions(true) |
73 | '240p': true, | ||
74 | '360p': true, | ||
75 | '480p': true, | ||
76 | '720p': true, | ||
77 | '1080p': true, | ||
78 | '1440p': true, | ||
79 | '2160p': true | ||
80 | } | ||
81 | } | 74 | } |
82 | } | 75 | } |
83 | }) | 76 | }) |
@@ -159,15 +152,7 @@ describe('Permenant live', function () { | |||
159 | maxDuration: -1, | 152 | maxDuration: -1, |
160 | transcoding: { | 153 | transcoding: { |
161 | enabled: true, | 154 | enabled: true, |
162 | resolutions: { | 155 | resolutions: getCustomConfigResolutions(false) |
163 | '240p': false, | ||
164 | '360p': false, | ||
165 | '480p': false, | ||
166 | '720p': false, | ||
167 | '1080p': false, | ||
168 | '1440p': false, | ||
169 | '2160p': false | ||
170 | } | ||
171 | } | 156 | } |
172 | } | 157 | } |
173 | }) | 158 | }) |
diff --git a/server/tests/api/live/live-save-replay.ts b/server/tests/api/live/live-save-replay.ts index 61c8e74dd..3d4736c8f 100644 --- a/server/tests/api/live/live-save-replay.ts +++ b/server/tests/api/live/live-save-replay.ts | |||
@@ -12,6 +12,7 @@ import { | |||
12 | createLive, | 12 | createLive, |
13 | doubleFollow, | 13 | doubleFollow, |
14 | flushAndRunMultipleServers, | 14 | flushAndRunMultipleServers, |
15 | getCustomConfigResolutions, | ||
15 | getVideo, | 16 | getVideo, |
16 | getVideosList, | 17 | getVideosList, |
17 | removeVideo, | 18 | removeVideo, |
@@ -108,15 +109,7 @@ describe('Save replay setting', function () { | |||
108 | maxDuration: -1, | 109 | maxDuration: -1, |
109 | transcoding: { | 110 | transcoding: { |
110 | enabled: false, | 111 | enabled: false, |
111 | resolutions: { | 112 | resolutions: getCustomConfigResolutions(true) |
112 | '240p': true, | ||
113 | '360p': true, | ||
114 | '480p': true, | ||
115 | '720p': true, | ||
116 | '1080p': true, | ||
117 | '1440p': true, | ||
118 | '2160p': true | ||
119 | } | ||
120 | } | 113 | } |
121 | } | 114 | } |
122 | }) | 115 | }) |