diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-15 10:02:54 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-20 15:27:18 +0200 |
commit | d23dd9fbfc4d26026352c10f81d2795ceaf2908a (patch) | |
tree | da82286d423c5e834a1ee2dcd5970076b8263cf1 /scripts | |
parent | 7926c5f9b3ffcabb1ffb0dcfa5e48b8e0b88fbc0 (diff) | |
download | PeerTube-d23dd9fbfc4d26026352c10f81d2795ceaf2908a.tar.gz PeerTube-d23dd9fbfc4d26026352c10f81d2795ceaf2908a.tar.zst PeerTube-d23dd9fbfc4d26026352c10f81d2795ceaf2908a.zip |
Introduce videos command
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/benchmark.ts | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/scripts/benchmark.ts b/scripts/benchmark.ts index 272f9e8b1..d9e4a08ab 100644 --- a/scripts/benchmark.ts +++ b/scripts/benchmark.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import * as autocannon from 'autocannon' | 1 | import * as autocannon from 'autocannon' |
2 | import { writeJson } from 'fs-extra' | 2 | import { writeJson } from 'fs-extra' |
3 | import { flushAndRunServer, getVideosList, killallServers, ServerInfo, setAccessTokensToServers, uploadVideo } from '@shared/extra-utils' | 3 | import { flushAndRunServer, killallServers, ServerInfo, setAccessTokensToServers } from '@shared/extra-utils' |
4 | import { Video, VideoPrivacy } from '@shared/models' | 4 | import { Video, VideoPrivacy } from '@shared/models' |
5 | import { registerTSPaths } from '../server/helpers/register-ts-paths' | 5 | import { registerTSPaths } from '../server/helpers/register-ts-paths' |
6 | 6 | ||
@@ -197,7 +197,7 @@ async function prepare () { | |||
197 | }) | 197 | }) |
198 | await setAccessTokensToServers([ server ]) | 198 | await setAccessTokensToServers([ server ]) |
199 | 199 | ||
200 | const videoAttributes = { | 200 | const attributes = { |
201 | name: 'my super video', | 201 | name: 'my super video', |
202 | category: 2, | 202 | category: 2, |
203 | nsfw: true, | 203 | nsfw: true, |
@@ -210,12 +210,11 @@ async function prepare () { | |||
210 | } | 210 | } |
211 | 211 | ||
212 | for (let i = 0; i < 10; i++) { | 212 | for (let i = 0; i < 10; i++) { |
213 | Object.assign(videoAttributes, { name: 'my super video ' + i }) | 213 | await server.videosCommand.upload({ attributes: { ...attributes, name: 'my super video ' + i } }) |
214 | await uploadVideo(server.url, server.accessToken, videoAttributes) | ||
215 | } | 214 | } |
216 | 215 | ||
217 | const resVideos = await getVideosList(server.url) | 216 | const { data } = await server.videosCommand.list() |
218 | video = resVideos.body.data.find(v => v.name === 'my super video 1') | 217 | video = data.find(v => v.name === 'my super video 1') |
219 | 218 | ||
220 | for (let i = 0; i < 10; i++) { | 219 | for (let i = 0; i < 10; i++) { |
221 | const text = 'my super first comment' | 220 | const text = 'my super first comment' |