aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-09 10:21:10 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:18 +0200
commit57f879a540551c3b958b0991c8e1e3657a4481d8 (patch)
treecd9283dec9ef0b7fee116c93c36650de188ad892 /server/tests
parent6910f20f114b5bd020258a3a9a3f2117819a60c2 (diff)
downloadPeerTube-57f879a540551c3b958b0991c8e1e3657a4481d8.tar.gz
PeerTube-57f879a540551c3b958b0991c8e1e3657a4481d8.tar.zst
PeerTube-57f879a540551c3b958b0991c8e1e3657a4481d8.zip
Introduce streaming playlists command
Diffstat (limited to 'server/tests')
-rw-r--r--server/tests/api/live/live.ts16
-rw-r--r--server/tests/api/redundancy/redundancy.ts2
-rw-r--r--server/tests/api/videos/video-hls.ts20
3 files changed, 25 insertions, 13 deletions
diff --git a/server/tests/api/live/live.ts b/server/tests/api/live/live.ts
index cb52e4431..0b06df44c 100644
--- a/server/tests/api/live/live.ts
+++ b/server/tests/api/live/live.ts
@@ -15,7 +15,6 @@ import {
15 doubleFollow, 15 doubleFollow,
16 flushAndRunMultipleServers, 16 flushAndRunMultipleServers,
17 getMyVideosWithFilter, 17 getMyVideosWithFilter,
18 getPlaylist,
19 getVideo, 18 getVideo,
20 getVideosList, 19 getVideosList,
21 getVideosWithFilters, 20 getVideosWithFilters,
@@ -397,20 +396,27 @@ describe('Test live', function () {
397 // Only finite files are displayed 396 // Only finite files are displayed
398 expect(hlsPlaylist.files).to.have.lengthOf(0) 397 expect(hlsPlaylist.files).to.have.lengthOf(0)
399 398
400 await checkResolutionsInMasterPlaylist(hlsPlaylist.playlistUrl, resolutions) 399 await checkResolutionsInMasterPlaylist({ server, playlistUrl: hlsPlaylist.playlistUrl, resolutions })
401 400
402 for (let i = 0; i < resolutions.length; i++) { 401 for (let i = 0; i < resolutions.length; i++) {
403 const segmentNum = 3 402 const segmentNum = 3
404 const segmentName = `${i}-00000${segmentNum}.ts` 403 const segmentName = `${i}-00000${segmentNum}.ts`
405 await commands[0].waitUntilSegmentGeneration({ videoUUID: video.uuid, resolution: i, segment: segmentNum }) 404 await commands[0].waitUntilSegmentGeneration({ videoUUID: video.uuid, resolution: i, segment: segmentNum })
406 405
407 const res = await getPlaylist(`${servers[0].url}/static/streaming-playlists/hls/${video.uuid}/${i}.m3u8`) 406 const subPlaylist = await servers[0].streamingPlaylistsCommand.get({
408 const subPlaylist = res.text 407 url: `${servers[0].url}/static/streaming-playlists/hls/${video.uuid}/${i}.m3u8`
408 })
409 409
410 expect(subPlaylist).to.contain(segmentName) 410 expect(subPlaylist).to.contain(segmentName)
411 411
412 const baseUrlAndPath = servers[0].url + '/static/streaming-playlists/hls' 412 const baseUrlAndPath = servers[0].url + '/static/streaming-playlists/hls'
413 await checkLiveSegmentHash(baseUrlAndPath, video.uuid, segmentName, hlsPlaylist) 413 await checkLiveSegmentHash({
414 server,
415 baseUrlSegment: baseUrlAndPath,
416 videoUUID: video.uuid,
417 segmentName,
418 hlsPlaylist
419 })
414 } 420 }
415 } 421 }
416 } 422 }
diff --git a/server/tests/api/redundancy/redundancy.ts b/server/tests/api/redundancy/redundancy.ts
index e4ea99de6..d20cb80f1 100644
--- a/server/tests/api/redundancy/redundancy.ts
+++ b/server/tests/api/redundancy/redundancy.ts
@@ -203,7 +203,7 @@ async function check1PlaylistRedundancies (videoUUID?: string) {
203 const hlsPlaylist = (res.body as VideoDetails).streamingPlaylists[0] 203 const hlsPlaylist = (res.body as VideoDetails).streamingPlaylists[0]
204 204
205 for (const resolution of [ 240, 360, 480, 720 ]) { 205 for (const resolution of [ 240, 360, 480, 720 ]) {
206 await checkSegmentHash(baseUrlPlaylist, baseUrlSegment, videoUUID, resolution, hlsPlaylist) 206 await checkSegmentHash({ server: servers[1], baseUrlPlaylist, baseUrlSegment, videoUUID, resolution, hlsPlaylist })
207 } 207 }
208 208
209 const directories = [ 209 const directories = [
diff --git a/server/tests/api/videos/video-hls.ts b/server/tests/api/videos/video-hls.ts
index 3821cfed0..3dd8c9066 100644
--- a/server/tests/api/videos/video-hls.ts
+++ b/server/tests/api/videos/video-hls.ts
@@ -12,7 +12,6 @@ import {
12 cleanupTests, 12 cleanupTests,
13 doubleFollow, 13 doubleFollow,
14 flushAndRunMultipleServers, 14 flushAndRunMultipleServers,
15 getPlaylist,
16 getVideo, 15 getVideo,
17 makeRawRequest, 16 makeRawRequest,
18 removeVideo, 17 removeVideo,
@@ -67,10 +66,9 @@ async function checkHlsPlaylist (servers: ServerInfo[], videoUUID: string, hlsOn
67 } 66 }
68 67
69 { 68 {
70 await checkResolutionsInMasterPlaylist(hlsPlaylist.playlistUrl, resolutions) 69 await checkResolutionsInMasterPlaylist({ server, playlistUrl: hlsPlaylist.playlistUrl, resolutions })
71 70
72 const res = await getPlaylist(hlsPlaylist.playlistUrl) 71 const masterPlaylist = await server.streamingPlaylistsCommand.get({ url: hlsPlaylist.playlistUrl })
73 const masterPlaylist = res.text
74 72
75 for (const resolution of resolutions) { 73 for (const resolution of resolutions) {
76 expect(masterPlaylist).to.contain(`${resolution}.m3u8`) 74 expect(masterPlaylist).to.contain(`${resolution}.m3u8`)
@@ -80,9 +78,10 @@ async function checkHlsPlaylist (servers: ServerInfo[], videoUUID: string, hlsOn
80 78
81 { 79 {
82 for (const resolution of resolutions) { 80 for (const resolution of resolutions) {
83 const res = await getPlaylist(`${baseUrl}/static/streaming-playlists/hls/${videoUUID}/${resolution}.m3u8`) 81 const subPlaylist = await server.streamingPlaylistsCommand.get({
82 url: `${baseUrl}/static/streaming-playlists/hls/${videoUUID}/${resolution}.m3u8`
83 })
84 84
85 const subPlaylist = res.text
86 expect(subPlaylist).to.contain(`${videoUUID}-${resolution}-fragmented.mp4`) 85 expect(subPlaylist).to.contain(`${videoUUID}-${resolution}-fragmented.mp4`)
87 } 86 }
88 } 87 }
@@ -91,7 +90,14 @@ async function checkHlsPlaylist (servers: ServerInfo[], videoUUID: string, hlsOn
91 const baseUrlAndPath = baseUrl + '/static/streaming-playlists/hls' 90 const baseUrlAndPath = baseUrl + '/static/streaming-playlists/hls'
92 91
93 for (const resolution of resolutions) { 92 for (const resolution of resolutions) {
94 await checkSegmentHash(baseUrlAndPath, baseUrlAndPath, videoUUID, resolution, hlsPlaylist) 93 await checkSegmentHash({
94 server,
95 baseUrlPlaylist: baseUrlAndPath,
96 baseUrlSegment: baseUrlAndPath,
97 videoUUID,
98 resolution,
99 hlsPlaylist
100 })
95 } 101 }
96 } 102 }
97 } 103 }