From 59fd824cf3434a8417b73230f1840fed327e3495 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 11 Dec 2020 10:36:05 +0100 Subject: Fix tests timeout --- server/tests/api/check-params/live.ts | 4 +-- server/tests/api/check-params/video-captions.ts | 7 ++-- server/tests/api/live/live-permanent.ts | 6 ++-- server/tests/api/live/live-save-replay.ts | 4 ++- .../api/notifications/moderation-notifications.ts | 6 ++-- .../tests/api/notifications/user-notifications.ts | 24 +++++++------- server/tests/api/users/users-verification.ts | 3 +- server/tests/api/videos/video-captions.ts | 2 +- server/tests/api/videos/video-playlists.ts | 38 +++++++++------------- server/tests/api/videos/videos-views-cleaner.ts | 2 +- server/tests/plugins/plugin-helpers.ts | 2 +- 11 files changed, 49 insertions(+), 49 deletions(-) (limited to 'server/tests') diff --git a/server/tests/api/check-params/live.ts b/server/tests/api/check-params/live.ts index 7e76caf6e..a5493572b 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 e42e8db81..2f049c03d 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 2701c65e3..9e6c6cf70 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 bd683b2bf..6cd8cc23f 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 24c91a365..81f02ff99 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 edc95b069..6e7e7b19f 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 675ebf690..e05acdd72 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 00e04d69d..5b36dc021 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 0a96ea9a0..9dad58c8c 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[][] = [] + servers[0].videos = [] + servers[1].videos = [] + servers[2].videos = [] for (const server of servers) { - const videoPromises: Promise[] = [] - 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 c5b28540c..b89f33217 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 c0d95e1e0..a585e3020 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) -- cgit v1.2.3