Fix tests

pull/5817/head
Chocobozzz 2023-05-22 14:31:35 +02:00
parent 8762b1c7ff
commit 6a9b315182
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
3 changed files with 11 additions and 18 deletions

View File

@ -72,6 +72,8 @@ class LiveSegmentShaStore {
private writeToDisk () {
return this.writeQueue.add(async () => {
logger.debug(`Writing segment sha JSON ${this.sha256Path} of ${this.videoUUID} on disk %s.`, lTags(this.videoUUID))
// Atomic write: use rename instead of move that is not atomic
await writeJson(this.sha256PathTMP, mapToJSON(this.segmentsSha256))
await rename(this.sha256PathTMP, this.sha256Path)

View File

@ -674,22 +674,6 @@ describe('Test managing runners', function () {
await testUpdate({ ...base, type: undefined })
await testUpdate({ ...base, type: 'toto' as any })
})
it('Should succeed with the correct params', async function () {
await server.runnerJobs.update({
jobUUID: liveAcceptedJob.uuid,
jobToken: liveAcceptedJob.jobToken,
payload: base,
runnerToken
})
await server.runnerJobs.update({
jobUUID: liveAcceptedJob.uuid,
jobToken: liveAcceptedJob.jobToken,
payload: { ...base, masterPlaylistFile: undefined },
runnerToken
})
})
})
})

View File

@ -173,6 +173,8 @@ describe('Test live constraints', function () {
await servers[0].live.waitUntilPublished({ videoId: userVideoLiveoId })
const baseQuota = await servers[0].users.getMyQuotaUsed({ token: userAccessToken })
await wait(3000)
const quotaUser = await servers[0].users.getMyQuotaUsed({ token: userAccessToken })
@ -180,11 +182,16 @@ describe('Test live constraints', function () {
const { data } = await servers[0].users.list()
const quotaAdmin = data.find(u => u.username === 'user1')
expect(quotaUser.videoQuotaUsed).to.equal(quotaAdmin.videoQuotaUsed)
expect(quotaUser.videoQuotaUsedDaily).to.equal(quotaAdmin.videoQuotaUsedDaily)
expect(quotaUser.videoQuotaUsed).to.be.above(baseQuota.videoQuotaUsed)
expect(quotaUser.videoQuotaUsedDaily).to.be.above(baseQuota.videoQuotaUsedDaily)
expect(quotaAdmin.videoQuotaUsed).to.be.above(baseQuota.videoQuotaUsed)
expect(quotaAdmin.videoQuotaUsedDaily).to.be.above(baseQuota.videoQuotaUsedDaily)
expect(quotaUser.videoQuotaUsed).to.be.above(10)
expect(quotaUser.videoQuotaUsedDaily).to.be.above(10)
expect(quotaAdmin.videoQuotaUsed).to.be.above(10)
expect(quotaAdmin.videoQuotaUsedDaily).to.be.above(10)
await stopFfmpeg(ffmpegCommand)
})