diff options
author | Chocobozzz <me@florianbigard.com> | 2023-09-01 16:47:25 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-09-01 16:47:25 +0200 |
commit | 1022e273092f539c0b77a5cf6411b06c74fd15e5 (patch) | |
tree | 8262362875fa5abb6bfc586123f03228aa64471e /packages/tests/src/api/live | |
parent | a1d93180668a265d5f7bc595e8e864db10e356b6 (diff) | |
download | PeerTube-1022e273092f539c0b77a5cf6411b06c74fd15e5.tar.gz PeerTube-1022e273092f539c0b77a5cf6411b06c74fd15e5.tar.zst PeerTube-1022e273092f539c0b77a5cf6411b06c74fd15e5.zip |
Fix live replay privacy change
Diffstat (limited to 'packages/tests/src/api/live')
-rw-r--r-- | packages/tests/src/api/live/index.ts | 1 | ||||
-rw-r--r-- | packages/tests/src/api/live/live-privacy-update.ts | 83 |
2 files changed, 84 insertions, 0 deletions
diff --git a/packages/tests/src/api/live/index.ts b/packages/tests/src/api/live/index.ts index e61e6c611..bb5177d95 100644 --- a/packages/tests/src/api/live/index.ts +++ b/packages/tests/src/api/live/index.ts | |||
@@ -1,6 +1,7 @@ | |||
1 | import './live-constraints.js' | 1 | import './live-constraints.js' |
2 | import './live-fast-restream.js' | 2 | import './live-fast-restream.js' |
3 | import './live-socket-messages.js' | 3 | import './live-socket-messages.js' |
4 | import './live-privacy-update.js' | ||
4 | import './live-permanent.js' | 5 | import './live-permanent.js' |
5 | import './live-rtmps.js' | 6 | import './live-rtmps.js' |
6 | import './live-save-replay.js' | 7 | import './live-save-replay.js' |
diff --git a/packages/tests/src/api/live/live-privacy-update.ts b/packages/tests/src/api/live/live-privacy-update.ts new file mode 100644 index 000000000..ff12ff3e3 --- /dev/null +++ b/packages/tests/src/api/live/live-privacy-update.ts | |||
@@ -0,0 +1,83 @@ | |||
1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ | ||
2 | |||
3 | import { HttpStatusCode, LiveVideoCreate, VideoPrivacy } from '@peertube/peertube-models' | ||
4 | import { | ||
5 | cleanupTests, createSingleServer, makeRawRequest, | ||
6 | PeerTubeServer, | ||
7 | setAccessTokensToServers, | ||
8 | setDefaultVideoChannel, | ||
9 | stopFfmpeg, | ||
10 | waitJobs, | ||
11 | waitUntilLivePublishedOnAllServers, | ||
12 | waitUntilLiveReplacedByReplayOnAllServers | ||
13 | } from '@peertube/peertube-server-commands' | ||
14 | |||
15 | async function testVideoFiles (server: PeerTubeServer, uuid: string) { | ||
16 | const video = await server.videos.getWithToken({ id: uuid }) | ||
17 | |||
18 | const expectedStatus = HttpStatusCode.OK_200 | ||
19 | |||
20 | await makeRawRequest({ url: video.streamingPlaylists[0].playlistUrl, token: server.accessToken, expectedStatus }) | ||
21 | await makeRawRequest({ url: video.streamingPlaylists[0].segmentsSha256Url, token: server.accessToken, expectedStatus }) | ||
22 | } | ||
23 | |||
24 | describe('Live privacy update', function () { | ||
25 | let server: PeerTubeServer | ||
26 | |||
27 | before(async function () { | ||
28 | this.timeout(120000) | ||
29 | |||
30 | server = await createSingleServer(1) | ||
31 | |||
32 | await setAccessTokensToServers([ server ]) | ||
33 | await setDefaultVideoChannel([ server ]) | ||
34 | |||
35 | await server.config.enableMinimumTranscoding() | ||
36 | await server.config.enableLive({ allowReplay: true, transcoding: true, resolutions: 'min' }) | ||
37 | }) | ||
38 | |||
39 | describe('Normal live', function () { | ||
40 | let uuid: string | ||
41 | |||
42 | it('Should create a public live with private replay', async function () { | ||
43 | this.timeout(120000) | ||
44 | |||
45 | const fields: LiveVideoCreate = { | ||
46 | name: 'live', | ||
47 | privacy: VideoPrivacy.PUBLIC, | ||
48 | permanentLive: false, | ||
49 | replaySettings: { privacy: VideoPrivacy.PRIVATE }, | ||
50 | saveReplay: true, | ||
51 | channelId: server.store.channel.id | ||
52 | } | ||
53 | |||
54 | const video = await server.live.create({ fields }) | ||
55 | uuid = video.uuid | ||
56 | |||
57 | const ffmpegCommand = await server.live.sendRTMPStreamInVideo({ videoId: uuid }) | ||
58 | await waitUntilLivePublishedOnAllServers([ server ], uuid) | ||
59 | await stopFfmpeg(ffmpegCommand) | ||
60 | |||
61 | await waitUntilLiveReplacedByReplayOnAllServers([ server ], uuid) | ||
62 | await waitJobs([ server ]) | ||
63 | |||
64 | await testVideoFiles(server, uuid) | ||
65 | }) | ||
66 | |||
67 | it('Should update the replay to public and re-update it to private', async function () { | ||
68 | this.timeout(120000) | ||
69 | |||
70 | await server.videos.update({ id: uuid, attributes: { privacy: VideoPrivacy.PUBLIC } }) | ||
71 | await waitJobs([ server ]) | ||
72 | await testVideoFiles(server, uuid) | ||
73 | |||
74 | await server.videos.update({ id: uuid, attributes: { privacy: VideoPrivacy.PRIVATE } }) | ||
75 | await waitJobs([ server ]) | ||
76 | await testVideoFiles(server, uuid) | ||
77 | }) | ||
78 | }) | ||
79 | |||
80 | after(async function () { | ||
81 | await cleanupTests([ server ]) | ||
82 | }) | ||
83 | }) | ||