]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - scripts/benchmark.ts
Fix autoblock message on upload page
[github/Chocobozzz/PeerTube.git] / scripts / benchmark.ts
index 1d980063bdfb69acf812fa736e58d8f80feebce5..c29b9abcdb6c9e20f4eb841dbd9234032ae419cb 100644 (file)
@@ -1,12 +1,12 @@
-import * as autocannon from 'autocannon'
-import { writeJson } from 'fs-extra'
-import { flushAndRunServer, killallServers, ServerInfo, setAccessTokensToServers } from '@shared/extra-utils'
-import { Video, VideoPrivacy } from '@shared/models'
 import { registerTSPaths } from '../server/helpers/register-ts-paths'
-
 registerTSPaths()
 
-let server: ServerInfo
+import autocannon, { printResult } from 'autocannon'
+import { writeJson } from 'fs-extra'
+import { createSingleServer, killallServers, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils'
+import { Video, VideoPrivacy } from '@shared/models'
+
+let server: PeerTubeServer
 let video: Video
 let threadId: number
 
@@ -149,7 +149,7 @@ async function run () {
     Object.assign(testResult, { title: test.title, path: test.path })
     finalResult.push(testResult)
 
-    console.log(autocannon.printResult(testResult))
+    console.log(printResult(testResult))
   }
 
   if (outfile) await writeJson(outfile, finalResult)
@@ -188,7 +188,7 @@ function runBenchmark (options: {
 }
 
 async function prepare () {
-  server = await flushAndRunServer(1, {
+  server = await createSingleServer(1, {
     rates_limit: {
       api: {
         max: 5_000_000
@@ -232,7 +232,7 @@ async function prepare () {
   }
 
   for (const caption of [ 'ar', 'fr', 'en', 'zh' ]) {
-    await server.captions.createVideoCaption({
+    await server.captions.add({
       language: caption,
       videoId: video.id,
       fixture: 'subtitle-good2.vtt'