import 'mocha'
import * as chai from 'chai'
import { readdir } from 'fs-extra'
-import * as magnetUtil from 'magnet-uri'
+import magnetUtil from 'magnet-uri'
import { basename, join } from 'path'
import {
checkSegmentHash,
}
}
-async function createSingleServers (strategy: VideoRedundancyStrategy | null, additionalParams: any = {}, withWebtorrent = true) {
+async function createServers (strategy: VideoRedundancyStrategy | null, additionalParams: any = {}, withWebtorrent = true) {
const strategies: any[] = []
if (strategy !== null) {
expect(redundancy.baseUrl).to.equal(servers[0].url + '/static/redundancy/hls/' + videoUUID)
}
- const baseUrlPlaylist = servers[1].url + '/static/streaming-playlists/hls'
- const baseUrlSegment = servers[0].url + '/static/redundancy/hls'
+ const baseUrlPlaylist = servers[1].url + '/static/streaming-playlists/hls/' + videoUUID
+ const baseUrlSegment = servers[0].url + '/static/redundancy/hls/' + videoUUID
const video = await servers[0].videos.get({ id: videoUUID })
const hlsPlaylist = video.streamingPlaylists[0]
for (const resolution of [ 240, 360, 480, 720 ]) {
- await checkSegmentHash({ server: servers[1], baseUrlPlaylist, baseUrlSegment, videoUUID, resolution, hlsPlaylist })
+ await checkSegmentHash({ server: servers[1], baseUrlPlaylist, baseUrlSegment, resolution, hlsPlaylist })
}
const { hlsFilenames } = await ensureSameFilenames(videoUUID)
before(function () {
this.timeout(120000)
- return createSingleServers(strategy)
+ return createServers(strategy)
})
it('Should have 1 webseed on the first video', async function () {
before(function () {
this.timeout(120000)
- return createSingleServers(strategy)
+ return createServers(strategy)
})
it('Should have 1 webseed on the first video', async function () {
await checkStatsWith1Redundancy(strategy)
})
- it('Should unfollow on server 1 and remove duplicated videos', async function () {
+ it('Should unfollow server 3 and keep duplicated videos', async function () {
+ this.timeout(80000)
+
+ await servers[0].follows.unfollow({ target: servers[2] })
+
+ await waitJobs(servers)
+ await wait(5000)
+
+ await check2Webseeds()
+ await check1PlaylistRedundancies()
+ await checkStatsWith1Redundancy(strategy)
+ })
+
+ it('Should unfollow server 2 and remove duplicated videos', async function () {
this.timeout(80000)
await servers[0].follows.unfollow({ target: servers[1] })
before(function () {
this.timeout(120000)
- return createSingleServers(strategy, { min_views: 3 })
+ return createServers(strategy, { min_views: 3 })
})
it('Should have 1 webseed on the first video', async function () {
before(async function () {
this.timeout(120000)
- await createSingleServers(strategy, { min_views: 3 }, false)
+ await createServers(strategy, { min_views: 3 }, false)
})
it('Should have 0 playlist redundancy on the first video', async function () {
before(function () {
this.timeout(120000)
- return createSingleServers(null)
+ return createServers(null)
})
it('Should have 1 webseed on the first video', async function () {
before(async function () {
this.timeout(120000)
- await createSingleServers(strategy, { min_lifetime: '7 seconds', min_views: 0 })
+ await createServers(strategy, { min_lifetime: '7 seconds', min_views: 0 })
await enableRedundancyOnServer1()
})
before(async function () {
this.timeout(120000)
- await createSingleServers(strategy, { min_lifetime: '7 seconds', min_views: 0 })
+ await createServers(strategy, { min_lifetime: '7 seconds', min_views: 0 })
await enableRedundancyOnServer1()