diff options
Diffstat (limited to 'server/tests/plugins/plugin-transcoding.ts')
-rw-r--r-- | server/tests/plugins/plugin-transcoding.ts | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/server/tests/plugins/plugin-transcoding.ts b/server/tests/plugins/plugin-transcoding.ts index a3613293a..3a03065b0 100644 --- a/server/tests/plugins/plugin-transcoding.ts +++ b/server/tests/plugins/plugin-transcoding.ts | |||
@@ -19,17 +19,17 @@ import { VideoPrivacy } from '@shared/models' | |||
19 | async function createLiveWrapper (server: ServerInfo) { | 19 | async function createLiveWrapper (server: ServerInfo) { |
20 | const liveAttributes = { | 20 | const liveAttributes = { |
21 | name: 'live video', | 21 | name: 'live video', |
22 | channelId: server.videoChannel.id, | 22 | channelId: server.store.channel.id, |
23 | privacy: VideoPrivacy.PUBLIC | 23 | privacy: VideoPrivacy.PUBLIC |
24 | } | 24 | } |
25 | 25 | ||
26 | const { uuid } = await server.liveCommand.create({ fields: liveAttributes }) | 26 | const { uuid } = await server.live.create({ fields: liveAttributes }) |
27 | 27 | ||
28 | return uuid | 28 | return uuid |
29 | } | 29 | } |
30 | 30 | ||
31 | function updateConf (server: ServerInfo, vodProfile: string, liveProfile: string) { | 31 | function updateConf (server: ServerInfo, vodProfile: string, liveProfile: string) { |
32 | return server.configCommand.updateCustomSubConfig({ | 32 | return server.config.updateCustomSubConfig({ |
33 | newConfig: { | 33 | newConfig: { |
34 | transcoding: { | 34 | transcoding: { |
35 | enabled: true, | 35 | enabled: true, |
@@ -79,7 +79,7 @@ describe('Test transcoding plugins', function () { | |||
79 | describe('When using a plugin adding profiles to existing encoders', function () { | 79 | describe('When using a plugin adding profiles to existing encoders', function () { |
80 | 80 | ||
81 | async function checkVideoFPS (uuid: string, type: 'above' | 'below', fps: number) { | 81 | async function checkVideoFPS (uuid: string, type: 'above' | 'below', fps: number) { |
82 | const video = await server.videosCommand.get({ id: uuid }) | 82 | const video = await server.videos.get({ id: uuid }) |
83 | const files = video.files.concat(...video.streamingPlaylists.map(p => p.files)) | 83 | const files = video.files.concat(...video.streamingPlaylists.map(p => p.files)) |
84 | 84 | ||
85 | for (const file of files) { | 85 | for (const file of files) { |
@@ -103,11 +103,11 @@ describe('Test transcoding plugins', function () { | |||
103 | } | 103 | } |
104 | 104 | ||
105 | before(async function () { | 105 | before(async function () { |
106 | await server.pluginsCommand.install({ path: PluginsCommand.getPluginTestPath('-transcoding-one') }) | 106 | await server.plugins.install({ path: PluginsCommand.getPluginTestPath('-transcoding-one') }) |
107 | }) | 107 | }) |
108 | 108 | ||
109 | it('Should have the appropriate available profiles', async function () { | 109 | it('Should have the appropriate available profiles', async function () { |
110 | const config = await server.configCommand.getConfig() | 110 | const config = await server.config.getConfig() |
111 | 111 | ||
112 | expect(config.transcoding.availableProfiles).to.have.members([ 'default', 'low-vod', 'input-options-vod', 'bad-scale-vod' ]) | 112 | expect(config.transcoding.availableProfiles).to.have.members([ 'default', 'low-vod', 'input-options-vod', 'bad-scale-vod' ]) |
113 | expect(config.live.transcoding.availableProfiles).to.have.members([ 'default', 'low-live', 'input-options-live', 'bad-scale-live' ]) | 113 | expect(config.live.transcoding.availableProfiles).to.have.members([ 'default', 'low-live', 'input-options-live', 'bad-scale-live' ]) |
@@ -116,7 +116,7 @@ describe('Test transcoding plugins', function () { | |||
116 | it('Should not use the plugin profile if not chosen by the admin', async function () { | 116 | it('Should not use the plugin profile if not chosen by the admin', async function () { |
117 | this.timeout(240000) | 117 | this.timeout(240000) |
118 | 118 | ||
119 | const videoUUID = (await server.videosCommand.quickUpload({ name: 'video' })).uuid | 119 | const videoUUID = (await server.videos.quickUpload({ name: 'video' })).uuid |
120 | await waitJobs([ server ]) | 120 | await waitJobs([ server ]) |
121 | 121 | ||
122 | await checkVideoFPS(videoUUID, 'above', 20) | 122 | await checkVideoFPS(videoUUID, 'above', 20) |
@@ -127,7 +127,7 @@ describe('Test transcoding plugins', function () { | |||
127 | 127 | ||
128 | await updateConf(server, 'low-vod', 'default') | 128 | await updateConf(server, 'low-vod', 'default') |
129 | 129 | ||
130 | const videoUUID = (await server.videosCommand.quickUpload({ name: 'video' })).uuid | 130 | const videoUUID = (await server.videos.quickUpload({ name: 'video' })).uuid |
131 | await waitJobs([ server ]) | 131 | await waitJobs([ server ]) |
132 | 132 | ||
133 | await checkVideoFPS(videoUUID, 'below', 12) | 133 | await checkVideoFPS(videoUUID, 'below', 12) |
@@ -138,7 +138,7 @@ describe('Test transcoding plugins', function () { | |||
138 | 138 | ||
139 | await updateConf(server, 'input-options-vod', 'default') | 139 | await updateConf(server, 'input-options-vod', 'default') |
140 | 140 | ||
141 | const videoUUID = (await server.videosCommand.quickUpload({ name: 'video' })).uuid | 141 | const videoUUID = (await server.videos.quickUpload({ name: 'video' })).uuid |
142 | await waitJobs([ server ]) | 142 | await waitJobs([ server ]) |
143 | 143 | ||
144 | await checkVideoFPS(videoUUID, 'below', 6) | 144 | await checkVideoFPS(videoUUID, 'below', 6) |
@@ -149,11 +149,11 @@ describe('Test transcoding plugins', function () { | |||
149 | 149 | ||
150 | await updateConf(server, 'bad-scale-vod', 'default') | 150 | await updateConf(server, 'bad-scale-vod', 'default') |
151 | 151 | ||
152 | const videoUUID = (await server.videosCommand.quickUpload({ name: 'video' })).uuid | 152 | const videoUUID = (await server.videos.quickUpload({ name: 'video' })).uuid |
153 | await waitJobs([ server ]) | 153 | await waitJobs([ server ]) |
154 | 154 | ||
155 | // Transcoding failed | 155 | // Transcoding failed |
156 | const video = await server.videosCommand.get({ id: videoUUID }) | 156 | const video = await server.videos.get({ id: videoUUID }) |
157 | expect(video.files).to.have.lengthOf(1) | 157 | expect(video.files).to.have.lengthOf(1) |
158 | expect(video.streamingPlaylists).to.have.lengthOf(0) | 158 | expect(video.streamingPlaylists).to.have.lengthOf(0) |
159 | }) | 159 | }) |
@@ -163,8 +163,8 @@ describe('Test transcoding plugins', function () { | |||
163 | 163 | ||
164 | const liveVideoId = await createLiveWrapper(server) | 164 | const liveVideoId = await createLiveWrapper(server) |
165 | 165 | ||
166 | await server.liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short2.webm' }) | 166 | await server.live.sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short2.webm' }) |
167 | await server.liveCommand.waitUntilPublished({ videoId: liveVideoId }) | 167 | await server.live.waitUntilPublished({ videoId: liveVideoId }) |
168 | await waitJobs([ server ]) | 168 | await waitJobs([ server ]) |
169 | 169 | ||
170 | await checkLiveFPS(liveVideoId, 'above', 20) | 170 | await checkLiveFPS(liveVideoId, 'above', 20) |
@@ -177,8 +177,8 @@ describe('Test transcoding plugins', function () { | |||
177 | 177 | ||
178 | const liveVideoId = await createLiveWrapper(server) | 178 | const liveVideoId = await createLiveWrapper(server) |
179 | 179 | ||
180 | await server.liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short2.webm' }) | 180 | await server.live.sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short2.webm' }) |
181 | await server.liveCommand.waitUntilPublished({ videoId: liveVideoId }) | 181 | await server.live.waitUntilPublished({ videoId: liveVideoId }) |
182 | await waitJobs([ server ]) | 182 | await waitJobs([ server ]) |
183 | 183 | ||
184 | await checkLiveFPS(liveVideoId, 'below', 12) | 184 | await checkLiveFPS(liveVideoId, 'below', 12) |
@@ -191,8 +191,8 @@ describe('Test transcoding plugins', function () { | |||
191 | 191 | ||
192 | const liveVideoId = await createLiveWrapper(server) | 192 | const liveVideoId = await createLiveWrapper(server) |
193 | 193 | ||
194 | await server.liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short2.webm' }) | 194 | await server.live.sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short2.webm' }) |
195 | await server.liveCommand.waitUntilPublished({ videoId: liveVideoId }) | 195 | await server.live.waitUntilPublished({ videoId: liveVideoId }) |
196 | await waitJobs([ server ]) | 196 | await waitJobs([ server ]) |
197 | 197 | ||
198 | await checkLiveFPS(liveVideoId, 'below', 6) | 198 | await checkLiveFPS(liveVideoId, 'below', 6) |
@@ -205,21 +205,21 @@ describe('Test transcoding plugins', function () { | |||
205 | 205 | ||
206 | const liveVideoId = await createLiveWrapper(server) | 206 | const liveVideoId = await createLiveWrapper(server) |
207 | 207 | ||
208 | const command = await server.liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short2.webm' }) | 208 | const command = await server.live.sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short2.webm' }) |
209 | await testFfmpegStreamError(command, true) | 209 | await testFfmpegStreamError(command, true) |
210 | }) | 210 | }) |
211 | 211 | ||
212 | it('Should default to the default profile if the specified profile does not exist', async function () { | 212 | it('Should default to the default profile if the specified profile does not exist', async function () { |
213 | this.timeout(240000) | 213 | this.timeout(240000) |
214 | 214 | ||
215 | await server.pluginsCommand.uninstall({ npmName: 'peertube-plugin-test-transcoding-one' }) | 215 | await server.plugins.uninstall({ npmName: 'peertube-plugin-test-transcoding-one' }) |
216 | 216 | ||
217 | const config = await server.configCommand.getConfig() | 217 | const config = await server.config.getConfig() |
218 | 218 | ||
219 | expect(config.transcoding.availableProfiles).to.deep.equal([ 'default' ]) | 219 | expect(config.transcoding.availableProfiles).to.deep.equal([ 'default' ]) |
220 | expect(config.live.transcoding.availableProfiles).to.deep.equal([ 'default' ]) | 220 | expect(config.live.transcoding.availableProfiles).to.deep.equal([ 'default' ]) |
221 | 221 | ||
222 | const videoUUID = (await server.videosCommand.quickUpload({ name: 'video' })).uuid | 222 | const videoUUID = (await server.videos.quickUpload({ name: 'video' })).uuid |
223 | await waitJobs([ server ]) | 223 | await waitJobs([ server ]) |
224 | 224 | ||
225 | await checkVideoFPS(videoUUID, 'above', 20) | 225 | await checkVideoFPS(videoUUID, 'above', 20) |
@@ -230,7 +230,7 @@ describe('Test transcoding plugins', function () { | |||
230 | describe('When using a plugin adding new encoders', function () { | 230 | describe('When using a plugin adding new encoders', function () { |
231 | 231 | ||
232 | before(async function () { | 232 | before(async function () { |
233 | await server.pluginsCommand.install({ path: PluginsCommand.getPluginTestPath('-transcoding-two') }) | 233 | await server.plugins.install({ path: PluginsCommand.getPluginTestPath('-transcoding-two') }) |
234 | 234 | ||
235 | await updateConf(server, 'test-vod-profile', 'test-live-profile') | 235 | await updateConf(server, 'test-vod-profile', 'test-live-profile') |
236 | }) | 236 | }) |
@@ -238,10 +238,10 @@ describe('Test transcoding plugins', function () { | |||
238 | it('Should use the new vod encoders', async function () { | 238 | it('Should use the new vod encoders', async function () { |
239 | this.timeout(240000) | 239 | this.timeout(240000) |
240 | 240 | ||
241 | const videoUUID = (await server.videosCommand.quickUpload({ name: 'video', fixture: 'video_short_240p.mp4' })).uuid | 241 | const videoUUID = (await server.videos.quickUpload({ name: 'video', fixture: 'video_short_240p.mp4' })).uuid |
242 | await waitJobs([ server ]) | 242 | await waitJobs([ server ]) |
243 | 243 | ||
244 | const path = server.serversCommand.buildDirectory(join('videos', videoUUID + '-240.mp4')) | 244 | const path = server.servers.buildDirectory(join('videos', videoUUID + '-240.mp4')) |
245 | const audioProbe = await getAudioStream(path) | 245 | const audioProbe = await getAudioStream(path) |
246 | expect(audioProbe.audioStream.codec_name).to.equal('opus') | 246 | expect(audioProbe.audioStream.codec_name).to.equal('opus') |
247 | 247 | ||
@@ -254,8 +254,8 @@ describe('Test transcoding plugins', function () { | |||
254 | 254 | ||
255 | const liveVideoId = await createLiveWrapper(server) | 255 | const liveVideoId = await createLiveWrapper(server) |
256 | 256 | ||
257 | await server.liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short2.webm' }) | 257 | await server.live.sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short2.webm' }) |
258 | await server.liveCommand.waitUntilPublished({ videoId: liveVideoId }) | 258 | await server.live.waitUntilPublished({ videoId: liveVideoId }) |
259 | await waitJobs([ server ]) | 259 | await waitJobs([ server ]) |
260 | 260 | ||
261 | const playlistUrl = `${server.url}/static/streaming-playlists/hls/${liveVideoId}/0.m3u8` | 261 | const playlistUrl = `${server.url}/static/streaming-playlists/hls/${liveVideoId}/0.m3u8` |