diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-23 11:20:00 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2021-07-26 11:29:31 +0200 |
commit | 764b1a14fc494f2cfd7ea590d2f07b01df65c7ad (patch) | |
tree | 198ca5f242c63a205a05fa4cfd6d063277c541fd /server/tests/api/videos | |
parent | 83903cb65d531a6b6b91715387493ba8312b264d (diff) | |
download | PeerTube-764b1a14fc494f2cfd7ea590d2f07b01df65c7ad.tar.gz PeerTube-764b1a14fc494f2cfd7ea590d2f07b01df65c7ad.tar.zst PeerTube-764b1a14fc494f2cfd7ea590d2f07b01df65c7ad.zip |
Use random names for VOD HLS playlists
Diffstat (limited to 'server/tests/api/videos')
-rw-r--r-- | server/tests/api/videos/resumable-upload.ts | 7 | ||||
-rw-r--r-- | server/tests/api/videos/video-hls.ts | 11 |
2 files changed, 12 insertions, 6 deletions
diff --git a/server/tests/api/videos/resumable-upload.ts b/server/tests/api/videos/resumable-upload.ts index c94d92cf2..857859fd3 100644 --- a/server/tests/api/videos/resumable-upload.ts +++ b/server/tests/api/videos/resumable-upload.ts | |||
@@ -170,8 +170,13 @@ describe('Test resumable upload', function () { | |||
170 | 170 | ||
171 | const size = 1000 | 171 | const size = 1000 |
172 | 172 | ||
173 | // Content length check seems to have changed in v16 | ||
174 | const expectedStatus = process.version.startsWith('v16') | ||
175 | ? HttpStatusCode.CONFLICT_409 | ||
176 | : HttpStatusCode.BAD_REQUEST_400 | ||
177 | |||
173 | const contentRangeBuilder = (start: number) => `bytes ${start}-${start + size - 1}/${size}` | 178 | const contentRangeBuilder = (start: number) => `bytes ${start}-${start + size - 1}/${size}` |
174 | await sendChunks({ pathUploadId: uploadId, expectedStatus: HttpStatusCode.CONFLICT_409, contentRangeBuilder, contentLength: size }) | 179 | await sendChunks({ pathUploadId: uploadId, expectedStatus, contentRangeBuilder, contentLength: size }) |
175 | await checkFileSize(uploadId, 0) | 180 | await checkFileSize(uploadId, 0) |
176 | }) | 181 | }) |
177 | }) | 182 | }) |
diff --git a/server/tests/api/videos/video-hls.ts b/server/tests/api/videos/video-hls.ts index 921d7ce64..961f0e617 100644 --- a/server/tests/api/videos/video-hls.ts +++ b/server/tests/api/videos/video-hls.ts | |||
@@ -2,7 +2,8 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { join } from 'path' | 5 | import { basename, join } from 'path' |
6 | import { removeFragmentedMP4Ext, uuidRegex } from '@shared/core-utils' | ||
6 | import { | 7 | import { |
7 | checkDirectoryIsEmpty, | 8 | checkDirectoryIsEmpty, |
8 | checkResolutionsInMasterPlaylist, | 9 | checkResolutionsInMasterPlaylist, |
@@ -19,8 +20,6 @@ import { | |||
19 | } from '@shared/extra-utils' | 20 | } from '@shared/extra-utils' |
20 | import { HttpStatusCode, VideoStreamingPlaylistType } from '@shared/models' | 21 | import { HttpStatusCode, VideoStreamingPlaylistType } from '@shared/models' |
21 | import { DEFAULT_AUDIO_RESOLUTION } from '../../../initializers/constants' | 22 | import { DEFAULT_AUDIO_RESOLUTION } from '../../../initializers/constants' |
22 | import { uuidRegex } from '@shared/core-utils' | ||
23 | import { basename } from 'path/posix' | ||
24 | 23 | ||
25 | const expect = chai.expect | 24 | const expect = chai.expect |
26 | 25 | ||
@@ -78,11 +77,13 @@ async function checkHlsPlaylist (servers: PeerTubeServer[], videoUUID: string, h | |||
78 | // Check resolution playlists | 77 | // Check resolution playlists |
79 | { | 78 | { |
80 | for (const resolution of resolutions) { | 79 | for (const resolution of resolutions) { |
80 | const file = hlsFiles.find(f => f.resolution.id === resolution) | ||
81 | const playlistName = removeFragmentedMP4Ext(basename(file.fileUrl)) + '.m3u8' | ||
82 | |||
81 | const subPlaylist = await server.streamingPlaylists.get({ | 83 | const subPlaylist = await server.streamingPlaylists.get({ |
82 | url: `${baseUrl}/static/streaming-playlists/hls/${videoUUID}/${resolution}.m3u8` | 84 | url: `${baseUrl}/static/streaming-playlists/hls/${videoUUID}/${playlistName}` |
83 | }) | 85 | }) |
84 | 86 | ||
85 | const file = hlsFiles.find(f => f.resolution.id === resolution) | ||
86 | expect(subPlaylist).to.match(new RegExp(`${uuidRegex}-${resolution}-fragmented.mp4`)) | 87 | expect(subPlaylist).to.match(new RegExp(`${uuidRegex}-${resolution}-fragmented.mp4`)) |
87 | expect(subPlaylist).to.contain(basename(file.fileUrl)) | 88 | expect(subPlaylist).to.contain(basename(file.fileUrl)) |
88 | } | 89 | } |