aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-05-22 14:31:35 +0200
committerChocobozzz <me@florianbigard.com>2023-05-22 15:03:14 +0200
commit6a9b3151822461a85bbc72b7a50e12ffb69bec3a (patch)
tree1685c31114707d90144100319aead6c63aef6254 /server
parent8762b1c7ffbb82e817bb07b381503997b5aca50d (diff)
downloadPeerTube-6a9b3151822461a85bbc72b7a50e12ffb69bec3a.tar.gz
PeerTube-6a9b3151822461a85bbc72b7a50e12ffb69bec3a.tar.zst
PeerTube-6a9b3151822461a85bbc72b7a50e12ffb69bec3a.zip
Fix tests
Diffstat (limited to 'server')
-rw-r--r--server/lib/live/live-segment-sha-store.ts2
-rw-r--r--server/tests/api/check-params/runners.ts16
-rw-r--r--server/tests/api/live/live-constraints.ts11
3 files changed, 11 insertions, 18 deletions
diff --git a/server/lib/live/live-segment-sha-store.ts b/server/lib/live/live-segment-sha-store.ts
index 1a0a93985..08fc460b8 100644
--- a/server/lib/live/live-segment-sha-store.ts
+++ b/server/lib/live/live-segment-sha-store.ts
@@ -72,6 +72,8 @@ class LiveSegmentShaStore {
72 72
73 private writeToDisk () { 73 private writeToDisk () {
74 return this.writeQueue.add(async () => { 74 return this.writeQueue.add(async () => {
75 logger.debug(`Writing segment sha JSON ${this.sha256Path} of ${this.videoUUID} on disk %s.`, lTags(this.videoUUID))
76
75 // Atomic write: use rename instead of move that is not atomic 77 // Atomic write: use rename instead of move that is not atomic
76 await writeJson(this.sha256PathTMP, mapToJSON(this.segmentsSha256)) 78 await writeJson(this.sha256PathTMP, mapToJSON(this.segmentsSha256))
77 await rename(this.sha256PathTMP, this.sha256Path) 79 await rename(this.sha256PathTMP, this.sha256Path)
diff --git a/server/tests/api/check-params/runners.ts b/server/tests/api/check-params/runners.ts
index cee1993e6..48821b678 100644
--- a/server/tests/api/check-params/runners.ts
+++ b/server/tests/api/check-params/runners.ts
@@ -674,22 +674,6 @@ describe('Test managing runners', function () {
674 await testUpdate({ ...base, type: undefined }) 674 await testUpdate({ ...base, type: undefined })
675 await testUpdate({ ...base, type: 'toto' as any }) 675 await testUpdate({ ...base, type: 'toto' as any })
676 }) 676 })
677
678 it('Should succeed with the correct params', async function () {
679 await server.runnerJobs.update({
680 jobUUID: liveAcceptedJob.uuid,
681 jobToken: liveAcceptedJob.jobToken,
682 payload: base,
683 runnerToken
684 })
685
686 await server.runnerJobs.update({
687 jobUUID: liveAcceptedJob.uuid,
688 jobToken: liveAcceptedJob.jobToken,
689 payload: { ...base, masterPlaylistFile: undefined },
690 runnerToken
691 })
692 })
693 }) 677 })
694 }) 678 })
695 679
diff --git a/server/tests/api/live/live-constraints.ts b/server/tests/api/live/live-constraints.ts
index 37fd5b2a6..168241b79 100644
--- a/server/tests/api/live/live-constraints.ts
+++ b/server/tests/api/live/live-constraints.ts
@@ -173,6 +173,8 @@ describe('Test live constraints', function () {
173 173
174 await servers[0].live.waitUntilPublished({ videoId: userVideoLiveoId }) 174 await servers[0].live.waitUntilPublished({ videoId: userVideoLiveoId })
175 175
176 const baseQuota = await servers[0].users.getMyQuotaUsed({ token: userAccessToken })
177
176 await wait(3000) 178 await wait(3000)
177 179
178 const quotaUser = await servers[0].users.getMyQuotaUsed({ token: userAccessToken }) 180 const quotaUser = await servers[0].users.getMyQuotaUsed({ token: userAccessToken })
@@ -180,11 +182,16 @@ describe('Test live constraints', function () {
180 const { data } = await servers[0].users.list() 182 const { data } = await servers[0].users.list()
181 const quotaAdmin = data.find(u => u.username === 'user1') 183 const quotaAdmin = data.find(u => u.username === 'user1')
182 184
183 expect(quotaUser.videoQuotaUsed).to.equal(quotaAdmin.videoQuotaUsed) 185 expect(quotaUser.videoQuotaUsed).to.be.above(baseQuota.videoQuotaUsed)
184 expect(quotaUser.videoQuotaUsedDaily).to.equal(quotaAdmin.videoQuotaUsedDaily) 186 expect(quotaUser.videoQuotaUsedDaily).to.be.above(baseQuota.videoQuotaUsedDaily)
187
188 expect(quotaAdmin.videoQuotaUsed).to.be.above(baseQuota.videoQuotaUsed)
189 expect(quotaAdmin.videoQuotaUsedDaily).to.be.above(baseQuota.videoQuotaUsedDaily)
185 190
186 expect(quotaUser.videoQuotaUsed).to.be.above(10) 191 expect(quotaUser.videoQuotaUsed).to.be.above(10)
187 expect(quotaUser.videoQuotaUsedDaily).to.be.above(10) 192 expect(quotaUser.videoQuotaUsedDaily).to.be.above(10)
193 expect(quotaAdmin.videoQuotaUsed).to.be.above(10)
194 expect(quotaAdmin.videoQuotaUsedDaily).to.be.above(10)
188 195
189 await stopFfmpeg(ffmpegCommand) 196 await stopFfmpeg(ffmpegCommand)
190 }) 197 })