/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
-import 'mocha'
-import * as chai from 'chai'
-import { completeVideoCheck } from '@server/tests/shared'
+import { expect } from 'chai'
+import { completeVideoCheck, SQLCommand } from '@server/tests/shared'
import { wait } from '@shared/core-utils'
import { HttpStatusCode, JobState, VideoCreateResult, VideoPrivacy } from '@shared/models'
import {
waitJobs
} from '@shared/server-commands'
-const expect = chai.expect
-
describe('Test handle downs', function () {
let servers: PeerTubeServer[] = []
+ let sqlCommands: SQLCommand[] = []
+
let threadIdServer1: number
let threadIdServer2: number
let commentIdServer1: number
support: 'my super support text for server 1',
account: {
name: 'root',
- host: 'localhost:' + servers[0].port
+ host: servers[0].host
},
isLocal: false,
duration: 10,
// Get the access tokens
await setAccessTokensToServers(servers)
+
+ sqlCommands = servers.map(s => new SQLCommand(s))
})
it('Should remove followers that are often down', async function () {
const body = await servers[0].follows.getFollowers({ start: 0, count: 2, sort: 'createdAt' })
expect(body.data).to.be.an('array')
expect(body.data).to.have.lengthOf(1)
- expect(body.data[0].follower.host).to.equal('localhost:' + servers[2].port)
+ expect(body.data[0].follower.host).to.equal(servers[2].host)
})
it('Should not have pending/processing jobs anymore', async function () {
for (const state of states) {
const body = await servers[0].jobs.list({
- state: state,
+ state,
start: 0,
count: 50,
sort: '-createdAt'
// Check unlisted video
const video = await servers[2].videos.get({ id: unlistedVideo.uuid })
- await completeVideoCheck(servers[2], video, unlistedCheckAttributes)
+ await completeVideoCheck({ server: servers[2], originServer: servers[0], videoUUID: video.uuid, attributes: unlistedCheckAttributes })
})
it('Should send comments on a video to server 3, and automatically fetch the video', async function () {
})
it('Should upload many videos on server 1', async function () {
- this.timeout(120000)
+ this.timeout(240000)
for (let i = 0; i < 10; i++) {
const uuid = (await servers[0].videos.quickUpload({ name: 'video ' + i })).uuid
}
await waitJobs(servers)
- await servers[1].sql.setActorFollowScores(20)
+ await sqlCommands[1].setActorFollowScores(20)
// Wait video expiration
await wait(11000)
})
after(async function () {
+ for (const sqlCommand of sqlCommands) {
+ await sqlCommand.cleanup()
+ }
+
await cleanupTests(servers)
})
})