Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Fix tests timeout

Chocobozzz59fd824cf343
diff --git a/scripts/ci.sh b/scripts/ci.sh
index dd4c283565..9399a0f590 100755
--- a/scripts/ci.sh
+++ b/scripts/ci.sh
@@ -27,7 +27,7 @@ runTest () {
joblog="$jobname-ci.log"
- parallel -j $jobs \
+ parallel -j $jobs --retries $retries \
"echo Trying {} >> $joblog; npm run mocha -- -c --timeout 30000 --exit --require ts-node/register --require tsconfig-paths/register --bail {}" \
::: $files
@@ -40,7 +40,7 @@ findTestFiles () {
}
if [ "$1" = "misc" ]; then
- npm run build -- --light
+ npm run build
feedsFiles=$(findTestFiles server/tests/feeds)
helperFiles=$(findTestFiles server/tests/helpers)
diff --git a/server/tests/api/check-params/live.ts b/server/tests/api/check-params/live.ts
index 7e76caf6e3..a5493572ba 100644
--- a/server/tests/api/check-params/live.ts
+++ b/server/tests/api/check-params/live.ts
@@ -402,7 +402,7 @@ describe('Test video lives API validator', function () {
})
it('Should fail to update a live if it has already started', async function () {
- this.timeout(20000)
+ this.timeout(40000)
const resLive = await getLive(server.url, server.accessToken, videoId)
const live: LiveVideo = resLive.body
@@ -416,7 +416,7 @@ describe('Test video lives API validator', function () {
})
it('Should fail to stream twice in the save live', async function () {
- this.timeout(30000)
+ this.timeout(40000)
const resLive = await getLive(server.url, server.accessToken, videoId)
const live: LiveVideo = resLive.body
diff --git a/server/tests/api/check-params/video-captions.ts b/server/tests/api/check-params/video-captions.ts
index e42e8db81b..2f049c03d2 100644
--- a/server/tests/api/check-params/video-captions.ts
+++ b/server/tests/api/check-params/video-captions.ts
@@ -58,7 +58,7 @@ describe('Test video captions API validator', function () {
await makeUploadRequest({
method: 'PUT',
url: server.url,
- path: path + '4da6fde3-88f7-4d16-b119-108df563d0b06/captions',
+ path: path + '4da6fde3-88f7-4d16-b119-108df563d0b06/captions/fr',
token: server.accessToken,
fields,
attaches
@@ -69,10 +69,11 @@ describe('Test video captions API validator', function () {
await makeUploadRequest({
method: 'PUT',
url: server.url,
- path: path + '4da6fde3-88f7-4d16-b119-108df5630b06/captions',
+ path: path + '4da6fde3-88f7-4d16-b119-108df5630b06/captions/fr',
token: server.accessToken,
fields,
- attaches
+ attaches,
+ statusCodeExpected: 404
})
})
diff --git a/server/tests/api/live/live-permanent.ts b/server/tests/api/live/live-permanent.ts
index 2701c65e3d..9e6c6cf70f 100644
--- a/server/tests/api/live/live-permanent.ts
+++ b/server/tests/api/live/live-permanent.ts
@@ -20,7 +20,8 @@ import {
updateLive,
wait,
waitJobs,
- waitUntilLivePublished
+ waitUntilLivePublished,
+ waitUntilLiveWaiting
} from '../../../../shared/extra-utils'
const expect = chai.expect
@@ -111,7 +112,7 @@ describe('Permenant live', function () {
})
it('Should stream into this permanent live', async function () {
- this.timeout(40000)
+ this.timeout(60000)
const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, videoUUID)
@@ -122,6 +123,7 @@ describe('Permenant live', function () {
await checkVideoState(videoUUID, VideoState.PUBLISHED)
await stopFfmpeg(command)
+ await waitUntilLiveWaiting(servers[0].url, servers[0].accessToken, videoUUID)
await waitJobs(servers)
})
diff --git a/server/tests/api/live/live-save-replay.ts b/server/tests/api/live/live-save-replay.ts
index bd683b2bfc..6cd8cc23f2 100644
--- a/server/tests/api/live/live-save-replay.ts
+++ b/server/tests/api/live/live-save-replay.ts
@@ -136,7 +136,7 @@ describe('Save replay setting', function () {
})
it('Should correctly delete the video files after the stream ended', async function () {
- this.timeout(30000)
+ this.timeout(40000)
await stopFfmpeg(ffmpegCommand)
@@ -146,6 +146,8 @@ describe('Save replay setting', function () {
await checkVideosExist(liveVideoUUID, false, HttpStatusCode.OK_200)
await checkVideoState(liveVideoUUID, VideoState.LIVE_ENDED)
+ await waitJobs(servers)
+
// No resolutions saved since we did not save replay
await checkLiveCleanup(servers[0], liveVideoUUID, [])
})
diff --git a/server/tests/api/notifications/moderation-notifications.ts b/server/tests/api/notifications/moderation-notifications.ts
index 24c91a365e..81f02ff993 100644
--- a/server/tests/api/notifications/moderation-notifications.ts
+++ b/server/tests/api/notifications/moderation-notifications.ts
@@ -546,7 +546,7 @@ describe('Test moderation notifications', function () {
})
it('Should send unblacklist but not published/subscription notes after unblacklisted if scheduled update pending', async function () {
- this.timeout(20000)
+ this.timeout(40000)
const updateAt = new Date(new Date().getTime() + 1000000)
@@ -578,7 +578,7 @@ describe('Test moderation notifications', function () {
})
it('Should not send publish/subscription notifications after scheduled update if video still auto-blacklisted', async function () {
- this.timeout(20000)
+ this.timeout(40000)
// In 2 seconds
const updateAt = new Date(new Date().getTime() + 2000)
@@ -604,7 +604,7 @@ describe('Test moderation notifications', function () {
})
it('Should not send a notification to moderators on new video without auto-blacklist', async function () {
- this.timeout(20000)
+ this.timeout(40000)
const name = 'video without auto-blacklist ' + uuidv4()
diff --git a/server/tests/api/notifications/user-notifications.ts b/server/tests/api/notifications/user-notifications.ts
index edc95b0699..6e7e7b19fc 100644
--- a/server/tests/api/notifications/user-notifications.ts
+++ b/server/tests/api/notifications/user-notifications.ts
@@ -65,7 +65,7 @@ describe('Test user notifications', function () {
})
it('Should not send notifications if the user does not follow the video publisher', async function () {
- this.timeout(30000)
+ this.timeout(50000)
await uploadRandomVideoOnServers(servers, 1)
@@ -97,7 +97,7 @@ describe('Test user notifications', function () {
})
it('Should send a new video notification on a scheduled publication', async function () {
- this.timeout(30000)
+ this.timeout(50000)
// In 2 seconds
const updateAt = new Date(new Date().getTime() + 2000)
@@ -136,7 +136,7 @@ describe('Test user notifications', function () {
})
it('Should not send a notification before the video is published', async function () {
- this.timeout(30000)
+ this.timeout(50000)
const updateAt = new Date(new Date().getTime() + 1000000)
@@ -154,7 +154,7 @@ describe('Test user notifications', function () {
})
it('Should send a new video notification when a video becomes public', async function () {
- this.timeout(30000)
+ this.timeout(50000)
const data = { privacy: VideoPrivacy.PRIVATE }
const { name, uuid } = await uploadRandomVideoOnServers(servers, 1, data)
@@ -168,7 +168,7 @@ describe('Test user notifications', function () {
})
it('Should send a new video notification when a remote video becomes public', async function () {
- this.timeout(30000)
+ this.timeout(50000)
const data = { privacy: VideoPrivacy.PRIVATE }
const { name, uuid } = await uploadRandomVideoOnServers(servers, 2, data)
@@ -182,7 +182,7 @@ describe('Test user notifications', function () {
})
it('Should not send a new video notification when a video becomes unlisted', async function () {
- this.timeout(30000)
+ this.timeout(50000)
const data = { privacy: VideoPrivacy.PRIVATE }
const { name, uuid } = await uploadRandomVideoOnServers(servers, 1, data)
@@ -193,7 +193,7 @@ describe('Test user notifications', function () {
})
it('Should not send a new video notification when a remote video becomes unlisted', async function () {
- this.timeout(30000)
+ this.timeout(50000)
const data = { privacy: VideoPrivacy.PRIVATE }
const { name, uuid } = await uploadRandomVideoOnServers(servers, 2, data)
@@ -237,7 +237,7 @@ describe('Test user notifications', function () {
})
it('Should not send a notification if transcoding is not enabled', async function () {
- this.timeout(30000)
+ this.timeout(50000)
const { name, uuid } = await uploadRandomVideoOnServers(servers, 1)
await waitJobs(servers)
@@ -416,7 +416,7 @@ describe('Test user notifications', function () {
})
it('Should notify when a local channel is following one of our channel', async function () {
- this.timeout(30000)
+ this.timeout(50000)
await addUserSubscription(servers[0].url, servers[0].accessToken, 'user_1_channel@localhost:' + servers[0].port)
await waitJobs(servers)
@@ -427,7 +427,7 @@ describe('Test user notifications', function () {
})
it('Should notify when a remote channel is following one of our channel', async function () {
- this.timeout(30000)
+ this.timeout(50000)
await addUserSubscription(servers[1].url, servers[1].accessToken, 'user_1_channel@localhost:' + servers[0].port)
await waitJobs(servers)
@@ -439,7 +439,7 @@ describe('Test user notifications', function () {
// PeerTube does not support accout -> account follows
// it('Should notify when a local account is following one of our channel', async function () {
- // this.timeout(30000)
+ // this.timeout(50000)
//
// await addUserSubscription(servers[0].url, servers[0].accessToken, 'user_1@localhost:' + servers[0].port)
//
@@ -449,7 +449,7 @@ describe('Test user notifications', function () {
// })
// it('Should notify when a remote account is following one of our channel', async function () {
- // this.timeout(30000)
+ // this.timeout(50000)
//
// await addUserSubscription(servers[1].url, servers[1].accessToken, 'user_1@localhost:' + servers[0].port)
//
diff --git a/server/tests/api/users/users-verification.ts b/server/tests/api/users/users-verification.ts
index 675ebf690e..e05acdd729 100644
--- a/server/tests/api/users/users-verification.ts
+++ b/server/tests/api/users/users-verification.ts
@@ -55,7 +55,8 @@ describe('Test users account verification', function () {
})
it('Should register user and send verification email if verification required', async function () {
- this.timeout(5000)
+ this.timeout(30000)
+
await updateCustomSubConfig(server.url, server.accessToken, {
signup: {
enabled: true,
diff --git a/server/tests/api/videos/video-captions.ts b/server/tests/api/videos/video-captions.ts
index 00e04d69d3..5b36dc0218 100644
--- a/server/tests/api/videos/video-captions.ts
+++ b/server/tests/api/videos/video-captions.ts
@@ -28,7 +28,7 @@ describe('Test video captions', function () {
let videoUUID: string
before(async function () {
- this.timeout(30000)
+ this.timeout(60000)
servers = await flushAndRunMultipleServers(2)
diff --git a/server/tests/api/videos/video-playlists.ts b/server/tests/api/videos/video-playlists.ts
index 0a96ea9a00..9dad58c8cc 100644
--- a/server/tests/api/videos/video-playlists.ts
+++ b/server/tests/api/videos/video-playlists.ts
@@ -1,7 +1,8 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
-import * as chai from 'chai'
import 'mocha'
+import * as chai from 'chai'
+import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
import {
addVideoChannel,
addVideoInPlaylist,
@@ -44,13 +45,6 @@ import {
wait,
waitJobs
} from '../../../../shared/extra-utils'
-import { VideoPlaylistPrivacy } from '../../../../shared/models/videos/playlist/video-playlist-privacy.model'
-import { VideoPlaylist } from '../../../../shared/models/videos/playlist/video-playlist.model'
-import { VideoPrivacy } from '../../../../shared/models/videos'
-import { VideoPlaylistType } from '../../../../shared/models/videos/playlist/video-playlist-type.model'
-import { VideoExistInPlaylist } from '../../../../shared/models/videos/playlist/video-exist-in-playlist.model'
-import { User } from '../../../../shared/models/users'
-import { VideoPlaylistElement, VideoPlaylistElementType } from '../../../../shared/models/videos/playlist/video-playlist-element.model'
import {
addAccountToAccountBlocklist,
addAccountToServerBlocklist,
@@ -61,7 +55,13 @@ import {
removeServerFromAccountBlocklist,
removeServerFromServerBlocklist
} from '../../../../shared/extra-utils/users/blocklist'
-import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
+import { User } from '../../../../shared/models/users'
+import { VideoPrivacy } from '../../../../shared/models/videos'
+import { VideoExistInPlaylist } from '../../../../shared/models/videos/playlist/video-exist-in-playlist.model'
+import { VideoPlaylistElement, VideoPlaylistElementType } from '../../../../shared/models/videos/playlist/video-playlist-element.model'
+import { VideoPlaylistPrivacy } from '../../../../shared/models/videos/playlist/video-playlist-privacy.model'
+import { VideoPlaylistType } from '../../../../shared/models/videos/playlist/video-playlist-type.model'
+import { VideoPlaylist } from '../../../../shared/models/videos/playlist/video-playlist.model'
const expect = chai.expect
@@ -123,24 +123,18 @@ describe('Test video playlists', function () {
await doubleFollow(servers[0], servers[2])
{
- const serverPromises: Promise<any>[][] = []
+ servers[0].videos = []
+ servers[1].videos = []
+ servers[2].videos = []
for (const server of servers) {
- const videoPromises: Promise<any>[] = []
-
for (let i = 0; i < 7; i++) {
- videoPromises.push(
- uploadVideo(server.url, server.accessToken, { name: `video ${i} server ${server.serverNumber}`, nsfw: false })
- .then(res => res.body.video)
- )
- }
+ const name = `video ${i} server ${server.serverNumber}`
+ const resVideo = await uploadVideo(server.url, server.accessToken, { name, nsfw: false })
- serverPromises.push(videoPromises)
+ server.videos.push(resVideo.body.video)
+ }
}
-
- servers[0].videos = await Promise.all(serverPromises[0])
- servers[1].videos = await Promise.all(serverPromises[1])
- servers[2].videos = await Promise.all(serverPromises[2])
}
nsfwVideoServer1 = (await uploadVideoAndGetId({ server: servers[0], videoName: 'NSFW video', nsfw: true })).id
diff --git a/server/tests/api/videos/videos-views-cleaner.ts b/server/tests/api/videos/videos-views-cleaner.ts
index c5b28540cc..b89f332171 100644
--- a/server/tests/api/videos/videos-views-cleaner.ts
+++ b/server/tests/api/videos/videos-views-cleaner.ts
@@ -27,7 +27,7 @@ describe('Test video views cleaner', function () {
let videoIdServer2: string
before(async function () {
- this.timeout(50000)
+ this.timeout(120000)
servers = await flushAndRunMultipleServers(2)
await setAccessTokensToServers(servers)
diff --git a/server/tests/plugins/plugin-helpers.ts b/server/tests/plugins/plugin-helpers.ts
index c0d95e1e0c..a585e30200 100644
--- a/server/tests/plugins/plugin-helpers.ts
+++ b/server/tests/plugins/plugin-helpers.ts
@@ -180,7 +180,7 @@ describe('Test plugin helpers', function () {
})
it('Should remove a video after a view', async function () {
- this.timeout(20000)
+ this.timeout(40000)
// Should not throw -> video exists
await getVideo(servers[0].url, videoUUID)
diff --git a/shared/extra-utils/videos/live.ts b/shared/extra-utils/videos/live.ts
index cbcfc09e4d..98f67a9bb0 100644
--- a/shared/extra-utils/videos/live.ts
+++ b/shared/extra-utils/videos/live.ts
@@ -119,7 +119,7 @@ async function testFfmpegStreamError (command: ffmpeg.FfmpegCommand, shouldHaveE
let error: Error
try {
- await waitFfmpegUntilError(command, 15000)
+ await waitFfmpegUntilError(command, 25000)
} catch (err) {
error = err
}
@@ -140,6 +140,10 @@ function waitUntilLivePublished (url: string, token: string, videoId: number | s
return waitUntilLiveState(url, token, videoId, VideoState.PUBLISHED)
}
+function waitUntilLiveWaiting (url: string, token: string, videoId: number | string) {
+ return waitUntilLiveState(url, token, videoId, VideoState.WAITING_FOR_LIVE)
+}
+
function waitUntilLiveEnded (url: string, token: string, videoId: number | string) {
return waitUntilLiveState(url, token, videoId, VideoState.LIVE_ENDED)
}
@@ -206,6 +210,7 @@ export {
checkLiveCleanup,
waitUntilLiveSegmentGeneration,
stopFfmpeg,
+ waitUntilLiveWaiting,
sendRTMPStreamInVideo,
waitUntilLiveEnded,
waitFfmpegUntilError,