X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fapi%2Fvideos%2Fvideo-hls.ts;h=22031c18bf0f61e84a457d2e0ee2c442298c431c;hb=da3a3ab6829107b3ed7f18dda42648dfde41871d;hp=71d863b127630fcb38d15472fe1d5f5715f0ef08;hpb=092092969633bbcf6d4891a083ea497a7d5c3154;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/api/videos/video-hls.ts b/server/tests/api/videos/video-hls.ts index 71d863b12..22031c18b 100644 --- a/server/tests/api/videos/video-hls.ts +++ b/server/tests/api/videos/video-hls.ts @@ -4,13 +4,12 @@ import * as chai from 'chai' import 'mocha' import { checkDirectoryIsEmpty, - checkTmpIsEmpty, + checkSegmentHash, + checkTmpIsEmpty, cleanupTests, doubleFollow, flushAndRunMultipleServers, flushTests, getPlaylist, - getSegment, - getSegmentSha256, getVideo, killallServers, removeVideo, @@ -19,10 +18,9 @@ import { updateVideo, uploadVideo, waitJobs -} from '../../../../shared/utils' +} from '../../../../shared/extra-utils' import { VideoDetails } from '../../../../shared/models/videos' import { VideoStreamingPlaylistType } from '../../../../shared/models/videos/video-streaming-playlist.type' -import { sha256 } from '../../../helpers/core-utils' import { join } from 'path' const expect = chai.expect @@ -53,22 +51,18 @@ async function checkHlsPlaylist (servers: ServerInfo[], videoUUID: string) { { for (const resolution of resolutions) { - const res2 = await getPlaylist(`http://localhost:9001/static/playlists/hls/${videoUUID}/${resolution}.m3u8`) + const res2 = await getPlaylist(`http://localhost:9001/static/streaming-playlists/hls/${videoUUID}/${resolution}.m3u8`) const subPlaylist = res2.text - expect(subPlaylist).to.contain(resolution + '_000.ts') + expect(subPlaylist).to.contain(`${videoUUID}-${resolution}-fragmented.mp4`) } } { - for (const resolution of resolutions) { - - const res2 = await getSegment(`http://localhost:9001/static/playlists/hls/${videoUUID}/${resolution}_000.ts`) - - const resSha = await getSegmentSha256(hlsPlaylist.segmentsSha256Url) + const baseUrl = 'http://localhost:9001/static/streaming-playlists/hls' - const sha256Server = resSha.body[ resolution + '_000.ts' ] - expect(sha256(res2.body)).to.equal(sha256Server) + for (const resolution of resolutions) { + await checkSegmentHash(baseUrl, baseUrl, videoUUID, resolution, hlsPlaylist) } } } @@ -124,7 +118,7 @@ describe('Test HLS videos', function () { it('Should have the playlists/segment deleted from the disk', async function () { for (const server of servers) { await checkDirectoryIsEmpty(server, 'videos') - await checkDirectoryIsEmpty(server, join('playlists', 'hls')) + await checkDirectoryIsEmpty(server, join('streaming-playlists', 'hls')) } }) @@ -135,11 +129,6 @@ describe('Test HLS videos', function () { }) after(async function () { - killallServers(servers) - - // Keep the logs if the test failed - if (this['ok']) { - await flushTests() - } + await cleanupTests(servers) }) })