1
0
Fork 0

Fix tests timeout

This commit is contained in:
Chocobozzz 2020-12-11 10:36:05 +01:00 committed by Chocobozzz
parent 34caef7fc0
commit 59fd824cf3
13 changed files with 57 additions and 52 deletions

View File

@ -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)

View File

@ -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

View File

@ -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
})
})

View File

@ -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)
})

View File

@ -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, [])
})

View File

@ -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()

View File

@ -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)
//

View File

@ -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,

View File

@ -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)

View File

@ -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 })
server.videos.push(resVideo.body.video)
}
serverPromises.push(videoPromises)
}
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

View File

@ -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)

View File

@ -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)

View File

@ -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,