]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/external-plugins/auto-block-videos.ts
Increase tests timeout
[github/Chocobozzz/PeerTube.git] / server / tests / external-plugins / auto-block-videos.ts
index 3b4b48bf01b1969ff7fb99b4feb34882aad6d315..cadd02e8d624f573693587fd464f7e5787594afd 100644 (file)
@@ -1,21 +1,19 @@
 /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
 
-import 'mocha'
 import { expect } from 'chai'
+import { wait } from '@shared/core-utils'
+import { Video } from '@shared/models'
 import {
   cleanupTests,
+  createMultipleServers,
   doubleFollow,
-  flushAndRunMultipleServers,
   killallServers,
-  MockBlocklist,
-  reRunServer,
-  ServerInfo,
-  setAccessTokensToServers,
-  wait
-} from '@shared/extra-utils'
-import { Video } from '@shared/models'
+  PeerTubeServer,
+  setAccessTokensToServers
+} from '@shared/server-commands'
+import { MockBlocklist } from '../shared'
 
-async function check (server: ServerInfo, videoUUID: string, exists = true) {
+async function check (server: PeerTubeServer, videoUUID: string, exists = true) {
   const { data } = await server.videos.list()
 
   const video = data.find(v => v.uuid === videoUUID)
@@ -25,16 +23,16 @@ async function check (server: ServerInfo, videoUUID: string, exists = true) {
 }
 
 describe('Official plugin auto-block videos', function () {
-  let servers: ServerInfo[]
+  let servers: PeerTubeServer[]
   let blocklistServer: MockBlocklist
   let server1Videos: Video[] = []
   let server2Videos: Video[] = []
   let port: number
 
   before(async function () {
-    this.timeout(60000)
+    this.timeout(120000)
 
-    servers = await flushAndRunMultipleServers(2)
+    servers = await createMultipleServers(2)
     await setAccessTokensToServers(servers)
 
     for (const server of servers) {
@@ -44,10 +42,10 @@ describe('Official plugin auto-block videos', function () {
     blocklistServer = new MockBlocklist()
     port = await blocklistServer.initialize()
 
-    await await servers[0].videos.quickUpload({ name: 'video server 1' })
-    await await servers[1].videos.quickUpload({ name: 'video server 2' })
-    await await servers[1].videos.quickUpload({ name: 'video 2 server 2' })
-    await await servers[1].videos.quickUpload({ name: 'video 3 server 2' })
+    await servers[0].videos.quickUpload({ name: 'video server 1' })
+    await servers[1].videos.quickUpload({ name: 'video server 2' })
+    await servers[1].videos.quickUpload({ name: 'video 2 server 2' })
+    await servers[1].videos.quickUpload({ name: 'video 3 server 2' })
 
     {
       const { data } = await servers[0].videos.list()
@@ -66,7 +64,7 @@ describe('Official plugin auto-block videos', function () {
     await servers[0].plugins.updateSettings({
       npmName: 'peertube-plugin-auto-block-videos',
       settings: {
-        'blocklist-urls': `http://localhost:${port}/blocklist`,
+        'blocklist-urls': `http://127.0.0.1:${port}/blocklist`,
         'check-seconds-interval': 1
       }
     })
@@ -161,7 +159,7 @@ describe('Official plugin auto-block videos', function () {
     await check(servers[0], video.uuid, true)
 
     await killallServers([ servers[0] ])
-    await reRunServer(servers[0])
+    await servers[0].run()
     await wait(2000)
 
     await check(servers[0], video.uuid, true)