aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-12-09 15:44:54 +0100
committerChocobozzz <me@florianbigard.com>2021-12-09 15:44:54 +0100
commit0fbc0dec59684527fad8772080a8e1f928c07ea1 (patch)
treefbbb76187cf83aa4e7c6ce32e36be2d53a28bdc0 /server
parent9e847c17f968076287025c798b87506a8d50bb93 (diff)
downloadPeerTube-0fbc0dec59684527fad8772080a8e1f928c07ea1.tar.gz
PeerTube-0fbc0dec59684527fad8772080a8e1f928c07ea1.tar.zst
PeerTube-0fbc0dec59684527fad8772080a8e1f928c07ea1.zip
Fix tests
Diffstat (limited to 'server')
-rw-r--r--server/controllers/api/videos/update.ts2
-rw-r--r--server/tests/api/redundancy/redundancy.ts16
-rw-r--r--server/tests/api/server/email.ts2
-rw-r--r--server/tests/api/videos/video-privacy.ts13
4 files changed, 21 insertions, 12 deletions
diff --git a/server/controllers/api/videos/update.ts b/server/controllers/api/videos/update.ts
index e397127f3..589556f47 100644
--- a/server/controllers/api/videos/update.ts
+++ b/server/controllers/api/videos/update.ts
@@ -150,7 +150,7 @@ async function updateVideo (req: express.Request, res: express.Response) {
150 150
151 if (videoInfoToUpdate.name) await updateTorrentsMetadata(videoInstanceUpdated) 151 if (videoInfoToUpdate.name) await updateTorrentsMetadata(videoInstanceUpdated)
152 152
153 await federateVideoIfNeeded(videoInstanceUpdated, isNewVideo, undefined) 153 await sequelizeTypescript.transaction(t => federateVideoIfNeeded(videoInstanceUpdated, isNewVideo, t))
154 154
155 if (wasConfidentialVideo) Notifier.Instance.notifyOnNewVideoIfNeeded(videoInstanceUpdated) 155 if (wasConfidentialVideo) Notifier.Instance.notifyOnNewVideoIfNeeded(videoInstanceUpdated)
156 156
diff --git a/server/tests/api/redundancy/redundancy.ts b/server/tests/api/redundancy/redundancy.ts
index 86b40cfe6..b5929129a 100644
--- a/server/tests/api/redundancy/redundancy.ts
+++ b/server/tests/api/redundancy/redundancy.ts
@@ -307,7 +307,7 @@ describe('Test videos redundancy', function () {
307 const strategy = 'most-views' 307 const strategy = 'most-views'
308 308
309 before(function () { 309 before(function () {
310 this.timeout(120000) 310 this.timeout(240000)
311 311
312 return createServers(strategy) 312 return createServers(strategy)
313 }) 313 })
@@ -357,7 +357,7 @@ describe('Test videos redundancy', function () {
357 const strategy = 'trending' 357 const strategy = 'trending'
358 358
359 before(function () { 359 before(function () {
360 this.timeout(120000) 360 this.timeout(240000)
361 361
362 return createServers(strategy) 362 return createServers(strategy)
363 }) 363 })
@@ -420,7 +420,7 @@ describe('Test videos redundancy', function () {
420 const strategy = 'recently-added' 420 const strategy = 'recently-added'
421 421
422 before(function () { 422 before(function () {
423 this.timeout(120000) 423 this.timeout(240000)
424 424
425 return createServers(strategy, { min_views: 3 }) 425 return createServers(strategy, { min_views: 3 })
426 }) 426 })
@@ -491,7 +491,7 @@ describe('Test videos redundancy', function () {
491 const strategy = 'recently-added' 491 const strategy = 'recently-added'
492 492
493 before(async function () { 493 before(async function () {
494 this.timeout(120000) 494 this.timeout(240000)
495 495
496 await createServers(strategy, { min_views: 3 }, false) 496 await createServers(strategy, { min_views: 3 }, false)
497 }) 497 })
@@ -553,7 +553,7 @@ describe('Test videos redundancy', function () {
553 553
554 describe('With manual strategy', function () { 554 describe('With manual strategy', function () {
555 before(function () { 555 before(function () {
556 this.timeout(120000) 556 this.timeout(240000)
557 557
558 return createServers(null) 558 return createServers(null)
559 }) 559 })
@@ -632,7 +632,7 @@ describe('Test videos redundancy', function () {
632 } 632 }
633 633
634 before(async function () { 634 before(async function () {
635 this.timeout(120000) 635 this.timeout(240000)
636 636
637 await createServers(strategy, { min_lifetime: '7 seconds', min_views: 0 }) 637 await createServers(strategy, { min_lifetime: '7 seconds', min_views: 0 })
638 638
@@ -674,7 +674,7 @@ describe('Test videos redundancy', function () {
674 const strategy = 'recently-added' 674 const strategy = 'recently-added'
675 675
676 before(async function () { 676 before(async function () {
677 this.timeout(120000) 677 this.timeout(240000)
678 678
679 await createServers(strategy, { min_lifetime: '7 seconds', min_views: 0 }) 679 await createServers(strategy, { min_lifetime: '7 seconds', min_views: 0 })
680 680
@@ -698,7 +698,7 @@ describe('Test videos redundancy', function () {
698 }) 698 })
699 699
700 it('Should cache video 2 webseeds on the first video', async function () { 700 it('Should cache video 2 webseeds on the first video', async function () {
701 this.timeout(120000) 701 this.timeout(240000)
702 702
703 await waitJobs(servers) 703 await waitJobs(servers)
704 704
diff --git a/server/tests/api/server/email.ts b/server/tests/api/server/email.ts
index 5f97edbc2..cd8d70341 100644
--- a/server/tests/api/server/email.ts
+++ b/server/tests/api/server/email.ts
@@ -185,7 +185,7 @@ describe('Test emails', function () {
185 this.timeout(10000) 185 this.timeout(10000)
186 186
187 const reason = 'my super bad reason' 187 const reason = 'my super bad reason'
188 await server.abuses.report({ videoId, reason }) 188 await server.abuses.report({ token: userAccessToken, videoId, reason })
189 189
190 await waitJobs(server) 190 await waitJobs(server)
191 expect(emails).to.have.lengthOf(3) 191 expect(emails).to.have.lengthOf(3)
diff --git a/server/tests/api/videos/video-privacy.ts b/server/tests/api/videos/video-privacy.ts
index b51b3bcdd..08b624ff3 100644
--- a/server/tests/api/videos/video-privacy.ts
+++ b/server/tests/api/videos/video-privacy.ts
@@ -2,7 +2,15 @@
2 2
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { cleanupTests, createSingleServer, doubleFollow, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' 5import {
6 cleanupTests,
7 createSingleServer,
8 doubleFollow,
9 PeerTubeServer,
10 setAccessTokensToServers,
11 wait,
12 waitJobs
13} from '@shared/extra-utils'
6import { HttpStatusCode, VideoCreateResult, VideoPrivacy } from '@shared/models' 14import { HttpStatusCode, VideoCreateResult, VideoPrivacy } from '@shared/models'
7 15
8const expect = chai.expect 16const expect = chai.expect
@@ -209,7 +217,7 @@ describe('Test video privacy', function () {
209 describe('Privacy update', function () { 217 describe('Privacy update', function () {
210 218
211 it('Should update the private and internal videos to public on server 1', async function () { 219 it('Should update the private and internal videos to public on server 1', async function () {
212 this.timeout(10000) 220 this.timeout(100000)
213 221
214 now = Date.now() 222 now = Date.now()
215 223
@@ -230,6 +238,7 @@ describe('Test video privacy', function () {
230 await servers[0].videos.update({ id: internalVideoId, attributes }) 238 await servers[0].videos.update({ id: internalVideoId, attributes })
231 } 239 }
232 240
241 await wait(10000)
233 await waitJobs(servers) 242 await waitJobs(servers)
234 }) 243 })
235 244