mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-02-25 18:55:32 -06:00
Improve tests when waiting pending jobs
This commit is contained in:
@@ -14,9 +14,9 @@ import {
|
||||
killallServers,
|
||||
ServerInfo,
|
||||
setAccessTokensToServers,
|
||||
uploadVideo,
|
||||
wait
|
||||
uploadVideo
|
||||
} from '../utils'
|
||||
import { waitJobs } from '../utils/server/jobs'
|
||||
|
||||
const expect = chai.expect
|
||||
|
||||
@@ -54,14 +54,14 @@ describe('Test create import video jobs', function () {
|
||||
video2UUID = res2.body.video.uuid
|
||||
|
||||
// Transcoding
|
||||
await wait(40000)
|
||||
await waitJobs(servers)
|
||||
})
|
||||
|
||||
it('Should run a import job on video 1 with a lower resolution', async function () {
|
||||
const env = getEnvCli(servers[0])
|
||||
await execCLI(`${env} npm run create-import-video-file-job -- -v ${video1UUID} -i server/tests/fixtures/video_short-480.webm`)
|
||||
|
||||
await wait(30000)
|
||||
await waitJobs(servers)
|
||||
|
||||
let magnetUri: string
|
||||
for (const server of servers) {
|
||||
@@ -85,7 +85,7 @@ describe('Test create import video jobs', function () {
|
||||
const env = getEnvCli(servers[1])
|
||||
await execCLI(`${env} npm run create-import-video-file-job -- -v ${video2UUID} -i server/tests/fixtures/video_short.ogv`)
|
||||
|
||||
await wait(30000)
|
||||
await waitJobs(servers)
|
||||
|
||||
let magnetUri: string
|
||||
for (const server of servers) {
|
||||
@@ -111,7 +111,7 @@ describe('Test create import video jobs', function () {
|
||||
const env = getEnvCli(servers[0])
|
||||
await execCLI(`${env} npm run create-import-video-file-job -- -v ${video1UUID} -i server/tests/fixtures/video_short2.webm`)
|
||||
|
||||
await wait(30000)
|
||||
await waitJobs(servers)
|
||||
|
||||
let magnetUri: string
|
||||
for (const server of servers) {
|
||||
@@ -133,10 +133,5 @@ describe('Test create import video jobs', function () {
|
||||
|
||||
after(async function () {
|
||||
killallServers(servers)
|
||||
|
||||
// Keep the logs if the test failed
|
||||
if (this['ok']) {
|
||||
await flushTests()
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
@@ -3,22 +3,22 @@
|
||||
import 'mocha'
|
||||
import * as chai from 'chai'
|
||||
import { VideoDetails } from '../../../shared/models/videos'
|
||||
const expect = chai.expect
|
||||
|
||||
import {
|
||||
doubleFollow,
|
||||
execCLI,
|
||||
flushAndRunMultipleServers,
|
||||
flushTests,
|
||||
getEnvCli,
|
||||
getVideo,
|
||||
getVideosList,
|
||||
killallServers,
|
||||
parseTorrentVideo,
|
||||
runServer,
|
||||
ServerInfo,
|
||||
setAccessTokensToServers,
|
||||
uploadVideo,
|
||||
wait,
|
||||
getVideo, flushAndRunMultipleServers, doubleFollow
|
||||
uploadVideo, wait
|
||||
} from '../utils'
|
||||
import { waitJobs } from '../utils/server/jobs'
|
||||
|
||||
const expect = chai.expect
|
||||
|
||||
describe('Test create transcoding jobs', function () {
|
||||
let servers: ServerInfo[] = []
|
||||
@@ -40,7 +40,7 @@ describe('Test create transcoding jobs', function () {
|
||||
const res = await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'video2' })
|
||||
video2UUID = res.body.video.uuid
|
||||
|
||||
await wait(3000)
|
||||
await waitJobs(servers)
|
||||
})
|
||||
|
||||
it('Should have two video files on each server', async function () {
|
||||
@@ -65,7 +65,7 @@ describe('Test create transcoding jobs', function () {
|
||||
const env = getEnvCli(servers[0])
|
||||
await execCLI(`${env} npm run create-transcoding-job -- -v ${video2UUID}`)
|
||||
|
||||
await wait(40000)
|
||||
await waitJobs(servers)
|
||||
|
||||
for (const server of servers) {
|
||||
const res = await getVideosList(server.url)
|
||||
@@ -102,10 +102,5 @@ describe('Test create transcoding jobs', function () {
|
||||
|
||||
after(async function () {
|
||||
killallServers(servers)
|
||||
|
||||
// Keep the logs if the test failed
|
||||
if (this['ok']) {
|
||||
await flushTests()
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
@@ -36,10 +36,5 @@ describe('Test reset password scripts', function () {
|
||||
|
||||
after(async function () {
|
||||
killallServers([ server ])
|
||||
|
||||
// Keep the logs if the test failed
|
||||
if (this['ok']) {
|
||||
await flushTests()
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
@@ -3,22 +3,22 @@
|
||||
import 'mocha'
|
||||
import * as chai from 'chai'
|
||||
import { VideoDetails } from '../../../shared/models/videos'
|
||||
const expect = chai.expect
|
||||
|
||||
import {
|
||||
execCLI,
|
||||
flushTests,
|
||||
getEnvCli,
|
||||
getVideo,
|
||||
getVideosList,
|
||||
killallServers,
|
||||
parseTorrentVideo,
|
||||
runServer,
|
||||
ServerInfo,
|
||||
setAccessTokensToServers,
|
||||
uploadVideo,
|
||||
wait,
|
||||
getVideo
|
||||
uploadVideo
|
||||
} from '../utils'
|
||||
import { waitJobs } from '../utils/server/jobs'
|
||||
|
||||
const expect = chai.expect
|
||||
|
||||
describe('Test update host scripts', function () {
|
||||
let server: ServerInfo
|
||||
@@ -41,7 +41,8 @@ describe('Test update host scripts', function () {
|
||||
const videoAttributes = {}
|
||||
await uploadVideo(server.url, server.accessToken, videoAttributes)
|
||||
await uploadVideo(server.url, server.accessToken, videoAttributes)
|
||||
await wait(30000)
|
||||
|
||||
await waitJobs(server)
|
||||
})
|
||||
|
||||
it('Should update torrent hosts', async function () {
|
||||
@@ -82,10 +83,5 @@ describe('Test update host scripts', function () {
|
||||
|
||||
after(async function () {
|
||||
killallServers([ server ])
|
||||
|
||||
// Keep the logs if the test failed
|
||||
if (this['ok']) {
|
||||
await flushTests()
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user