]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/server/handle-down.ts
Stop testing broken youtube-dl
[github/Chocobozzz/PeerTube.git] / server / tests / api / server / handle-down.ts
index 1f751c957025aa6cfc228b2805a3a2fa6b5dab23..1fb4d18f9d2f1f0943471e8eb10c6436383ad9b6 100644 (file)
@@ -1,21 +1,18 @@
 /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
 
-import 'mocha'
-import * as chai from 'chai'
+import { expect } from 'chai'
+import { completeVideoCheck } from '@server/tests/shared'
+import { wait } from '@shared/core-utils'
+import { HttpStatusCode, JobState, VideoCreateResult, VideoPrivacy } from '@shared/models'
 import {
   cleanupTests,
   CommentsCommand,
-  completeVideoCheck,
   createMultipleServers,
   killallServers,
   PeerTubeServer,
   setAccessTokensToServers,
-  wait,
   waitJobs
-} from '@shared/extra-utils'
-import { HttpStatusCode, JobState, VideoCreateResult, VideoPrivacy } from '@shared/models'
-
-const expect = chai.expect
+} from '@shared/server-commands'
 
 describe('Test handle downs', function () {
   let servers: PeerTubeServer[] = []
@@ -50,7 +47,7 @@ describe('Test handle downs', function () {
   let commentCommands: CommentsCommand[]
 
   before(async function () {
-    this.timeout(30000)
+    this.timeout(120000)
 
     servers = await createMultipleServers(3)
     commentCommands = servers.map(s => s.comments)
@@ -65,7 +62,7 @@ describe('Test handle downs', function () {
       support: 'my super support text for server 1',
       account: {
         name: 'root',
-        host: 'localhost:' + servers[0].port
+        host: servers[0].host
       },
       isLocal: false,
       duration: 10,
@@ -97,8 +94,8 @@ describe('Test handle downs', function () {
     this.timeout(240000)
 
     // Server 2 and 3 follow server 1
-    await servers[1].follows.follow({ targets: [ servers[0].url ] })
-    await servers[2].follows.follow({ targets: [ servers[0].url ] })
+    await servers[1].follows.follow({ hosts: [ servers[0].url ] })
+    await servers[2].follows.follow({ hosts: [ servers[0].url ] })
 
     await waitJobs(servers)
 
@@ -154,15 +151,15 @@ describe('Test handle downs', function () {
     const body = await servers[0].follows.getFollowers({ start: 0, count: 2, sort: 'createdAt' })
     expect(body.data).to.be.an('array')
     expect(body.data).to.have.lengthOf(1)
-    expect(body.data[0].follower.host).to.equal('localhost:' + servers[2].port)
+    expect(body.data[0].follower.host).to.equal(servers[2].host)
   })
 
   it('Should not have pending/processing jobs anymore', async function () {
     const states: JobState[] = [ 'waiting', 'active' ]
 
     for (const state of states) {
-      const body = await servers[0].jobs.getJobsList({
-        state: state,
+      const body = await servers[0].jobs.list({
+        state,
         start: 0,
         count: 50,
         sort: '-createdAt'
@@ -172,7 +169,7 @@ describe('Test handle downs', function () {
   })
 
   it('Should re-follow server 1', async function () {
-    this.timeout(35000)
+    this.timeout(70000)
 
     await servers[1].run()
     await servers[2].run()
@@ -180,7 +177,7 @@ describe('Test handle downs', function () {
     await servers[1].follows.unfollow({ target: servers[0] })
     await waitJobs(servers)
 
-    await servers[1].follows.follow({ targets: [ servers[0].url ] })
+    await servers[1].follows.follow({ hosts: [ servers[0].url ] })
 
     await waitJobs(servers)