+ it('Should have 2 webseed on the first video', async function () {
+ this.timeout(40000)
+
+ await waitJobs(servers)
+ await waitUntilLog(servers[0], 'Duplicated ', 4)
+ await waitJobs(servers)
+
+ await check2Webseeds(strategy)
+ await checkStatsWith2Webseed(strategy)
+ })
+
+ it('Should remove the video and the redundancy files', async function () {
+ this.timeout(20000)
+
+ await removeVideo(servers[1].url, servers[1].accessToken, video1Server2UUID)
+
+ await waitJobs(servers)
+
+ for (const server of servers) {
+ await checkVideoFilesWereRemoved(video1Server2UUID, server.serverNumber)
+ }
+ })
+
+ after(function () {
+ return cleanServers()
+ })
+ })
+
+ describe('Test expiration', function () {
+ const strategy = 'recently-added'
+
+ async function checkContains (servers: ServerInfo[], str: string) {
+ for (const server of servers) {
+ const res = await getVideo(server.url, video1Server2UUID)
+ const video: VideoDetails = res.body
+
+ for (const f of video.files) {
+ expect(f.magnetUri).to.contain(str)
+ }
+ }
+ }
+
+ async function checkNotContains (servers: ServerInfo[], str: string) {
+ for (const server of servers) {
+ const res = await getVideo(server.url, video1Server2UUID)
+ const video: VideoDetails = res.body
+
+ for (const f of video.files) {
+ expect(f.magnetUri).to.not.contain(str)
+ }
+ }
+ }
+
+ before(async function () {
+ this.timeout(120000)
+
+ await runServers(strategy, { min_lifetime: '7 seconds', min_views: 0 })
+
+ await enableRedundancyOnServer1()
+ })
+
+ it('Should still have 2 webseeds after 10 seconds', async function () {
+ this.timeout(40000)
+
+ await wait(10000)
+
+ try {
+ await checkContains(servers, 'http%3A%2F%2Flocalhost%3A9001')
+ } catch {
+ // Maybe a server deleted a redundancy in the scheduler
+ await wait(2000)
+
+ await checkContains(servers, 'http%3A%2F%2Flocalhost%3A9001')
+ }
+ })
+
+ it('Should stop server 1 and expire video redundancy', async function () {