From 57f879a540551c3b958b0991c8e1e3657a4481d8 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 9 Jul 2021 10:21:10 +0200 Subject: Introduce streaming playlists command --- server/tests/api/live/live.ts | 16 +++++++++++----- server/tests/api/redundancy/redundancy.ts | 2 +- server/tests/api/videos/video-hls.ts | 20 +++++++++++++------- 3 files changed, 25 insertions(+), 13 deletions(-) (limited to 'server/tests/api') 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 { doubleFollow, flushAndRunMultipleServers, getMyVideosWithFilter, - getPlaylist, getVideo, getVideosList, getVideosWithFilters, @@ -397,20 +396,27 @@ describe('Test live', function () { // Only finite files are displayed expect(hlsPlaylist.files).to.have.lengthOf(0) - await checkResolutionsInMasterPlaylist(hlsPlaylist.playlistUrl, resolutions) + await checkResolutionsInMasterPlaylist({ server, playlistUrl: hlsPlaylist.playlistUrl, resolutions }) for (let i = 0; i < resolutions.length; i++) { const segmentNum = 3 const segmentName = `${i}-00000${segmentNum}.ts` await commands[0].waitUntilSegmentGeneration({ videoUUID: video.uuid, resolution: i, segment: segmentNum }) - const res = await getPlaylist(`${servers[0].url}/static/streaming-playlists/hls/${video.uuid}/${i}.m3u8`) - const subPlaylist = res.text + const subPlaylist = await servers[0].streamingPlaylistsCommand.get({ + url: `${servers[0].url}/static/streaming-playlists/hls/${video.uuid}/${i}.m3u8` + }) expect(subPlaylist).to.contain(segmentName) const baseUrlAndPath = servers[0].url + '/static/streaming-playlists/hls' - await checkLiveSegmentHash(baseUrlAndPath, video.uuid, segmentName, hlsPlaylist) + await checkLiveSegmentHash({ + server, + baseUrlSegment: baseUrlAndPath, + videoUUID: video.uuid, + segmentName, + hlsPlaylist + }) } } } 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) { const hlsPlaylist = (res.body as VideoDetails).streamingPlaylists[0] for (const resolution of [ 240, 360, 480, 720 ]) { - await checkSegmentHash(baseUrlPlaylist, baseUrlSegment, videoUUID, resolution, hlsPlaylist) + await checkSegmentHash({ server: servers[1], baseUrlPlaylist, baseUrlSegment, videoUUID, resolution, hlsPlaylist }) } 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 { cleanupTests, doubleFollow, flushAndRunMultipleServers, - getPlaylist, getVideo, makeRawRequest, removeVideo, @@ -67,10 +66,9 @@ async function checkHlsPlaylist (servers: ServerInfo[], videoUUID: string, hlsOn } { - await checkResolutionsInMasterPlaylist(hlsPlaylist.playlistUrl, resolutions) + await checkResolutionsInMasterPlaylist({ server, playlistUrl: hlsPlaylist.playlistUrl, resolutions }) - const res = await getPlaylist(hlsPlaylist.playlistUrl) - const masterPlaylist = res.text + const masterPlaylist = await server.streamingPlaylistsCommand.get({ url: hlsPlaylist.playlistUrl }) for (const resolution of resolutions) { expect(masterPlaylist).to.contain(`${resolution}.m3u8`) @@ -80,9 +78,10 @@ async function checkHlsPlaylist (servers: ServerInfo[], videoUUID: string, hlsOn { for (const resolution of resolutions) { - const res = await getPlaylist(`${baseUrl}/static/streaming-playlists/hls/${videoUUID}/${resolution}.m3u8`) + const subPlaylist = await server.streamingPlaylistsCommand.get({ + url: `${baseUrl}/static/streaming-playlists/hls/${videoUUID}/${resolution}.m3u8` + }) - const subPlaylist = res.text expect(subPlaylist).to.contain(`${videoUUID}-${resolution}-fragmented.mp4`) } } @@ -91,7 +90,14 @@ async function checkHlsPlaylist (servers: ServerInfo[], videoUUID: string, hlsOn const baseUrlAndPath = baseUrl + '/static/streaming-playlists/hls' for (const resolution of resolutions) { - await checkSegmentHash(baseUrlAndPath, baseUrlAndPath, videoUUID, resolution, hlsPlaylist) + await checkSegmentHash({ + server, + baseUrlPlaylist: baseUrlAndPath, + baseUrlSegment: baseUrlAndPath, + videoUUID, + resolution, + hlsPlaylist + }) } } } -- cgit v1.2.3