aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-12-08 10:08:36 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-12-08 10:08:36 +0100
commite11f68a3562d2468480c396f47f1bdd2a306e17a (patch)
treec773ea89b0ea4b871e0265449501477b64233b00 /server/tests
parentcadb46d832724ea1a17b085b992142aa32e212be (diff)
downloadPeerTube-e11f68a3562d2468480c396f47f1bdd2a306e17a.tar.gz
PeerTube-e11f68a3562d2468480c396f47f1bdd2a306e17a.tar.zst
PeerTube-e11f68a3562d2468480c396f47f1bdd2a306e17a.zip
Optimise transaction for video upload
Diffstat (limited to 'server/tests')
-rw-r--r--server/tests/api/single-server.ts13
-rw-r--r--server/tests/utils/videos.ts2
2 files changed, 6 insertions, 9 deletions
diff --git a/server/tests/api/single-server.ts b/server/tests/api/single-server.ts
index ed79f9e1c..e99955ef4 100644
--- a/server/tests/api/single-server.ts
+++ b/server/tests/api/single-server.ts
@@ -364,7 +364,7 @@ describe('Test a single server', function () {
364 'video_short1.webm', 'video_short2.webm', 'video_short3.webm' 364 'video_short1.webm', 'video_short2.webm', 'video_short3.webm'
365 ] 365 ]
366 366
367 // const tasks: Promise<any>[] = [] 367 const tasks: Promise<any>[] = []
368 for (const video of videos) { 368 for (const video of videos) {
369 const videoAttributes = { 369 const videoAttributes = {
370 name: video + ' name', 370 name: video + ' name',
@@ -378,13 +378,10 @@ describe('Test a single server', function () {
378 } 378 }
379 379
380 const p = uploadVideo(server.url, server.accessToken, videoAttributes) 380 const p = uploadVideo(server.url, server.accessToken, videoAttributes)
381 await p 381 tasks.push(p)
382 } 382 }
383 // FIXME: concurrent uploads does not work :( 383
384 // tasks.push(p) 384 await Promise.all(tasks)
385 // }
386 //
387 // await Promise.all(tasks)
388 }) 385 })
389 386
390 it('Should have the correct durations', async function () { 387 it('Should have the correct durations', async function () {
@@ -712,7 +709,7 @@ describe('Test a single server', function () {
712 const filePath = join(__dirname, '..', 'api', 'fixtures', 'video_short.webm') 709 const filePath = join(__dirname, '..', 'api', 'fixtures', 'video_short.webm')
713 710
714 await req.attach('videofile', filePath) 711 await req.attach('videofile', filePath)
715 .expect(204) 712 .expect(200)
716 713
717 const res = await getVideosList(server.url) 714 const res = await getVideosList(server.url)
718 const video = res.body.data.find(v => v.name === 'minimum parameters') 715 const video = res.body.data.find(v => v.name === 'minimum parameters')
diff --git a/server/tests/utils/videos.ts b/server/tests/utils/videos.ts
index bdf3368ac..fb758cf29 100644
--- a/server/tests/utils/videos.ts
+++ b/server/tests/utils/videos.ts
@@ -201,7 +201,7 @@ async function testVideoImage (url: string, imageName: string, imagePath: string
201 } 201 }
202} 202}
203 203
204async function uploadVideo (url: string, accessToken: string, videoAttributesArg: VideoAttributes, specialStatus = 201) { 204async function uploadVideo (url: string, accessToken: string, videoAttributesArg: VideoAttributes, specialStatus = 200) {
205 const path = '/api/v1/videos/upload' 205 const path = '/api/v1/videos/upload'
206 let defaultChannelId = '1' 206 let defaultChannelId = '1'
207 207