aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/videos/audio-only.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/videos/audio-only.ts')
-rw-r--r--server/tests/api/videos/audio-only.ts37
1 files changed, 15 insertions, 22 deletions
diff --git a/server/tests/api/videos/audio-only.ts b/server/tests/api/videos/audio-only.ts
index 7ddbd5cd9..7fac6e738 100644
--- a/server/tests/api/videos/audio-only.ts
+++ b/server/tests/api/videos/audio-only.ts
@@ -2,26 +2,16 @@
2 2
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { join } from 'path'
6import { getAudioStream, getVideoStreamSize } from '@server/helpers/ffprobe-utils' 5import { getAudioStream, getVideoStreamSize } from '@server/helpers/ffprobe-utils'
7import { 6import { cleanupTests, createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
8 buildServerDirectory,
9 cleanupTests,
10 doubleFollow,
11 flushAndRunMultipleServers,
12 getVideo,
13 ServerInfo,
14 setAccessTokensToServers,
15 uploadVideo,
16 waitJobs
17} from '../../../../shared/extra-utils'
18import { VideoDetails } from '../../../../shared/models/videos'
19 7
20const expect = chai.expect 8const expect = chai.expect
21 9
22describe('Test audio only video transcoding', function () { 10describe('Test audio only video transcoding', function () {
23 let servers: ServerInfo[] = [] 11 let servers: PeerTubeServer[] = []
24 let videoUUID: string 12 let videoUUID: string
13 let webtorrentAudioFileUrl: string
14 let fragmentedAudioFileUrl: string
25 15
26 before(async function () { 16 before(async function () {
27 this.timeout(120000) 17 this.timeout(120000)
@@ -47,7 +37,7 @@ describe('Test audio only video transcoding', function () {
47 } 37 }
48 } 38 }
49 } 39 }
50 servers = await flushAndRunMultipleServers(2, configOverride) 40 servers = await createMultipleServers(2, configOverride)
51 41
52 // Get the access tokens 42 // Get the access tokens
53 await setAccessTokensToServers(servers) 43 await setAccessTokensToServers(servers)
@@ -59,15 +49,13 @@ describe('Test audio only video transcoding', function () {
59 it('Should upload a video and transcode it', async function () { 49 it('Should upload a video and transcode it', async function () {
60 this.timeout(120000) 50 this.timeout(120000)
61 51
62 const resUpload = await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'audio only' }) 52 const { uuid } = await servers[0].videos.upload({ attributes: { name: 'audio only' } })
63 videoUUID = resUpload.body.video.uuid 53 videoUUID = uuid
64 54
65 await waitJobs(servers) 55 await waitJobs(servers)
66 56
67 for (const server of servers) { 57 for (const server of servers) {
68 const res = await getVideo(server.url, videoUUID) 58 const video = await server.videos.get({ id: videoUUID })
69 const video: VideoDetails = res.body
70
71 expect(video.streamingPlaylists).to.have.lengthOf(1) 59 expect(video.streamingPlaylists).to.have.lengthOf(1)
72 60
73 for (const files of [ video.files, video.streamingPlaylists[0].files ]) { 61 for (const files of [ video.files, video.streamingPlaylists[0].files ]) {
@@ -76,13 +64,18 @@ describe('Test audio only video transcoding', function () {
76 expect(files[1].resolution.id).to.equal(240) 64 expect(files[1].resolution.id).to.equal(240)
77 expect(files[2].resolution.id).to.equal(0) 65 expect(files[2].resolution.id).to.equal(0)
78 } 66 }
67
68 if (server.serverNumber === 1) {
69 webtorrentAudioFileUrl = video.files[2].fileUrl
70 fragmentedAudioFileUrl = video.streamingPlaylists[0].files[2].fileUrl
71 }
79 } 72 }
80 }) 73 })
81 74
82 it('0p transcoded video should not have video', async function () { 75 it('0p transcoded video should not have video', async function () {
83 const paths = [ 76 const paths = [
84 buildServerDirectory(servers[0], join('videos', videoUUID + '-0.mp4')), 77 servers[0].servers.buildWebTorrentFilePath(webtorrentAudioFileUrl),
85 buildServerDirectory(servers[0], join('streaming-playlists', 'hls', videoUUID, videoUUID + '-0-fragmented.mp4')) 78 servers[0].servers.buildFragmentedFilePath(videoUUID, fragmentedAudioFileUrl)
86 ] 79 ]
87 80
88 for (const path of paths) { 81 for (const path of paths) {