]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Fix redundancy tests
authorChocobozzz <me@florianbigard.com>
Tue, 13 Aug 2019 08:22:54 +0000 (10:22 +0200)
committerChocobozzz <me@florianbigard.com>
Tue, 13 Aug 2019 08:22:54 +0000 (10:22 +0200)
server/models/redundancy/video-redundancy.ts
server/tests/api/redundancy/redundancy.ts

index 8621a5c6c1f83e23866caa63adbbf757659594fb..3df1c4f9cf1fa76977ef7ac942ca444df353b6a9 100644 (file)
@@ -237,6 +237,8 @@ export class VideoRedundancyModel extends Model<VideoRedundancyModel> {
 
   static async getVideoSample (p: Bluebird<VideoModel[]>) {
     const rows = await p
+    if (rows.length === 0) return undefined
+
     const ids = rows.map(r => r.id)
     const id = sample(ids)
 
@@ -347,6 +349,7 @@ export class VideoRedundancyModel extends Model<VideoRedundancyModel> {
           required: true,
           include: [
             {
+              required: true,
               attributes: [],
               model: VideoStreamingPlaylistModel.unscoped(),
               include: [
index 6f2c5907661635e81b6da076cd7dd4533b069d79..9e8733774796598223475c87aec9236019c8f025 100644 (file)
@@ -66,7 +66,7 @@ async function flushAndRunServers (strategy: VideoRedundancyStrategy, additional
           immutableAssign({
             min_lifetime: '1 hour',
             strategy: strategy,
-            size: '200KB'
+            size: '400KB'
           }, additionalParams)
         ]
       }
@@ -224,8 +224,8 @@ async function checkStatsWith2Webseed (strategy: VideoRedundancyStrategy) {
   const stat = data.videosRedundancy[0]
 
   expect(stat.strategy).to.equal(strategy)
-  expect(stat.totalSize).to.equal(204800)
-  expect(stat.totalUsed).to.be.at.least(1).and.below(204801)
+  expect(stat.totalSize).to.equal(409600)
+  expect(stat.totalUsed).to.be.at.least(1).and.below(409601)
   expect(stat.totalVideoFiles).to.equal(4)
   expect(stat.totalVideos).to.equal(1)
 }
@@ -238,7 +238,7 @@ async function checkStatsWith1Webseed (strategy: VideoRedundancyStrategy) {
 
   const stat = data.videosRedundancy[0]
   expect(stat.strategy).to.equal(strategy)
-  expect(stat.totalSize).to.equal(204800)
+  expect(stat.totalSize).to.equal(409600)
   expect(stat.totalUsed).to.equal(0)
   expect(stat.totalVideoFiles).to.equal(0)
   expect(stat.totalVideos).to.equal(0)