aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/live
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-23 11:20:00 +0200
committerChocobozzz <chocobozzz@cpy.re>2021-07-26 11:29:31 +0200
commit764b1a14fc494f2cfd7ea590d2f07b01df65c7ad (patch)
tree198ca5f242c63a205a05fa4cfd6d063277c541fd /server/tests/api/live
parent83903cb65d531a6b6b91715387493ba8312b264d (diff)
downloadPeerTube-764b1a14fc494f2cfd7ea590d2f07b01df65c7ad.tar.gz
PeerTube-764b1a14fc494f2cfd7ea590d2f07b01df65c7ad.tar.zst
PeerTube-764b1a14fc494f2cfd7ea590d2f07b01df65c7ad.zip
Use random names for VOD HLS playlists
Diffstat (limited to 'server/tests/api/live')
-rw-r--r--server/tests/api/live/live-constraints.ts4
-rw-r--r--server/tests/api/live/live-save-replay.ts14
-rw-r--r--server/tests/api/live/live.ts14
3 files changed, 19 insertions, 13 deletions
diff --git a/server/tests/api/live/live-constraints.ts b/server/tests/api/live/live-constraints.ts
index 20346113d..4acde3cc5 100644
--- a/server/tests/api/live/live-constraints.ts
+++ b/server/tests/api/live/live-constraints.ts
@@ -4,7 +4,7 @@ import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { VideoPrivacy } from '@shared/models' 5import { VideoPrivacy } from '@shared/models'
6import { 6import {
7 checkLiveCleanup, 7 checkLiveCleanupAfterSave,
8 cleanupTests, 8 cleanupTests,
9 ConfigCommand, 9 ConfigCommand,
10 createMultipleServers, 10 createMultipleServers,
@@ -43,7 +43,7 @@ describe('Test live constraints', function () {
43 expect(video.duration).to.be.greaterThan(0) 43 expect(video.duration).to.be.greaterThan(0)
44 } 44 }
45 45
46 await checkLiveCleanup(servers[0], videoId, resolutions) 46 await checkLiveCleanupAfterSave(servers[0], videoId, resolutions)
47 } 47 }
48 48
49 async function waitUntilLivePublishedOnAllServers (videoId: string) { 49 async function waitUntilLivePublishedOnAllServers (videoId: string) {
diff --git a/server/tests/api/live/live-save-replay.ts b/server/tests/api/live/live-save-replay.ts
index bd15396ec..8f1fb78a5 100644
--- a/server/tests/api/live/live-save-replay.ts
+++ b/server/tests/api/live/live-save-replay.ts
@@ -4,7 +4,7 @@ import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { FfmpegCommand } from 'fluent-ffmpeg' 5import { FfmpegCommand } from 'fluent-ffmpeg'
6import { 6import {
7 checkLiveCleanup, 7 checkLiveCleanupAfterSave,
8 cleanupTests, 8 cleanupTests,
9 ConfigCommand, 9 ConfigCommand,
10 createMultipleServers, 10 createMultipleServers,
@@ -150,7 +150,7 @@ describe('Save replay setting', function () {
150 await checkVideoState(liveVideoUUID, VideoState.LIVE_ENDED) 150 await checkVideoState(liveVideoUUID, VideoState.LIVE_ENDED)
151 151
152 // No resolutions saved since we did not save replay 152 // No resolutions saved since we did not save replay
153 await checkLiveCleanup(servers[0], liveVideoUUID, []) 153 await checkLiveCleanupAfterSave(servers[0], liveVideoUUID, [])
154 }) 154 })
155 155
156 it('Should correctly terminate the stream on blacklist and delete the live', async function () { 156 it('Should correctly terminate the stream on blacklist and delete the live', async function () {
@@ -179,7 +179,7 @@ describe('Save replay setting', function () {
179 179
180 await wait(5000) 180 await wait(5000)
181 await waitJobs(servers) 181 await waitJobs(servers)
182 await checkLiveCleanup(servers[0], liveVideoUUID, []) 182 await checkLiveCleanupAfterSave(servers[0], liveVideoUUID, [])
183 }) 183 })
184 184
185 it('Should correctly terminate the stream on delete and delete the video', async function () { 185 it('Should correctly terminate the stream on delete and delete the video', async function () {
@@ -203,7 +203,7 @@ describe('Save replay setting', function () {
203 await waitJobs(servers) 203 await waitJobs(servers)
204 204
205 await checkVideosExist(liveVideoUUID, false, HttpStatusCode.NOT_FOUND_404) 205 await checkVideosExist(liveVideoUUID, false, HttpStatusCode.NOT_FOUND_404)
206 await checkLiveCleanup(servers[0], liveVideoUUID, []) 206 await checkLiveCleanupAfterSave(servers[0], liveVideoUUID, [])
207 }) 207 })
208 }) 208 })
209 209
@@ -259,7 +259,7 @@ describe('Save replay setting', function () {
259 }) 259 })
260 260
261 it('Should have cleaned up the live files', async function () { 261 it('Should have cleaned up the live files', async function () {
262 await checkLiveCleanup(servers[0], liveVideoUUID, [ 720 ]) 262 await checkLiveCleanupAfterSave(servers[0], liveVideoUUID, [ 720 ])
263 }) 263 })
264 264
265 it('Should correctly terminate the stream on blacklist and blacklist the saved replay video', async function () { 265 it('Should correctly terminate the stream on blacklist and blacklist the saved replay video', async function () {
@@ -287,7 +287,7 @@ describe('Save replay setting', function () {
287 287
288 await wait(5000) 288 await wait(5000)
289 await waitJobs(servers) 289 await waitJobs(servers)
290 await checkLiveCleanup(servers[0], liveVideoUUID, [ 720 ]) 290 await checkLiveCleanupAfterSave(servers[0], liveVideoUUID, [ 720 ])
291 }) 291 })
292 292
293 it('Should correctly terminate the stream on delete and delete the video', async function () { 293 it('Should correctly terminate the stream on delete and delete the video', async function () {
@@ -310,7 +310,7 @@ describe('Save replay setting', function () {
310 await waitJobs(servers) 310 await waitJobs(servers)
311 311
312 await checkVideosExist(liveVideoUUID, false, HttpStatusCode.NOT_FOUND_404) 312 await checkVideosExist(liveVideoUUID, false, HttpStatusCode.NOT_FOUND_404)
313 await checkLiveCleanup(servers[0], liveVideoUUID, []) 313 await checkLiveCleanupAfterSave(servers[0], liveVideoUUID, [])
314 }) 314 })
315 }) 315 })
316 316
diff --git a/server/tests/api/live/live.ts b/server/tests/api/live/live.ts
index 4676a840a..d555cff19 100644
--- a/server/tests/api/live/live.ts
+++ b/server/tests/api/live/live.ts
@@ -2,10 +2,10 @@
2 2
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { join } from 'path' 5import { basename, join } from 'path'
6import { ffprobePromise, getVideoStreamFromFile } from '@server/helpers/ffprobe-utils' 6import { ffprobePromise, getVideoStreamFromFile } from '@server/helpers/ffprobe-utils'
7import { 7import {
8 checkLiveCleanup, 8 checkLiveCleanupAfterSave,
9 checkLiveSegmentHash, 9 checkLiveSegmentHash,
10 checkResolutionsInMasterPlaylist, 10 checkResolutionsInMasterPlaylist,
11 cleanupTests, 11 cleanupTests,
@@ -506,6 +506,10 @@ describe('Test live', function () {
506 await makeRawRequest(hlsPlaylist.playlistUrl, HttpStatusCode.OK_200) 506 await makeRawRequest(hlsPlaylist.playlistUrl, HttpStatusCode.OK_200)
507 await makeRawRequest(hlsPlaylist.segmentsSha256Url, HttpStatusCode.OK_200) 507 await makeRawRequest(hlsPlaylist.segmentsSha256Url, HttpStatusCode.OK_200)
508 508
509 // We should have generated random filenames
510 expect(basename(hlsPlaylist.playlistUrl)).to.not.equal('master.m3u8')
511 expect(basename(hlsPlaylist.segmentsSha256Url)).to.not.equal('segments-sha256.json')
512
509 expect(hlsPlaylist.files).to.have.lengthOf(resolutions.length) 513 expect(hlsPlaylist.files).to.have.lengthOf(resolutions.length)
510 514
511 for (const resolution of resolutions) { 515 for (const resolution of resolutions) {
@@ -520,7 +524,9 @@ describe('Test live', function () {
520 expect(file.fps).to.be.approximately(30, 2) 524 expect(file.fps).to.be.approximately(30, 2)
521 } 525 }
522 526
523 const filename = `${video.uuid}-${resolution}-fragmented.mp4` 527 const filename = basename(file.fileUrl)
528 expect(filename).to.not.contain(video.uuid)
529
524 const segmentPath = servers[0].servers.buildDirectory(join('streaming-playlists', 'hls', video.uuid, filename)) 530 const segmentPath = servers[0].servers.buildDirectory(join('streaming-playlists', 'hls', video.uuid, filename))
525 531
526 const probe = await ffprobePromise(segmentPath) 532 const probe = await ffprobePromise(segmentPath)
@@ -537,7 +543,7 @@ describe('Test live', function () {
537 it('Should correctly have cleaned up the live files', async function () { 543 it('Should correctly have cleaned up the live files', async function () {
538 this.timeout(30000) 544 this.timeout(30000)
539 545
540 await checkLiveCleanup(servers[0], liveVideoId, [ 240, 360, 720 ]) 546 await checkLiveCleanupAfterSave(servers[0], liveVideoId, [ 240, 360, 720 ])
541 }) 547 })
542 }) 548 })
543 549