]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/server/stats.ts
Automatically rebuild native modules on ABI change
[github/Chocobozzz/PeerTube.git] / server / tests / api / server / stats.ts
index be5abad5234eeef043cc6dd347c90fbe1625ec8f..bc35cbe4e87040e0042d9c0c242b3cdee2da8ca9 100644 (file)
@@ -2,21 +2,23 @@
 
 import 'mocha'
 import * as chai from 'chai'
+import { wait } from '@shared/core-utils'
+import { ActivityType, VideoPlaylistPrivacy } from '@shared/models'
 import {
   cleanupTests,
+  createMultipleServers,
   doubleFollow,
-  flushAndRunMultipleServers,
-  ServerInfo,
+  PeerTubeServer,
   setAccessTokensToServers,
-  wait,
+  setDefaultAccountAvatar,
+  setDefaultChannelAvatar,
   waitJobs
-} from '@shared/extra-utils'
-import { ActivityType, VideoPlaylistPrivacy } from '@shared/models'
+} from '@shared/server-commands'
 
 const expect = chai.expect
 
 describe('Test stats (excluding redundancy)', function () {
-  let servers: ServerInfo[] = []
+  let servers: PeerTubeServer[] = []
   let channelId
   const user = {
     username: 'user1',
@@ -24,11 +26,13 @@ describe('Test stats (excluding redundancy)', function () {
   }
 
   before(async function () {
-    this.timeout(60000)
+    this.timeout(120000)
 
-    servers = await flushAndRunMultipleServers(3)
+    servers = await createMultipleServers(3)
 
     await setAccessTokensToServers(servers)
+    await setDefaultChannelAvatar(servers)
+    await setDefaultAccountAvatar(servers)
 
     await doubleFollow(servers[0], servers[1])
 
@@ -38,12 +42,12 @@ describe('Test stats (excluding redundancy)', function () {
 
     await servers[0].comments.createThread({ videoId: uuid, text: 'comment' })
 
-    await servers[0].videos.view({ id: uuid })
+    await servers[0].views.simulateView({ id: uuid })
 
     // Wait the video views repeatable job
     await wait(8000)
 
-    await servers[2].follows.follow({ targets: [ servers[0].url ] })
+    await servers[2].follows.follow({ hosts: [ servers[0].url ] })
     await waitJobs(servers)
   })
 
@@ -198,6 +202,7 @@ describe('Test stats (excluding redundancy)', function () {
           },
           resolutions: {
             '0p': false,
+            '144p': false,
             '240p': false,
             '360p': false,
             '480p': false,
@@ -229,13 +234,7 @@ describe('Test stats (excluding redundancy)', function () {
   it('Should have the correct AP stats', async function () {
     this.timeout(60000)
 
-    await servers[0].config.updateCustomSubConfig({
-      newConfig: {
-        transcoding: {
-          enabled: false
-        }
-      }
-    })
+    await servers[0].config.disableTranscoding()
 
     const first = await servers[1].stats.get()