diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/benchmark.ts | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/scripts/benchmark.ts b/scripts/benchmark.ts index fcfc67bf7..321b07c94 100644 --- a/scripts/benchmark.ts +++ b/scripts/benchmark.ts | |||
@@ -1,19 +1,10 @@ | |||
1 | import { registerTSPaths } from '../server/helpers/register-ts-paths' | ||
2 | registerTSPaths() | ||
3 | |||
4 | import * as autocannon from 'autocannon' | 1 | import * as autocannon from 'autocannon' |
5 | import { | ||
6 | addVideoCommentReply, | ||
7 | addVideoCommentThread, | ||
8 | flushAndRunServer, | ||
9 | getVideosList, | ||
10 | killallServers, | ||
11 | ServerInfo, | ||
12 | setAccessTokensToServers, | ||
13 | uploadVideo | ||
14 | } from '@shared/extra-utils' | ||
15 | import { Video, VideoPrivacy } from '@shared/models' | ||
16 | import { writeJson } from 'fs-extra' | 2 | import { writeJson } from 'fs-extra' |
3 | import { flushAndRunServer, getVideosList, killallServers, ServerInfo, setAccessTokensToServers, uploadVideo } from '@shared/extra-utils' | ||
4 | import { Video, VideoPrivacy } from '@shared/models' | ||
5 | import { registerTSPaths } from '../server/helpers/register-ts-paths' | ||
6 | |||
7 | registerTSPaths() | ||
17 | 8 | ||
18 | let server: ServerInfo | 9 | let server: ServerInfo |
19 | let video: Video | 10 | let video: Video |
@@ -228,18 +219,17 @@ async function prepare () { | |||
228 | 219 | ||
229 | for (let i = 0; i < 10; i++) { | 220 | for (let i = 0; i < 10; i++) { |
230 | const text = 'my super first comment' | 221 | const text = 'my super first comment' |
231 | const res = await addVideoCommentThread(server.url, server.accessToken, video.id, text) | 222 | const created = await server.commentsCommand.createThread({ videoId: video.id, text }) |
232 | threadId = res.body.comment.id | 223 | threadId = created.id |
233 | 224 | ||
234 | const text1 = 'my super answer to thread 1' | 225 | const text1 = 'my super answer to thread 1' |
235 | const childCommentRes = await addVideoCommentReply(server.url, server.accessToken, video.id, threadId, text1) | 226 | const child = await server.commentsCommand.addReply({ videoId: video.id, toCommentId: threadId, text: text1 }) |
236 | const childCommentId = childCommentRes.body.comment.id | ||
237 | 227 | ||
238 | const text2 = 'my super answer to answer of thread 1' | 228 | const text2 = 'my super answer to answer of thread 1' |
239 | await addVideoCommentReply(server.url, server.accessToken, video.id, childCommentId, text2) | 229 | await server.commentsCommand.addReply({ videoId: video.id, toCommentId: child.id, text: text2 }) |
240 | 230 | ||
241 | const text3 = 'my second answer to thread 1' | 231 | const text3 = 'my second answer to thread 1' |
242 | await addVideoCommentReply(server.url, server.accessToken, video.id, threadId, text3) | 232 | await server.commentsCommand.addReply({ videoId: video.id, toCommentId: threadId, text: text3 }) |
243 | } | 233 | } |
244 | 234 | ||
245 | for (const caption of [ 'ar', 'fr', 'en', 'zh' ]) { | 235 | for (const caption of [ 'ar', 'fr', 'en', 'zh' ]) { |