]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/redundancy/manage-redundancy.ts
Improve wait transcoding help
[github/Chocobozzz/PeerTube.git] / server / tests / api / redundancy / manage-redundancy.ts
index e193b968e3826056fbe6e3f86804108de0ec68b2..d415ac3bfab55407024913e24508678ab00f10e0 100644 (file)
@@ -4,13 +4,13 @@ import 'mocha'
 import * as chai from 'chai'
 import {
   cleanupTests,
+  createMultipleServers,
   doubleFollow,
-  flushAndRunMultipleServers,
+  PeerTubeServer,
   RedundancyCommand,
-  ServerInfo,
   setAccessTokensToServers,
   waitJobs
-} from '@shared/extra-utils'
+} from '@shared/server-commands'
 import { VideoPrivacy, VideoRedundanciesTarget } from '@shared/models'
 
 const expect = chai.expect
@@ -18,7 +18,7 @@ const expect = chai.expect
 describe('Test manage videos redundancy', function () {
   const targets: VideoRedundanciesTarget[] = [ 'my-videos', 'remote-videos' ]
 
-  let servers: ServerInfo[]
+  let servers: PeerTubeServer[]
   let video1Server2UUID: string
   let video2Server2UUID: string
   let redundanciesToRemove: number[] = []
@@ -48,7 +48,7 @@ describe('Test manage videos redundancy', function () {
         }
       }
     }
-    servers = await flushAndRunMultipleServers(3, config)
+    servers = await createMultipleServers(3, config)
 
     // Get the access tokens
     await setAccessTokensToServers(servers)
@@ -69,6 +69,7 @@ describe('Test manage videos redundancy', function () {
 
     // Server 1 and server 2 follow each other
     await doubleFollow(servers[0], servers[1])
+    await doubleFollow(servers[0], servers[2])
     await commands[0].updateRedundancy({ host: servers[1].host, redundancyAllowed: true })
 
     await waitJobs(servers)
@@ -83,6 +84,16 @@ describe('Test manage videos redundancy', function () {
     }
   })
 
+  it('Should correctly list followings by redundancy', async function () {
+    const body = await servers[0].follows.getFollowings({ sort: '-redundancyAllowed' })
+
+    expect(body.total).to.equal(2)
+    expect(body.data).to.have.lengthOf(2)
+
+    expect(body.data[0].following.host).to.equal(servers[1].host)
+    expect(body.data[1].following.host).to.equal(servers[2].host)
+  })
+
   it('Should not have "remote-videos" redundancies on server 2', async function () {
     this.timeout(120000)