2022-10-12 09:09:02 -05:00
|
|
|
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
|
|
|
|
|
|
|
|
import { completeCheckHlsPlaylist } from '@server/tests/shared'
|
2022-10-19 03:43:53 -05:00
|
|
|
import { areMockObjectStorageTestsDisabled, wait } from '@shared/core-utils'
|
2022-10-12 09:09:02 -05:00
|
|
|
import { VideoPrivacy } from '@shared/models'
|
|
|
|
import {
|
|
|
|
cleanupTests,
|
|
|
|
createMultipleServers,
|
|
|
|
doubleFollow,
|
|
|
|
ObjectStorageCommand,
|
|
|
|
PeerTubeServer,
|
|
|
|
setAccessTokensToServers,
|
|
|
|
waitJobs
|
|
|
|
} from '@shared/server-commands'
|
|
|
|
|
|
|
|
describe('Test update video privacy while transcoding', function () {
|
|
|
|
let servers: PeerTubeServer[] = []
|
|
|
|
|
|
|
|
const videoUUIDs: string[] = []
|
|
|
|
|
|
|
|
function runTestSuite (hlsOnly: boolean, objectStorageBaseUrl?: string) {
|
|
|
|
|
|
|
|
it('Should not have an error while quickly updating a private video to public after upload #1', async function () {
|
|
|
|
this.timeout(360_000)
|
|
|
|
|
|
|
|
const attributes = {
|
|
|
|
name: 'quick update',
|
|
|
|
privacy: VideoPrivacy.PRIVATE
|
|
|
|
}
|
|
|
|
|
|
|
|
const { uuid } = await servers[0].videos.upload({ attributes, waitTorrentGeneration: false })
|
|
|
|
await servers[0].videos.update({ id: uuid, attributes: { privacy: VideoPrivacy.PUBLIC } })
|
|
|
|
videoUUIDs.push(uuid)
|
|
|
|
|
|
|
|
await waitJobs(servers)
|
|
|
|
|
|
|
|
await completeCheckHlsPlaylist({ servers, videoUUID: uuid, hlsOnly, objectStorageBaseUrl })
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Should not have an error while quickly updating a private video to public after upload #2', async function () {
|
2023-05-10 02:02:42 -05:00
|
|
|
this.timeout(60000)
|
2022-10-12 09:09:02 -05:00
|
|
|
|
|
|
|
{
|
|
|
|
const attributes = {
|
|
|
|
name: 'quick update 2',
|
|
|
|
privacy: VideoPrivacy.PRIVATE
|
|
|
|
}
|
|
|
|
|
|
|
|
const { uuid } = await servers[0].videos.upload({ attributes, waitTorrentGeneration: true })
|
|
|
|
await servers[0].videos.update({ id: uuid, attributes: { privacy: VideoPrivacy.PUBLIC } })
|
|
|
|
videoUUIDs.push(uuid)
|
|
|
|
|
|
|
|
await waitJobs(servers)
|
|
|
|
|
|
|
|
await completeCheckHlsPlaylist({ servers, videoUUID: uuid, hlsOnly, objectStorageBaseUrl })
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Should not have an error while quickly updating a private video to public after upload #3', async function () {
|
2023-05-10 02:02:42 -05:00
|
|
|
this.timeout(60000)
|
|
|
|
|
2022-10-12 09:09:02 -05:00
|
|
|
const attributes = {
|
|
|
|
name: 'quick update 3',
|
|
|
|
privacy: VideoPrivacy.PRIVATE
|
|
|
|
}
|
|
|
|
|
|
|
|
const { uuid } = await servers[0].videos.upload({ attributes, waitTorrentGeneration: true })
|
|
|
|
await wait(1000)
|
|
|
|
await servers[0].videos.update({ id: uuid, attributes: { privacy: VideoPrivacy.PUBLIC } })
|
|
|
|
videoUUIDs.push(uuid)
|
|
|
|
|
|
|
|
await waitJobs(servers)
|
|
|
|
|
|
|
|
await completeCheckHlsPlaylist({ servers, videoUUID: uuid, hlsOnly, objectStorageBaseUrl })
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
before(async function () {
|
|
|
|
this.timeout(120000)
|
|
|
|
|
|
|
|
const configOverride = {
|
|
|
|
transcoding: {
|
|
|
|
enabled: true,
|
|
|
|
allow_audio_files: true,
|
|
|
|
hls: {
|
|
|
|
enabled: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
servers = await createMultipleServers(2, configOverride)
|
|
|
|
|
|
|
|
// Get the access tokens
|
|
|
|
await setAccessTokensToServers(servers)
|
|
|
|
|
|
|
|
// Server 1 and server 2 follow each other
|
|
|
|
await doubleFollow(servers[0], servers[1])
|
|
|
|
})
|
|
|
|
|
|
|
|
describe('With WebTorrent & HLS enabled', function () {
|
|
|
|
runTestSuite(false)
|
|
|
|
})
|
|
|
|
|
|
|
|
describe('With only HLS enabled', function () {
|
|
|
|
|
|
|
|
before(async function () {
|
|
|
|
await servers[0].config.updateCustomSubConfig({
|
|
|
|
newConfig: {
|
|
|
|
transcoding: {
|
|
|
|
enabled: true,
|
|
|
|
allowAudioFiles: true,
|
|
|
|
resolutions: {
|
|
|
|
'144p': false,
|
|
|
|
'240p': true,
|
|
|
|
'360p': true,
|
|
|
|
'480p': true,
|
|
|
|
'720p': true,
|
|
|
|
'1080p': true,
|
|
|
|
'1440p': true,
|
|
|
|
'2160p': true
|
|
|
|
},
|
|
|
|
hls: {
|
|
|
|
enabled: true
|
|
|
|
},
|
|
|
|
webtorrent: {
|
|
|
|
enabled: false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
runTestSuite(true)
|
|
|
|
})
|
|
|
|
|
|
|
|
describe('With object storage enabled', function () {
|
2022-10-19 03:43:53 -05:00
|
|
|
if (areMockObjectStorageTestsDisabled()) return
|
2022-10-12 09:09:02 -05:00
|
|
|
|
2023-05-23 03:49:45 -05:00
|
|
|
const objectStorage = new ObjectStorageCommand()
|
|
|
|
|
2022-10-12 09:09:02 -05:00
|
|
|
before(async function () {
|
|
|
|
this.timeout(120000)
|
|
|
|
|
2023-05-23 03:49:45 -05:00
|
|
|
const configOverride = objectStorage.getDefaultMockConfig()
|
|
|
|
await objectStorage.prepareDefaultMockBuckets()
|
2022-10-12 09:09:02 -05:00
|
|
|
|
|
|
|
await servers[0].kill()
|
|
|
|
await servers[0].run(configOverride)
|
|
|
|
})
|
|
|
|
|
2023-05-23 03:49:45 -05:00
|
|
|
runTestSuite(true, objectStorage.getMockPlaylistBaseUrl())
|
|
|
|
|
|
|
|
after(async function () {
|
|
|
|
await objectStorage.cleanupMock()
|
|
|
|
})
|
2022-10-12 09:09:02 -05:00
|
|
|
})
|
|
|
|
|
|
|
|
after(async function () {
|
|
|
|
await cleanupTests(servers)
|
|
|
|
})
|
|
|
|
})
|