From 9e3e3617dcea3e31dea60c4d41c9927da98cd560 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 13 Aug 2019 10:22:54 +0200 Subject: Fix redundancy tests --- server/models/redundancy/video-redundancy.ts | 3 +++ server/tests/api/redundancy/redundancy.ts | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'server') diff --git a/server/models/redundancy/video-redundancy.ts b/server/models/redundancy/video-redundancy.ts index 8621a5c6c..3df1c4f9c 100644 --- a/server/models/redundancy/video-redundancy.ts +++ b/server/models/redundancy/video-redundancy.ts @@ -237,6 +237,8 @@ export class VideoRedundancyModel extends Model { static async getVideoSample (p: Bluebird) { 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 { required: true, include: [ { + required: true, attributes: [], model: VideoStreamingPlaylistModel.unscoped(), include: [ diff --git a/server/tests/api/redundancy/redundancy.ts b/server/tests/api/redundancy/redundancy.ts index 6f2c59076..9e8733774 100644 --- a/server/tests/api/redundancy/redundancy.ts +++ b/server/tests/api/redundancy/redundancy.ts @@ -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) -- cgit v1.2.3