+ if (objectStorage) await checkFilesInObjectStorage(videoDetails.files, 'webtorrent')
+ }
+ })
+
+ it('Should generate an HLS resolution', async function () {
+ this.timeout(120000)
+
+ await servers[0].cli.execWithEnv(`npm run create-transcoding-job -- -v ${videosUUID[2]} --generate-hls -r 480`)
+
+ await waitJobs(servers)
+
+ for (const server of servers) {
+ const videoDetails = await server.videos.get({ id: videosUUID[2] })
+
+ expect(videoDetails.files).to.have.lengthOf(1)
+ if (objectStorage) await checkFilesInObjectStorage(videoDetails.files, 'webtorrent')
+
+ expect(videoDetails.streamingPlaylists).to.have.lengthOf(1)
+
+ const files = videoDetails.streamingPlaylists[0].files
+ expect(files).to.have.lengthOf(1)
+ expect(files[0].resolution.id).to.equal(480)
+
+ if (objectStorage) await checkFilesInObjectStorage(files, 'playlist')
+ }
+ })
+
+ it('Should not duplicate an HLS resolution', async function () {
+ this.timeout(120000)
+
+ await servers[0].cli.execWithEnv(`npm run create-transcoding-job -- -v ${videosUUID[2]} --generate-hls -r 480`)
+
+ await waitJobs(servers)
+
+ for (const server of servers) {
+ const videoDetails = await server.videos.get({ id: videosUUID[2] })
+
+ const files = videoDetails.streamingPlaylists[0].files
+ expect(files).to.have.lengthOf(1)
+ expect(files[0].resolution.id).to.equal(480)
+
+ if (objectStorage) await checkFilesInObjectStorage(files, 'playlist')
+ }
+ })
+
+ it('Should generate all HLS resolutions', async function () {
+ this.timeout(120000)
+
+ await servers[0].cli.execWithEnv(`npm run create-transcoding-job -- -v ${videosUUID[3]} --generate-hls`)
+
+ await waitJobs(servers)
+
+ for (const server of servers) {
+ const videoDetails = await server.videos.get({ id: videosUUID[3] })
+
+ expect(videoDetails.files).to.have.lengthOf(1)
+ expect(videoDetails.streamingPlaylists).to.have.lengthOf(1)
+
+ const files = videoDetails.streamingPlaylists[0].files
+ expect(files).to.have.lengthOf(4)
+
+ if (objectStorage) await checkFilesInObjectStorage(files, 'playlist')
+ }
+ })
+
+ it('Should optimize the video file and generate HLS videos if enabled in config', async function () {
+ this.timeout(120000)
+
+ await servers[0].config.enableTranscoding()
+ await servers[0].cli.execWithEnv(`npm run create-transcoding-job -- -v ${videosUUID[4]}`)
+
+ await waitJobs(servers)
+
+ for (const server of servers) {
+ const videoDetails = await server.videos.get({ id: videosUUID[4] })
+
+ expect(videoDetails.files).to.have.lengthOf(5)
+ expect(videoDetails.streamingPlaylists).to.have.lengthOf(1)
+ expect(videoDetails.streamingPlaylists[0].files).to.have.lengthOf(5)
+
+ if (objectStorage) {
+ await checkFilesInObjectStorage(videoDetails.files, 'webtorrent')
+ await checkFilesInObjectStorage(videoDetails.streamingPlaylists[0].files, 'playlist')
+ }
+ }
+ })
+
+ it('Should not have updated published at attributes', async function () {
+ for (const id of videosUUID) {
+ const video = await servers[0].videos.get({ id })
+
+ expect(publishedAt.some(p => video.publishedAt === p)).to.be.true