Use an object to represent a server

This commit is contained in:
Chocobozzz 2021-07-16 09:47:51 +02:00
parent 89d241a79c
commit 254d3579f5
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
154 changed files with 1068 additions and 1056 deletions

View File

@ -1,12 +1,12 @@
import * as autocannon from 'autocannon' import * as autocannon from 'autocannon'
import { writeJson } from 'fs-extra' import { writeJson } from 'fs-extra'
import { flushAndRunServer, killallServers, ServerInfo, setAccessTokensToServers } from '@shared/extra-utils' import { createSingleServer, killallServers, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils'
import { Video, VideoPrivacy } from '@shared/models' import { Video, VideoPrivacy } from '@shared/models'
import { registerTSPaths } from '../server/helpers/register-ts-paths' import { registerTSPaths } from '../server/helpers/register-ts-paths'
registerTSPaths() registerTSPaths()
let server: ServerInfo let server: PeerTubeServer
let video: Video let video: Video
let threadId: number let threadId: number
@ -188,7 +188,7 @@ function runBenchmark (options: {
} }
async function prepare () { async function prepare () {
server = await flushAndRunServer(1, { server = await createSingleServer(1, {
rates_limit: { rates_limit: {
api: { api: {
max: 5_000_000 max: 5_000_000

View File

@ -5,8 +5,8 @@ import * as chai from 'chai'
import { import {
cleanupTests, cleanupTests,
doubleFollow, doubleFollow,
flushAndRunMultipleServers, createMultipleServers,
ServerInfo, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
wait, wait,
waitJobs waitJobs
@ -15,7 +15,7 @@ import {
const expect = chai.expect const expect = chai.expect
describe('Test AP cleaner', function () { describe('Test AP cleaner', function () {
let servers: ServerInfo[] = [] let servers: PeerTubeServer[] = []
let videoUUID1: string let videoUUID1: string
let videoUUID2: string let videoUUID2: string
let videoUUID3: string let videoUUID3: string
@ -30,7 +30,7 @@ describe('Test AP cleaner', function () {
videos: { cleanup_remote_interactions: true } videos: { cleanup_remote_interactions: true }
} }
} }
servers = await flushAndRunMultipleServers(3, config) servers = await createMultipleServers(3, config)
// Get the access tokens // Get the access tokens
await setAccessTokensToServers(servers) await setAccessTokensToServers(servers)

View File

@ -6,9 +6,9 @@ import { HttpStatusCode } from '@shared/core-utils'
import { import {
cleanupTests, cleanupTests,
doubleFollow, doubleFollow,
flushAndRunMultipleServers, createMultipleServers,
makeActivityPubGetRequest, makeActivityPubGetRequest,
ServerInfo, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
setDefaultVideoChannel setDefaultVideoChannel
} from '@shared/extra-utils' } from '@shared/extra-utils'
@ -17,7 +17,7 @@ import { VideoPlaylistPrivacy } from '@shared/models'
const expect = chai.expect const expect = chai.expect
describe('Test activitypub', function () { describe('Test activitypub', function () {
let servers: ServerInfo[] = [] let servers: PeerTubeServer[] = []
let video: { id: number, uuid: string, shortUUID: string } let video: { id: number, uuid: string, shortUUID: string }
let playlist: { id: number, uuid: string, shortUUID: string } let playlist: { id: number, uuid: string, shortUUID: string }
@ -62,7 +62,7 @@ describe('Test activitypub', function () {
before(async function () { before(async function () {
this.timeout(30000) this.timeout(30000)
servers = await flushAndRunMultipleServers(2) servers = await createMultipleServers(2)
await setAccessTokensToServers(servers) await setAccessTokensToServers(servers)
await setDefaultVideoChannel(servers) await setDefaultVideoChannel(servers)

View File

@ -2,19 +2,19 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { cleanupTests, doubleFollow, flushAndRunMultipleServers, ServerInfo, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' import { cleanupTests, doubleFollow, createMultipleServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
const expect = chai.expect const expect = chai.expect
describe('Test ActivityPub fetcher', function () { describe('Test ActivityPub fetcher', function () {
let servers: ServerInfo[] let servers: PeerTubeServer[]
// --------------------------------------------------------------- // ---------------------------------------------------------------
before(async function () { before(async function () {
this.timeout(60000) this.timeout(60000)
servers = await flushAndRunMultipleServers(3) servers = await createMultipleServers(3)
// Get the access tokens // Get the access tokens
await setAccessTokensToServers(servers) await setAccessTokensToServers(servers)

View File

@ -5,10 +5,9 @@ import { HttpStatusCode } from '@shared/core-utils'
import { import {
cleanupTests, cleanupTests,
doubleFollow, doubleFollow,
flushAndRunMultipleServers, createMultipleServers,
killallServers, killallServers,
reRunServer, PeerTubeServer,
ServerInfo,
setAccessTokensToServers, setAccessTokensToServers,
setDefaultVideoChannel, setDefaultVideoChannel,
wait, wait,
@ -17,7 +16,7 @@ import {
import { VideoPlaylistPrivacy } from '@shared/models' import { VideoPlaylistPrivacy } from '@shared/models'
describe('Test AP refresher', function () { describe('Test AP refresher', function () {
let servers: ServerInfo[] = [] let servers: PeerTubeServer[] = []
let videoUUID1: string let videoUUID1: string
let videoUUID2: string let videoUUID2: string
let videoUUID3: string let videoUUID3: string
@ -27,7 +26,7 @@ describe('Test AP refresher', function () {
before(async function () { before(async function () {
this.timeout(60000) this.timeout(60000)
servers = await flushAndRunMultipleServers(2, { transcoding: { enabled: false } }) servers = await createMultipleServers(2, { transcoding: { enabled: false } })
// Get the access tokens // Get the access tokens
await setAccessTokensToServers(servers) await setAccessTokensToServers(servers)
@ -95,7 +94,7 @@ describe('Test AP refresher', function () {
// The refresh should fail // The refresh should fail
await waitJobs([ servers[0] ]) await waitJobs([ servers[0] ])
await reRunServer(servers[1]) await servers[1].run()
await servers[0].videos.get({ id: videoUUID3 }) await servers[0].videos.get({ id: videoUUID3 })
}) })

View File

@ -7,10 +7,9 @@ import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-c
import { import {
buildAbsoluteFixturePath, buildAbsoluteFixturePath,
cleanupTests, cleanupTests,
flushAndRunMultipleServers, createMultipleServers,
killallServers, killallServers,
reRunServer, PeerTubeServer,
ServerInfo,
wait wait
} from '../../../../shared/extra-utils' } from '../../../../shared/extra-utils'
import { makeFollowRequest, makePOSTAPRequest } from '../../../../shared/extra-utils/requests/activitypub' import { makeFollowRequest, makePOSTAPRequest } from '../../../../shared/extra-utils/requests/activitypub'
@ -20,7 +19,7 @@ import { buildGlobalHeaders } from '../../../lib/job-queue/handlers/utils/activi
const expect = chai.expect const expect = chai.expect
function setKeysOfServer (onServer: ServerInfo, ofServer: ServerInfo, publicKey: string, privateKey: string) { function setKeysOfServer (onServer: PeerTubeServer, ofServer: PeerTubeServer, publicKey: string, privateKey: string) {
const url = 'http://localhost:' + ofServer.port + '/accounts/peertube' const url = 'http://localhost:' + ofServer.port + '/accounts/peertube'
return Promise.all([ return Promise.all([
@ -29,7 +28,7 @@ function setKeysOfServer (onServer: ServerInfo, ofServer: ServerInfo, publicKey:
]) ])
} }
function setUpdatedAtOfServer (onServer: ServerInfo, ofServer: ServerInfo, updatedAt: string) { function setUpdatedAtOfServer (onServer: PeerTubeServer, ofServer: PeerTubeServer, updatedAt: string) {
const url = 'http://localhost:' + ofServer.port + '/accounts/peertube' const url = 'http://localhost:' + ofServer.port + '/accounts/peertube'
return Promise.all([ return Promise.all([
@ -38,7 +37,7 @@ function setUpdatedAtOfServer (onServer: ServerInfo, ofServer: ServerInfo, updat
]) ])
} }
function getAnnounceWithoutContext (server: ServerInfo) { function getAnnounceWithoutContext (server: PeerTubeServer) {
const json = require(buildAbsoluteFixturePath('./ap-json/peertube/announce-without-context.json')) const json = require(buildAbsoluteFixturePath('./ap-json/peertube/announce-without-context.json'))
const result: typeof json = {} const result: typeof json = {}
@ -54,7 +53,7 @@ function getAnnounceWithoutContext (server: ServerInfo) {
} }
describe('Test ActivityPub security', function () { describe('Test ActivityPub security', function () {
let servers: ServerInfo[] let servers: PeerTubeServer[]
let url: string let url: string
const keys = require(buildAbsoluteFixturePath('./ap-json/peertube/keys.json')) const keys = require(buildAbsoluteFixturePath('./ap-json/peertube/keys.json'))
@ -72,7 +71,7 @@ describe('Test ActivityPub security', function () {
before(async function () { before(async function () {
this.timeout(60000) this.timeout(60000)
servers = await flushAndRunMultipleServers(3) servers = await createMultipleServers(3)
url = servers[0].url + '/inbox' url = servers[0].url + '/inbox'
@ -172,7 +171,7 @@ describe('Test ActivityPub security', function () {
// Invalid peertube actor cache // Invalid peertube actor cache
await killallServers([ servers[1] ]) await killallServers([ servers[1] ])
await reRunServer(servers[1]) await servers[1].run()
const body = activityPubContextify(getAnnounceWithoutContext(servers[1])) const body = activityPubContextify(getAnnounceWithoutContext(servers[1]))
const headers = buildGlobalHeaders(body) const headers = buildGlobalHeaders(body)

View File

@ -9,10 +9,10 @@ import {
checkBadStartPagination, checkBadStartPagination,
cleanupTests, cleanupTests,
doubleFollow, doubleFollow,
flushAndRunServer, createSingleServer,
makeGetRequest, makeGetRequest,
makePostBodyRequest, makePostBodyRequest,
ServerInfo, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
waitJobs waitJobs
} from '@shared/extra-utils' } from '@shared/extra-utils'
@ -21,7 +21,7 @@ import { AbuseCreate, AbuseState } from '@shared/models'
describe('Test abuses API validators', function () { describe('Test abuses API validators', function () {
const basePath = '/api/v1/abuses/' const basePath = '/api/v1/abuses/'
let server: ServerInfo let server: PeerTubeServer
let userToken = '' let userToken = ''
let userToken2 = '' let userToken2 = ''
@ -35,7 +35,7 @@ describe('Test abuses API validators', function () {
before(async function () { before(async function () {
this.timeout(30000) this.timeout(30000)
server = await flushAndRunServer(1) server = await createSingleServer(1)
await setAccessTokensToServers([ server ]) await setAccessTokensToServers([ server ])
@ -404,12 +404,12 @@ describe('Test abuses API validators', function () {
describe('When trying to manage messages of a remote abuse', function () { describe('When trying to manage messages of a remote abuse', function () {
let remoteAbuseId: number let remoteAbuseId: number
let anotherServer: ServerInfo let anotherServer: PeerTubeServer
before(async function () { before(async function () {
this.timeout(50000) this.timeout(50000)
anotherServer = await flushAndRunServer(2) anotherServer = await createSingleServer(2)
await setAccessTokensToServers([ anotherServer ]) await setAccessTokensToServers([ anotherServer ])
await doubleFollow(anotherServer, server) await doubleFollow(anotherServer, server)

View File

@ -7,20 +7,20 @@ import {
checkBadSortPagination, checkBadSortPagination,
checkBadStartPagination, checkBadStartPagination,
cleanupTests, cleanupTests,
flushAndRunServer, createSingleServer,
ServerInfo PeerTubeServer
} from '@shared/extra-utils' } from '@shared/extra-utils'
describe('Test accounts API validators', function () { describe('Test accounts API validators', function () {
const path = '/api/v1/accounts/' const path = '/api/v1/accounts/'
let server: ServerInfo let server: PeerTubeServer
// --------------------------------------------------------------- // ---------------------------------------------------------------
before(async function () { before(async function () {
this.timeout(30000) this.timeout(30000)
server = await flushAndRunServer(1) server = await createSingleServer(1)
}) })
describe('When listing accounts', function () { describe('When listing accounts', function () {

View File

@ -5,11 +5,11 @@ import 'mocha'
import { import {
cleanupTests, cleanupTests,
doubleFollow, doubleFollow,
flushAndRunMultipleServers, createMultipleServers,
makeDeleteRequest, makeDeleteRequest,
makeGetRequest, makeGetRequest,
makePostBodyRequest, makePostBodyRequest,
ServerInfo, PeerTubeServer,
setAccessTokensToServers setAccessTokensToServers
} from '../../../../shared/extra-utils' } from '../../../../shared/extra-utils'
import { import {
@ -20,14 +20,14 @@ import {
import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
describe('Test blocklist API validators', function () { describe('Test blocklist API validators', function () {
let servers: ServerInfo[] let servers: PeerTubeServer[]
let server: ServerInfo let server: PeerTubeServer
let userAccessToken: string let userAccessToken: string
before(async function () { before(async function () {
this.timeout(60000) this.timeout(60000)
servers = await flushAndRunMultipleServers(2) servers = await createMultipleServers(2)
await setAccessTokensToServers(servers) await setAccessTokensToServers(servers)
server = servers[0] server = servers[0]

View File

@ -3,15 +3,15 @@
import 'mocha' import 'mocha'
import { import {
cleanupTests, cleanupTests,
flushAndRunServer, createSingleServer,
ServerInfo, PeerTubeServer,
setAccessTokensToServers setAccessTokensToServers
} from '../../../../shared/extra-utils' } from '../../../../shared/extra-utils'
import { makePostBodyRequest } from '../../../../shared/extra-utils/requests/requests' import { makePostBodyRequest } from '../../../../shared/extra-utils/requests/requests'
import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
describe('Test bulk API validators', function () { describe('Test bulk API validators', function () {
let server: ServerInfo let server: PeerTubeServer
let userAccessToken: string let userAccessToken: string
// --------------------------------------------------------------- // ---------------------------------------------------------------
@ -19,7 +19,7 @@ describe('Test bulk API validators', function () {
before(async function () { before(async function () {
this.timeout(120000) this.timeout(120000)
server = await flushAndRunServer(1) server = await createSingleServer(1)
await setAccessTokensToServers([ server ]) await setAccessTokensToServers([ server ])
const user = { username: 'user1', password: 'password' } const user = { username: 'user1', password: 'password' }

View File

@ -5,18 +5,18 @@ import { omit } from 'lodash'
import { HttpStatusCode } from '@shared/core-utils' import { HttpStatusCode } from '@shared/core-utils'
import { import {
cleanupTests, cleanupTests,
flushAndRunServer, createSingleServer,
makeDeleteRequest, makeDeleteRequest,
makeGetRequest, makeGetRequest,
makePutBodyRequest, makePutBodyRequest,
ServerInfo, PeerTubeServer,
setAccessTokensToServers setAccessTokensToServers
} from '@shared/extra-utils' } from '@shared/extra-utils'
import { CustomConfig } from '@shared/models' import { CustomConfig } from '@shared/models'
describe('Test config API validators', function () { describe('Test config API validators', function () {
const path = '/api/v1/config/custom' const path = '/api/v1/config/custom'
let server: ServerInfo let server: PeerTubeServer
let userAccessToken: string let userAccessToken: string
const updateParams: CustomConfig = { const updateParams: CustomConfig = {
instance: { instance: {
@ -197,7 +197,7 @@ describe('Test config API validators', function () {
before(async function () { before(async function () {
this.timeout(30000) this.timeout(30000)
server = await flushAndRunServer(1) server = await createSingleServer(1)
await setAccessTokensToServers([ server ]) await setAccessTokensToServers([ server ])

View File

@ -2,11 +2,11 @@
import 'mocha' import 'mocha'
import { HttpStatusCode } from '@shared/core-utils' import { HttpStatusCode } from '@shared/core-utils'
import { cleanupTests, flushAndRunServer, killallServers, MockSmtpServer, reRunServer, ServerInfo } from '@shared/extra-utils' import { cleanupTests, createSingleServer, killallServers, MockSmtpServer, PeerTubeServer } from '@shared/extra-utils'
import { ContactFormCommand } from '@shared/extra-utils/server' import { ContactFormCommand } from '@shared/extra-utils/server'
describe('Test contact form API validators', function () { describe('Test contact form API validators', function () {
let server: ServerInfo let server: PeerTubeServer
const emails: object[] = [] const emails: object[] = []
const defaultBody = { const defaultBody = {
fromName: 'super name', fromName: 'super name',
@ -25,7 +25,7 @@ describe('Test contact form API validators', function () {
emailPort = await MockSmtpServer.Instance.collectEmails(emails) emailPort = await MockSmtpServer.Instance.collectEmails(emails)
// Email is disabled // Email is disabled
server = await flushAndRunServer(1) server = await createSingleServer(1)
command = server.contactForm command = server.contactForm
}) })
@ -39,7 +39,7 @@ describe('Test contact form API validators', function () {
await killallServers([ server ]) await killallServers([ server ])
// Contact form is disabled // Contact form is disabled
await reRunServer(server, { smtp: { hostname: 'localhost', port: emailPort }, contact_form: { enabled: false } }) await server.run({ smtp: { hostname: 'localhost', port: emailPort }, contact_form: { enabled: false } })
await command.send({ ...defaultBody, expectedStatus: HttpStatusCode.CONFLICT_409 }) await command.send({ ...defaultBody, expectedStatus: HttpStatusCode.CONFLICT_409 })
}) })
@ -49,7 +49,7 @@ describe('Test contact form API validators', function () {
await killallServers([ server ]) await killallServers([ server ])
// Email & contact form enabled // Email & contact form enabled
await reRunServer(server, { smtp: { hostname: 'localhost', port: emailPort } }) await server.run({ smtp: { hostname: 'localhost', port: emailPort } })
await command.send({ ...defaultBody, fromEmail: 'badEmail', expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) await command.send({ ...defaultBody, fromEmail: 'badEmail', expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
await command.send({ ...defaultBody, fromEmail: 'badEmail@', expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) await command.send({ ...defaultBody, fromEmail: 'badEmail@', expectedStatus: HttpStatusCode.BAD_REQUEST_400 })

View File

@ -4,8 +4,8 @@ import 'mocha'
import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
import { import {
cleanupTests, cleanupTests,
flushAndRunServer, createSingleServer,
ServerInfo, PeerTubeServer,
setAccessTokensToServers setAccessTokensToServers
} from '../../../../shared/extra-utils' } from '../../../../shared/extra-utils'
import { makeGetRequest, makePutBodyRequest } from '../../../../shared/extra-utils/requests/requests' import { makeGetRequest, makePutBodyRequest } from '../../../../shared/extra-utils/requests/requests'
@ -13,7 +13,7 @@ import { makeGetRequest, makePutBodyRequest } from '../../../../shared/extra-uti
describe('Test custom pages validators', function () { describe('Test custom pages validators', function () {
const path = '/api/v1/custom-pages/homepage/instance' const path = '/api/v1/custom-pages/homepage/instance'
let server: ServerInfo let server: PeerTubeServer
let userAccessToken: string let userAccessToken: string
// --------------------------------------------------------------- // ---------------------------------------------------------------
@ -21,7 +21,7 @@ describe('Test custom pages validators', function () {
before(async function () { before(async function () {
this.timeout(120000) this.timeout(120000)
server = await flushAndRunServer(1) server = await createSingleServer(1)
await setAccessTokensToServers([ server ]) await setAccessTokensToServers([ server ])
const user = { username: 'user1', password: 'password' } const user = { username: 'user1', password: 'password' }

View File

@ -4,8 +4,8 @@ import 'mocha'
import { import {
cleanupTests, cleanupTests,
flushAndRunServer, createSingleServer,
ServerInfo, PeerTubeServer,
setAccessTokensToServers setAccessTokensToServers
} from '../../../../shared/extra-utils' } from '../../../../shared/extra-utils'
import { makeGetRequest } from '../../../../shared/extra-utils/requests/requests' import { makeGetRequest } from '../../../../shared/extra-utils/requests/requests'
@ -13,7 +13,7 @@ import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-c
describe('Test debug API validators', function () { describe('Test debug API validators', function () {
const path = '/api/v1/server/debug' const path = '/api/v1/server/debug'
let server: ServerInfo let server: PeerTubeServer
let userAccessToken = '' let userAccessToken = ''
// --------------------------------------------------------------- // ---------------------------------------------------------------
@ -21,7 +21,7 @@ describe('Test debug API validators', function () {
before(async function () { before(async function () {
this.timeout(120000) this.timeout(120000)
server = await flushAndRunServer(1) server = await createSingleServer(1)
await setAccessTokensToServers([ server ]) await setAccessTokensToServers([ server ])

View File

@ -4,10 +4,10 @@ import 'mocha'
import { import {
cleanupTests, cleanupTests,
flushAndRunServer, createSingleServer,
makeDeleteRequest, makeGetRequest, makeDeleteRequest, makeGetRequest,
makePostBodyRequest, makePostBodyRequest,
ServerInfo, PeerTubeServer,
setAccessTokensToServers setAccessTokensToServers
} from '../../../../shared/extra-utils' } from '../../../../shared/extra-utils'
import { import {
@ -18,14 +18,14 @@ import {
import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
describe('Test server follows API validators', function () { describe('Test server follows API validators', function () {
let server: ServerInfo let server: PeerTubeServer
// --------------------------------------------------------------- // ---------------------------------------------------------------
before(async function () { before(async function () {
this.timeout(30000) this.timeout(30000)
server = await flushAndRunServer(1) server = await createSingleServer(1)
await setAccessTokensToServers([ server ]) await setAccessTokensToServers([ server ])
}) })

View File

@ -4,8 +4,8 @@ import 'mocha'
import { import {
cleanupTests, cleanupTests,
flushAndRunServer, createSingleServer,
ServerInfo, PeerTubeServer,
setAccessTokensToServers setAccessTokensToServers
} from '../../../../shared/extra-utils' } from '../../../../shared/extra-utils'
import { import {
@ -18,7 +18,7 @@ import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-c
describe('Test jobs API validators', function () { describe('Test jobs API validators', function () {
const path = '/api/v1/jobs/failed' const path = '/api/v1/jobs/failed'
let server: ServerInfo let server: PeerTubeServer
let userAccessToken = '' let userAccessToken = ''
// --------------------------------------------------------------- // ---------------------------------------------------------------
@ -26,7 +26,7 @@ describe('Test jobs API validators', function () {
before(async function () { before(async function () {
this.timeout(120000) this.timeout(120000)
server = await flushAndRunServer(1) server = await createSingleServer(1)
await setAccessTokensToServers([ server ]) await setAccessTokensToServers([ server ])

View File

@ -6,12 +6,12 @@ import { HttpStatusCode } from '@shared/core-utils'
import { import {
buildAbsoluteFixturePath, buildAbsoluteFixturePath,
cleanupTests, cleanupTests,
flushAndRunServer, createSingleServer,
LiveCommand, LiveCommand,
makePostBodyRequest, makePostBodyRequest,
makeUploadRequest, makeUploadRequest,
sendRTMPStream, sendRTMPStream,
ServerInfo, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
stopFfmpeg stopFfmpeg
} from '@shared/extra-utils' } from '@shared/extra-utils'
@ -19,7 +19,7 @@ import { VideoCreateResult, VideoPrivacy } from '@shared/models'
describe('Test video lives API validator', function () { describe('Test video lives API validator', function () {
const path = '/api/v1/videos/live' const path = '/api/v1/videos/live'
let server: ServerInfo let server: PeerTubeServer
let userAccessToken = '' let userAccessToken = ''
let channelId: number let channelId: number
let video: VideoCreateResult let video: VideoCreateResult
@ -31,7 +31,7 @@ describe('Test video lives API validator', function () {
before(async function () { before(async function () {
this.timeout(30000) this.timeout(30000)
server = await flushAndRunServer(1) server = await createSingleServer(1)
await setAccessTokensToServers([ server ]) await setAccessTokensToServers([ server ])

View File

@ -4,8 +4,8 @@ import 'mocha'
import { import {
cleanupTests, cleanupTests,
flushAndRunServer, createSingleServer,
ServerInfo, PeerTubeServer,
setAccessTokensToServers setAccessTokensToServers
} from '../../../../shared/extra-utils' } from '../../../../shared/extra-utils'
import { makeGetRequest } from '../../../../shared/extra-utils/requests/requests' import { makeGetRequest } from '../../../../shared/extra-utils/requests/requests'
@ -13,7 +13,7 @@ import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-c
describe('Test logs API validators', function () { describe('Test logs API validators', function () {
const path = '/api/v1/server/logs' const path = '/api/v1/server/logs'
let server: ServerInfo let server: PeerTubeServer
let userAccessToken = '' let userAccessToken = ''
// --------------------------------------------------------------- // ---------------------------------------------------------------
@ -21,7 +21,7 @@ describe('Test logs API validators', function () {
before(async function () { before(async function () {
this.timeout(120000) this.timeout(120000)
server = await flushAndRunServer(1) server = await createSingleServer(1)
await setAccessTokensToServers([ server ]) await setAccessTokensToServers([ server ])

View File

@ -7,17 +7,17 @@ import {
checkBadSortPagination, checkBadSortPagination,
checkBadStartPagination, checkBadStartPagination,
cleanupTests, cleanupTests,
flushAndRunServer, createSingleServer,
makeGetRequest, makeGetRequest,
makePostBodyRequest, makePostBodyRequest,
makePutBodyRequest, makePutBodyRequest,
ServerInfo, PeerTubeServer,
setAccessTokensToServers setAccessTokensToServers
} from '@shared/extra-utils' } from '@shared/extra-utils'
import { PeerTubePlugin, PluginType } from '@shared/models' import { PeerTubePlugin, PluginType } from '@shared/models'
describe('Test server plugins API validators', function () { describe('Test server plugins API validators', function () {
let server: ServerInfo let server: PeerTubeServer
let userAccessToken = null let userAccessToken = null
const npmPlugin = 'peertube-plugin-hello-world' const npmPlugin = 'peertube-plugin-hello-world'
@ -33,7 +33,7 @@ describe('Test server plugins API validators', function () {
before(async function () { before(async function () {
this.timeout(30000) this.timeout(30000)
server = await flushAndRunServer(1) server = await createSingleServer(1)
await setAccessTokensToServers([ server ]) await setAccessTokensToServers([ server ])

View File

@ -9,18 +9,18 @@ import {
checkBadStartPagination, checkBadStartPagination,
cleanupTests, cleanupTests,
doubleFollow, doubleFollow,
flushAndRunMultipleServers, createMultipleServers,
makeDeleteRequest, makeDeleteRequest,
makeGetRequest, makeGetRequest,
makePostBodyRequest, makePostBodyRequest,
makePutBodyRequest, makePutBodyRequest,
ServerInfo, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
waitJobs waitJobs
} from '../../../../shared/extra-utils' } from '../../../../shared/extra-utils'
describe('Test server redundancy API validators', function () { describe('Test server redundancy API validators', function () {
let servers: ServerInfo[] let servers: PeerTubeServer[]
let userAccessToken = null let userAccessToken = null
let videoIdLocal: number let videoIdLocal: number
let videoRemote: VideoCreateResult let videoRemote: VideoCreateResult
@ -30,7 +30,7 @@ describe('Test server redundancy API validators', function () {
before(async function () { before(async function () {
this.timeout(80000) this.timeout(80000)
servers = await flushAndRunMultipleServers(2) servers = await createMultipleServers(2)
await setAccessTokensToServers(servers) await setAccessTokensToServers(servers)
await doubleFollow(servers[0], servers[1]) await doubleFollow(servers[0], servers[1])

View File

@ -7,13 +7,13 @@ import {
checkBadSortPagination, checkBadSortPagination,
checkBadStartPagination, checkBadStartPagination,
cleanupTests, cleanupTests,
flushAndRunServer, createSingleServer,
makeGetRequest, makeGetRequest,
ServerInfo, PeerTubeServer,
setAccessTokensToServers setAccessTokensToServers
} from '@shared/extra-utils' } from '@shared/extra-utils'
function updateSearchIndex (server: ServerInfo, enabled: boolean, disableLocalSearch = false) { function updateSearchIndex (server: PeerTubeServer, enabled: boolean, disableLocalSearch = false) {
return server.config.updateCustomSubConfig({ return server.config.updateCustomSubConfig({
newConfig: { newConfig: {
search: { search: {
@ -27,14 +27,14 @@ function updateSearchIndex (server: ServerInfo, enabled: boolean, disableLocalSe
} }
describe('Test videos API validator', function () { describe('Test videos API validator', function () {
let server: ServerInfo let server: PeerTubeServer
// --------------------------------------------------------------- // ---------------------------------------------------------------
before(async function () { before(async function () {
this.timeout(30000) this.timeout(30000)
server = await flushAndRunServer(1) server = await createSingleServer(1)
await setAccessTokensToServers([ server ]) await setAccessTokensToServers([ server ])
}) })

View File

@ -4,16 +4,16 @@ import 'mocha'
import { HttpStatusCode } from '@shared/core-utils' import { HttpStatusCode } from '@shared/core-utils'
import { import {
cleanupTests, cleanupTests,
flushAndRunServer, createSingleServer,
makeGetRequest, makeGetRequest,
ServerInfo, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
setDefaultVideoChannel setDefaultVideoChannel
} from '@shared/extra-utils' } from '@shared/extra-utils'
import { VideoPlaylistPrivacy } from '@shared/models' import { VideoPlaylistPrivacy } from '@shared/models'
describe('Test services API validators', function () { describe('Test services API validators', function () {
let server: ServerInfo let server: PeerTubeServer
let playlistUUID: string let playlistUUID: string
// --------------------------------------------------------------- // ---------------------------------------------------------------
@ -21,7 +21,7 @@ describe('Test services API validators', function () {
before(async function () { before(async function () {
this.timeout(60000) this.timeout(60000)
server = await flushAndRunServer(1) server = await createSingleServer(1)
await setAccessTokensToServers([ server ]) await setAccessTokensToServers([ server ])
await setDefaultVideoChannel([ server ]) await setDefaultVideoChannel([ server ])
@ -120,7 +120,7 @@ describe('Test services API validators', function () {
}) })
}) })
function checkParamEmbed (server: ServerInfo, embedUrl: string, statusCodeExpected = HttpStatusCode.BAD_REQUEST_400, query = {}) { function checkParamEmbed (server: PeerTubeServer, embedUrl: string, statusCodeExpected = HttpStatusCode.BAD_REQUEST_400, query = {}) {
const path = '/services/oembed' const path = '/services/oembed'
return makeGetRequest({ return makeGetRequest({

View File

@ -5,9 +5,9 @@ import { expect } from 'chai'
import { HttpStatusCode, randomInt } from '@shared/core-utils' import { HttpStatusCode, randomInt } from '@shared/core-utils'
import { import {
cleanupTests, cleanupTests,
flushAndRunServer, createSingleServer,
ImportsCommand, ImportsCommand,
ServerInfo, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
setDefaultVideoChannel, setDefaultVideoChannel,
VideosCommand, VideosCommand,
@ -16,7 +16,7 @@ import {
import { VideoImportState, VideoPrivacy } from '@shared/models' import { VideoImportState, VideoPrivacy } from '@shared/models'
describe('Test upload quota', function () { describe('Test upload quota', function () {
let server: ServerInfo let server: PeerTubeServer
let rootId: number let rootId: number
let command: VideosCommand let command: VideosCommand
@ -25,7 +25,7 @@ describe('Test upload quota', function () {
before(async function () { before(async function () {
this.timeout(30000) this.timeout(30000)
server = await flushAndRunServer(1) server = await createSingleServer(1)
await setAccessTokensToServers([ server ]) await setAccessTokensToServers([ server ])
await setDefaultVideoChannel([ server ]) await setDefaultVideoChannel([ server ])

View File

@ -8,25 +8,25 @@ import {
checkBadSortPagination, checkBadSortPagination,
checkBadStartPagination, checkBadStartPagination,
cleanupTests, cleanupTests,
flushAndRunServer, createSingleServer,
makeGetRequest, makeGetRequest,
makePostBodyRequest, makePostBodyRequest,
makePutBodyRequest, makePutBodyRequest,
ServerInfo, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
wait wait
} from '@shared/extra-utils' } from '@shared/extra-utils'
import { UserNotificationSetting, UserNotificationSettingValue } from '@shared/models' import { UserNotificationSetting, UserNotificationSettingValue } from '@shared/models'
describe('Test user notifications API validators', function () { describe('Test user notifications API validators', function () {
let server: ServerInfo let server: PeerTubeServer
// --------------------------------------------------------------- // ---------------------------------------------------------------
before(async function () { before(async function () {
this.timeout(30000) this.timeout(30000)
server = await flushAndRunServer(1) server = await createSingleServer(1)
await setAccessTokensToServers([ server ]) await setAccessTokensToServers([ server ])
}) })

View File

@ -4,11 +4,11 @@ import 'mocha'
import { import {
cleanupTests, cleanupTests,
flushAndRunServer, createSingleServer,
makeDeleteRequest, makeDeleteRequest,
makeGetRequest, makeGetRequest,
makePostBodyRequest, makePostBodyRequest,
ServerInfo, PeerTubeServer,
setAccessTokensToServers setAccessTokensToServers
} from '../../../../shared/extra-utils' } from '../../../../shared/extra-utils'
@ -22,7 +22,7 @@ import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-c
describe('Test user subscriptions API validators', function () { describe('Test user subscriptions API validators', function () {
const path = '/api/v1/users/me/subscriptions' const path = '/api/v1/users/me/subscriptions'
let server: ServerInfo let server: PeerTubeServer
let userAccessToken = '' let userAccessToken = ''
// --------------------------------------------------------------- // ---------------------------------------------------------------
@ -30,7 +30,7 @@ describe('Test user subscriptions API validators', function () {
before(async function () { before(async function () {
this.timeout(30000) this.timeout(30000)
server = await flushAndRunServer(1) server = await createSingleServer(1)
await setAccessTokensToServers([ server ]) await setAccessTokensToServers([ server ])

View File

@ -9,15 +9,14 @@ import {
checkBadSortPagination, checkBadSortPagination,
checkBadStartPagination, checkBadStartPagination,
cleanupTests, cleanupTests,
flushAndRunServer, createSingleServer,
killallServers, killallServers,
makeGetRequest, makeGetRequest,
makePostBodyRequest, makePostBodyRequest,
makePutBodyRequest, makePutBodyRequest,
makeUploadRequest, makeUploadRequest,
MockSmtpServer, MockSmtpServer,
reRunServer, PeerTubeServer,
ServerInfo,
setAccessTokensToServers, setAccessTokensToServers,
UsersCommand UsersCommand
} from '@shared/extra-utils' } from '@shared/extra-utils'
@ -29,8 +28,8 @@ describe('Test users API validators', function () {
let rootId: number let rootId: number
let moderatorId: number let moderatorId: number
let video: VideoCreateResult let video: VideoCreateResult
let server: ServerInfo let server: PeerTubeServer
let serverWithRegistrationDisabled: ServerInfo let serverWithRegistrationDisabled: PeerTubeServer
let userToken = '' let userToken = ''
let moderatorToken = '' let moderatorToken = ''
let emailPort: number let emailPort: number
@ -48,8 +47,8 @@ describe('Test users API validators', function () {
{ {
const res = await Promise.all([ const res = await Promise.all([
flushAndRunServer(1, overrideConfig), createSingleServer(1, overrideConfig),
flushAndRunServer(2) createSingleServer(2)
]) ])
server = res[0] server = res[0]
@ -196,7 +195,7 @@ describe('Test users API validators', function () {
port: emailPort port: emailPort
} }
} }
await reRunServer(server, config) await server.run(config)
const fields = { const fields = {
...baseCorrectParams, ...baseCorrectParams,

View File

@ -10,17 +10,17 @@ import {
checkBadStartPagination, checkBadStartPagination,
cleanupTests, cleanupTests,
doubleFollow, doubleFollow,
flushAndRunMultipleServers, createMultipleServers,
makePostBodyRequest, makePostBodyRequest,
makePutBodyRequest, makePutBodyRequest,
ServerInfo, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
waitJobs waitJobs
} from '@shared/extra-utils' } from '@shared/extra-utils'
import { VideoBlacklistType } from '@shared/models' import { VideoBlacklistType } from '@shared/models'
describe('Test video blacklist API validators', function () { describe('Test video blacklist API validators', function () {
let servers: ServerInfo[] let servers: PeerTubeServer[]
let notBlacklistedVideoId: string let notBlacklistedVideoId: string
let remoteVideoUUID: string let remoteVideoUUID: string
let userAccessToken1 = '' let userAccessToken1 = ''
@ -32,7 +32,7 @@ describe('Test video blacklist API validators', function () {
before(async function () { before(async function () {
this.timeout(120000) this.timeout(120000)
servers = await flushAndRunMultipleServers(2) servers = await createMultipleServers(2)
await setAccessTokensToServers(servers) await setAccessTokensToServers(servers)
await doubleFollow(servers[0], servers[1]) await doubleFollow(servers[0], servers[1])

View File

@ -5,11 +5,11 @@ import { HttpStatusCode } from '@shared/core-utils'
import { import {
buildAbsoluteFixturePath, buildAbsoluteFixturePath,
cleanupTests, cleanupTests,
flushAndRunServer, createSingleServer,
makeDeleteRequest, makeDeleteRequest,
makeGetRequest, makeGetRequest,
makeUploadRequest, makeUploadRequest,
ServerInfo, PeerTubeServer,
setAccessTokensToServers setAccessTokensToServers
} from '@shared/extra-utils' } from '@shared/extra-utils'
import { VideoCreateResult } from '@shared/models' import { VideoCreateResult } from '@shared/models'
@ -17,7 +17,7 @@ import { VideoCreateResult } from '@shared/models'
describe('Test video captions API validator', function () { describe('Test video captions API validator', function () {
const path = '/api/v1/videos/' const path = '/api/v1/videos/'
let server: ServerInfo let server: PeerTubeServer
let userAccessToken: string let userAccessToken: string
let video: VideoCreateResult let video: VideoCreateResult
@ -26,7 +26,7 @@ describe('Test video captions API validator', function () {
before(async function () { before(async function () {
this.timeout(30000) this.timeout(30000)
server = await flushAndRunServer(1) server = await createSingleServer(1)
await setAccessTokensToServers([ server ]) await setAccessTokensToServers([ server ])

View File

@ -11,12 +11,12 @@ import {
checkBadSortPagination, checkBadSortPagination,
checkBadStartPagination, checkBadStartPagination,
cleanupTests, cleanupTests,
flushAndRunServer, createSingleServer,
makeGetRequest, makeGetRequest,
makePostBodyRequest, makePostBodyRequest,
makePutBodyRequest, makePutBodyRequest,
makeUploadRequest, makeUploadRequest,
ServerInfo, PeerTubeServer,
setAccessTokensToServers setAccessTokensToServers
} from '@shared/extra-utils' } from '@shared/extra-utils'
import { VideoChannelUpdate } from '@shared/models' import { VideoChannelUpdate } from '@shared/models'
@ -25,7 +25,7 @@ const expect = chai.expect
describe('Test video channels API validator', function () { describe('Test video channels API validator', function () {
const videoChannelPath = '/api/v1/video-channels' const videoChannelPath = '/api/v1/video-channels'
let server: ServerInfo let server: PeerTubeServer
let accessTokenUser: string let accessTokenUser: string
let command: ChannelsCommand let command: ChannelsCommand
@ -34,7 +34,7 @@ describe('Test video channels API validator', function () {
before(async function () { before(async function () {
this.timeout(30000) this.timeout(30000)
server = await flushAndRunServer(1) server = await createSingleServer(1)
await setAccessTokensToServers([ server ]) await setAccessTokensToServers([ server ])

View File

@ -8,11 +8,11 @@ import {
checkBadSortPagination, checkBadSortPagination,
checkBadStartPagination, checkBadStartPagination,
cleanupTests, cleanupTests,
flushAndRunServer, createSingleServer,
makeDeleteRequest, makeDeleteRequest,
makeGetRequest, makeGetRequest,
makePostBodyRequest, makePostBodyRequest,
ServerInfo, PeerTubeServer,
setAccessTokensToServers setAccessTokensToServers
} from '@shared/extra-utils' } from '@shared/extra-utils'
import { VideoCreateResult } from '@shared/models' import { VideoCreateResult } from '@shared/models'
@ -22,7 +22,7 @@ const expect = chai.expect
describe('Test video comments API validator', function () { describe('Test video comments API validator', function () {
let pathThread: string let pathThread: string
let pathComment: string let pathComment: string
let server: ServerInfo let server: PeerTubeServer
let video: VideoCreateResult let video: VideoCreateResult
let userAccessToken: string let userAccessToken: string
let userAccessToken2: string let userAccessToken2: string
@ -33,7 +33,7 @@ describe('Test video comments API validator', function () {
before(async function () { before(async function () {
this.timeout(30000) this.timeout(30000)
server = await flushAndRunServer(1) server = await createSingleServer(1)
await setAccessTokensToServers([ server ]) await setAccessTokensToServers([ server ])

View File

@ -9,19 +9,19 @@ import {
checkBadSortPagination, checkBadSortPagination,
checkBadStartPagination, checkBadStartPagination,
cleanupTests, cleanupTests,
flushAndRunServer, createSingleServer,
ImportsCommand, ImportsCommand,
makeGetRequest, makeGetRequest,
makePostBodyRequest, makePostBodyRequest,
makeUploadRequest, makeUploadRequest,
ServerInfo, PeerTubeServer,
setAccessTokensToServers setAccessTokensToServers
} from '@shared/extra-utils' } from '@shared/extra-utils'
import { VideoPrivacy } from '@shared/models' import { VideoPrivacy } from '@shared/models'
describe('Test video imports API validator', function () { describe('Test video imports API validator', function () {
const path = '/api/v1/videos/imports' const path = '/api/v1/videos/imports'
let server: ServerInfo let server: PeerTubeServer
let userAccessToken = '' let userAccessToken = ''
let channelId: number let channelId: number
@ -30,7 +30,7 @@ describe('Test video imports API validator', function () {
before(async function () { before(async function () {
this.timeout(30000) this.timeout(30000)
server = await flushAndRunServer(1) server = await createSingleServer(1)
await setAccessTokensToServers([ server ]) await setAccessTokensToServers([ server ])

View File

@ -7,10 +7,10 @@ import {
checkBadSortPagination, checkBadSortPagination,
checkBadStartPagination, checkBadStartPagination,
cleanupTests, cleanupTests,
flushAndRunServer, createSingleServer,
makeGetRequest, makeGetRequest,
PlaylistsCommand, PlaylistsCommand,
ServerInfo, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
setDefaultVideoChannel setDefaultVideoChannel
} from '@shared/extra-utils' } from '@shared/extra-utils'
@ -25,7 +25,7 @@ import {
} from '@shared/models' } from '@shared/models'
describe('Test video playlists API validator', function () { describe('Test video playlists API validator', function () {
let server: ServerInfo let server: PeerTubeServer
let userAccessToken: string let userAccessToken: string
let playlist: VideoPlaylistCreateResult let playlist: VideoPlaylistCreateResult
@ -42,7 +42,7 @@ describe('Test video playlists API validator', function () {
before(async function () { before(async function () {
this.timeout(30000) this.timeout(30000)
server = await flushAndRunServer(1) server = await createSingleServer(1)
await setAccessTokensToServers([ server ]) await setAccessTokensToServers([ server ])
await setDefaultVideoChannel([ server ]) await setDefaultVideoChannel([ server ])

View File

@ -3,16 +3,16 @@
import 'mocha' import 'mocha'
import { import {
cleanupTests, cleanupTests,
flushAndRunServer, createSingleServer,
makeGetRequest, makeGetRequest,
ServerInfo, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
setDefaultVideoChannel setDefaultVideoChannel
} from '../../../../shared/extra-utils' } from '../../../../shared/extra-utils'
import { UserRole } from '../../../../shared/models/users' import { UserRole } from '../../../../shared/models/users'
import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
async function testEndpoints (server: ServerInfo, token: string, filter: string, statusCodeExpected: HttpStatusCode) { async function testEndpoints (server: PeerTubeServer, token: string, filter: string, statusCodeExpected: HttpStatusCode) {
const paths = [ const paths = [
'/api/v1/video-channels/root_channel/videos', '/api/v1/video-channels/root_channel/videos',
'/api/v1/accounts/root/videos', '/api/v1/accounts/root/videos',
@ -34,7 +34,7 @@ async function testEndpoints (server: ServerInfo, token: string, filter: string,
} }
describe('Test video filters validators', function () { describe('Test video filters validators', function () {
let server: ServerInfo let server: PeerTubeServer
let userAccessToken: string let userAccessToken: string
let moderatorAccessToken: string let moderatorAccessToken: string
@ -43,7 +43,7 @@ describe('Test video filters validators', function () {
before(async function () { before(async function () {
this.timeout(30000) this.timeout(30000)
server = await flushAndRunServer(1) server = await createSingleServer(1)
await setAccessTokensToServers([ server ]) await setAccessTokensToServers([ server ])
await setDefaultVideoChannel([ server ]) await setDefaultVideoChannel([ server ])

View File

@ -6,11 +6,11 @@ import {
checkBadCountPagination, checkBadCountPagination,
checkBadStartPagination, checkBadStartPagination,
cleanupTests, cleanupTests,
flushAndRunServer, createSingleServer,
makeGetRequest, makeGetRequest,
makePostBodyRequest, makePostBodyRequest,
makePutBodyRequest, makePutBodyRequest,
ServerInfo, PeerTubeServer,
setAccessTokensToServers setAccessTokensToServers
} from '@shared/extra-utils' } from '@shared/extra-utils'
@ -18,14 +18,14 @@ describe('Test videos history API validator', function () {
const myHistoryPath = '/api/v1/users/me/history/videos' const myHistoryPath = '/api/v1/users/me/history/videos'
const myHistoryRemove = myHistoryPath + '/remove' const myHistoryRemove = myHistoryPath + '/remove'
let watchingPath: string let watchingPath: string
let server: ServerInfo let server: PeerTubeServer
// --------------------------------------------------------------- // ---------------------------------------------------------------
before(async function () { before(async function () {
this.timeout(30000) this.timeout(30000)
server = await flushAndRunServer(1) server = await createSingleServer(1)
await setAccessTokensToServers([ server ]) await setAccessTokensToServers([ server ])

View File

@ -1,17 +1,17 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import 'mocha' import 'mocha'
import { cleanupTests, flushAndRunServer, ServerInfo } from '@shared/extra-utils' import { cleanupTests, createSingleServer, PeerTubeServer } from '@shared/extra-utils'
describe('Test videos overview', function () { describe('Test videos overview', function () {
let server: ServerInfo let server: PeerTubeServer
// --------------------------------------------------------------- // ---------------------------------------------------------------
before(async function () { before(async function () {
this.timeout(30000) this.timeout(30000)
server = await flushAndRunServer(1) server = await createSingleServer(1)
}) })
describe('When getting videos overview', function () { describe('When getting videos overview', function () {

View File

@ -11,13 +11,13 @@ import {
checkBadStartPagination, checkBadStartPagination,
checkUploadVideoParam, checkUploadVideoParam,
cleanupTests, cleanupTests,
flushAndRunServer, createSingleServer,
makeDeleteRequest, makeDeleteRequest,
makeGetRequest, makeGetRequest,
makePutBodyRequest, makePutBodyRequest,
makeUploadRequest, makeUploadRequest,
root, root,
ServerInfo, PeerTubeServer,
setAccessTokensToServers setAccessTokensToServers
} from '@shared/extra-utils' } from '@shared/extra-utils'
import { PeerTubeProblemDocument, VideoCreateResult, VideoPrivacy } from '@shared/models' import { PeerTubeProblemDocument, VideoCreateResult, VideoPrivacy } from '@shared/models'
@ -26,7 +26,7 @@ const expect = chai.expect
describe('Test videos API validator', function () { describe('Test videos API validator', function () {
const path = '/api/v1/videos/' const path = '/api/v1/videos/'
let server: ServerInfo let server: PeerTubeServer
let userAccessToken = '' let userAccessToken = ''
let accountName: string let accountName: string
let channelId: number let channelId: number
@ -38,7 +38,7 @@ describe('Test videos API validator', function () {
before(async function () { before(async function () {
this.timeout(30000) this.timeout(30000)
server = await flushAndRunServer(1) server = await createSingleServer(1)
await setAccessTokensToServers([ server ]) await setAccessTokensToServers([ server ])

View File

@ -8,8 +8,8 @@ import {
cleanupTests, cleanupTests,
ConfigCommand, ConfigCommand,
doubleFollow, doubleFollow,
flushAndRunMultipleServers, createMultipleServers,
ServerInfo, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
setDefaultVideoChannel, setDefaultVideoChannel,
wait, wait,
@ -19,7 +19,7 @@ import {
const expect = chai.expect const expect = chai.expect
describe('Test live constraints', function () { describe('Test live constraints', function () {
let servers: ServerInfo[] = [] let servers: PeerTubeServer[] = []
let userId: number let userId: number
let userAccessToken: string let userAccessToken: string
let userChannelId: number let userChannelId: number
@ -63,7 +63,7 @@ describe('Test live constraints', function () {
before(async function () { before(async function () {
this.timeout(120000) this.timeout(120000)
servers = await flushAndRunMultipleServers(2) servers = await createMultipleServers(2)
// Get the access tokens // Get the access tokens
await setAccessTokensToServers(servers) await setAccessTokensToServers(servers)

View File

@ -7,8 +7,8 @@ import {
cleanupTests, cleanupTests,
ConfigCommand, ConfigCommand,
doubleFollow, doubleFollow,
flushAndRunMultipleServers, createMultipleServers,
ServerInfo, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
setDefaultVideoChannel, setDefaultVideoChannel,
stopFfmpeg, stopFfmpeg,
@ -19,7 +19,7 @@ import {
const expect = chai.expect const expect = chai.expect
describe('Permanent live', function () { describe('Permanent live', function () {
let servers: ServerInfo[] = [] let servers: PeerTubeServer[] = []
let videoUUID: string let videoUUID: string
async function createLiveWrapper (permanentLive: boolean) { async function createLiveWrapper (permanentLive: boolean) {
@ -45,7 +45,7 @@ describe('Permanent live', function () {
before(async function () { before(async function () {
this.timeout(120000) this.timeout(120000)
servers = await flushAndRunMultipleServers(2) servers = await createMultipleServers(2)
// Get the access tokens // Get the access tokens
await setAccessTokensToServers(servers) await setAccessTokensToServers(servers)

View File

@ -9,8 +9,8 @@ import {
cleanupTests, cleanupTests,
ConfigCommand, ConfigCommand,
doubleFollow, doubleFollow,
flushAndRunMultipleServers, createMultipleServers,
ServerInfo, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
setDefaultVideoChannel, setDefaultVideoChannel,
stopFfmpeg, stopFfmpeg,
@ -23,7 +23,7 @@ import { LiveVideoCreate, VideoPrivacy, VideoState } from '@shared/models'
const expect = chai.expect const expect = chai.expect
describe('Save replay setting', function () { describe('Save replay setting', function () {
let servers: ServerInfo[] = [] let servers: PeerTubeServer[] = []
let liveVideoUUID: string let liveVideoUUID: string
let ffmpegCommand: FfmpegCommand let ffmpegCommand: FfmpegCommand
@ -82,7 +82,7 @@ describe('Save replay setting', function () {
before(async function () { before(async function () {
this.timeout(120000) this.timeout(120000)
servers = await flushAndRunMultipleServers(2) servers = await createMultipleServers(2)
// Get the access tokens // Get the access tokens
await setAccessTokensToServers(servers) await setAccessTokensToServers(servers)

View File

@ -6,8 +6,8 @@ import { VideoPrivacy, VideoState } from '@shared/models'
import { import {
cleanupTests, cleanupTests,
doubleFollow, doubleFollow,
flushAndRunMultipleServers, createMultipleServers,
ServerInfo, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
setDefaultVideoChannel, setDefaultVideoChannel,
stopFfmpeg, stopFfmpeg,
@ -19,12 +19,12 @@ import {
const expect = chai.expect const expect = chai.expect
describe('Test live', function () { describe('Test live', function () {
let servers: ServerInfo[] = [] let servers: PeerTubeServer[] = []
before(async function () { before(async function () {
this.timeout(120000) this.timeout(120000)
servers = await flushAndRunMultipleServers(2) servers = await createMultipleServers(2)
// Get the access tokens // Get the access tokens
await setAccessTokensToServers(servers) await setAccessTokensToServers(servers)

View File

@ -7,8 +7,8 @@ import { VideoPrivacy } from '@shared/models'
import { import {
cleanupTests, cleanupTests,
doubleFollow, doubleFollow,
flushAndRunMultipleServers, createMultipleServers,
ServerInfo, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
setDefaultVideoChannel, setDefaultVideoChannel,
stopFfmpeg, stopFfmpeg,
@ -20,12 +20,12 @@ import {
const expect = chai.expect const expect = chai.expect
describe('Test live', function () { describe('Test live', function () {
let servers: ServerInfo[] = [] let servers: PeerTubeServer[] = []
before(async function () { before(async function () {
this.timeout(120000) this.timeout(120000)
servers = await flushAndRunMultipleServers(2) servers = await createMultipleServers(2)
// Get the access tokens // Get the access tokens
await setAccessTokensToServers(servers) await setAccessTokensToServers(servers)

View File

@ -11,13 +11,12 @@ import {
checkResolutionsInMasterPlaylist, checkResolutionsInMasterPlaylist,
cleanupTests, cleanupTests,
doubleFollow, doubleFollow,
flushAndRunMultipleServers, createMultipleServers,
killallServers, killallServers,
LiveCommand, LiveCommand,
makeRawRequest, makeRawRequest,
reRunServer,
sendRTMPStream, sendRTMPStream,
ServerInfo, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
setDefaultVideoChannel, setDefaultVideoChannel,
stopFfmpeg, stopFfmpeg,
@ -32,13 +31,13 @@ import { LiveVideo, LiveVideoCreate, VideoDetails, VideoPrivacy, VideoState, Vid
const expect = chai.expect const expect = chai.expect
describe('Test live', function () { describe('Test live', function () {
let servers: ServerInfo[] = [] let servers: PeerTubeServer[] = []
let commands: LiveCommand[] let commands: LiveCommand[]
before(async function () { before(async function () {
this.timeout(120000) this.timeout(120000)
servers = await flushAndRunMultipleServers(2) servers = await createMultipleServers(2)
// Get the access tokens // Get the access tokens
await setAccessTokensToServers(servers) await setAccessTokensToServers(servers)
@ -571,7 +570,7 @@ describe('Test live', function () {
await commands[0].waitUntilSegmentGeneration({ videoUUID: liveVideoReplayId, resolution: 0, segment: 2 }) await commands[0].waitUntilSegmentGeneration({ videoUUID: liveVideoReplayId, resolution: 0, segment: 2 })
await killallServers([ servers[0] ]) await killallServers([ servers[0] ])
await reRunServer(servers[0]) await servers[0].run()
await wait(5000) await wait(5000)
}) })

View File

@ -6,8 +6,8 @@ import {
AbusesCommand, AbusesCommand,
cleanupTests, cleanupTests,
doubleFollow, doubleFollow,
flushAndRunMultipleServers, createMultipleServers,
ServerInfo, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
waitJobs waitJobs
} from '@shared/extra-utils' } from '@shared/extra-utils'
@ -16,7 +16,7 @@ import { AbuseMessage, AbusePredefinedReasonsString, AbuseState, AdminAbuse, Use
const expect = chai.expect const expect = chai.expect
describe('Test abuses', function () { describe('Test abuses', function () {
let servers: ServerInfo[] = [] let servers: PeerTubeServer[] = []
let abuseServer1: AdminAbuse let abuseServer1: AdminAbuse
let abuseServer2: AdminAbuse let abuseServer2: AdminAbuse
let commands: AbusesCommand[] let commands: AbusesCommand[]
@ -25,7 +25,7 @@ describe('Test abuses', function () {
this.timeout(50000) this.timeout(50000)
// Run servers // Run servers
servers = await flushAndRunMultipleServers(2) servers = await createMultipleServers(2)
// Get the access tokens // Get the access tokens
await setAccessTokensToServers(servers) await setAccessTokensToServers(servers)
@ -389,7 +389,7 @@ describe('Test abuses', function () {
describe('Comment abuses', function () { describe('Comment abuses', function () {
async function getComment (server: ServerInfo, videoIdArg: number | string) { async function getComment (server: PeerTubeServer, videoIdArg: number | string) {
const videoId = typeof videoIdArg === 'string' const videoId = typeof videoIdArg === 'string'
? await server.videos.getId({ uuid: videoIdArg }) ? await server.videos.getId({ uuid: videoIdArg })
: videoIdArg : videoIdArg
@ -591,7 +591,7 @@ describe('Test abuses', function () {
describe('Account abuses', function () { describe('Account abuses', function () {
function getAccountFromServer (server: ServerInfo, targetName: string, targetServer: ServerInfo) { function getAccountFromServer (server: PeerTubeServer, targetName: string, targetServer: PeerTubeServer) {
return server.accounts.get({ accountName: targetName + '@' + targetServer.host }) return server.accounts.get({ accountName: targetName + '@' + targetServer.host })
} }

View File

@ -2,12 +2,12 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { cleanupTests, doubleFollow, flushAndRunMultipleServers, ServerInfo, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' import { cleanupTests, doubleFollow, createMultipleServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
import { UserNotificationType } from '@shared/models' import { UserNotificationType } from '@shared/models'
const expect = chai.expect const expect = chai.expect
async function checkNotifications (server: ServerInfo, token: string, expected: UserNotificationType[]) { async function checkNotifications (server: PeerTubeServer, token: string, expected: UserNotificationType[]) {
const { data } = await server.notifications.list({ token, start: 0, count: 10, unread: true }) const { data } = await server.notifications.list({ token, start: 0, count: 10, unread: true })
expect(data).to.have.lengthOf(expected.length) expect(data).to.have.lengthOf(expected.length)
@ -17,7 +17,7 @@ async function checkNotifications (server: ServerInfo, token: string, expected:
} }
describe('Test blocklist', function () { describe('Test blocklist', function () {
let servers: ServerInfo[] let servers: PeerTubeServer[]
let videoUUID: string let videoUUID: string
let userToken1: string let userToken1: string
@ -62,7 +62,7 @@ describe('Test blocklist', function () {
before(async function () { before(async function () {
this.timeout(60000) this.timeout(60000)
servers = await flushAndRunMultipleServers(2) servers = await createMultipleServers(2)
await setAccessTokensToServers(servers) await setAccessTokensToServers(servers)
{ {

View File

@ -7,8 +7,8 @@ import {
cleanupTests, cleanupTests,
CommentsCommand, CommentsCommand,
doubleFollow, doubleFollow,
flushAndRunMultipleServers, createMultipleServers,
ServerInfo, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
waitJobs waitJobs
} from '@shared/extra-utils' } from '@shared/extra-utils'
@ -16,7 +16,7 @@ import { UserNotificationType } from '@shared/models'
const expect = chai.expect const expect = chai.expect
async function checkAllVideos (server: ServerInfo, token: string) { async function checkAllVideos (server: PeerTubeServer, token: string) {
{ {
const { data } = await server.videos.listWithToken({ token }) const { data } = await server.videos.listWithToken({ token })
expect(data).to.have.lengthOf(5) expect(data).to.have.lengthOf(5)
@ -28,7 +28,7 @@ async function checkAllVideos (server: ServerInfo, token: string) {
} }
} }
async function checkAllComments (server: ServerInfo, token: string, videoUUID: string) { async function checkAllComments (server: PeerTubeServer, token: string, videoUUID: string) {
const { data } = await server.comments.listThreads({ videoId: videoUUID, start: 0, count: 25, sort: '-createdAt', token }) const { data } = await server.comments.listThreads({ videoId: videoUUID, start: 0, count: 25, sort: '-createdAt', token })
const threads = data.filter(t => t.isDeleted === false) const threads = data.filter(t => t.isDeleted === false)
@ -41,8 +41,8 @@ async function checkAllComments (server: ServerInfo, token: string, videoUUID: s
} }
async function checkCommentNotification ( async function checkCommentNotification (
mainServer: ServerInfo, mainServer: PeerTubeServer,
comment: { server: ServerInfo, token: string, videoUUID: string, text: string }, comment: { server: PeerTubeServer, token: string, videoUUID: string, text: string },
check: 'presence' | 'absence' check: 'presence' | 'absence'
) { ) {
const command = comment.server.comments const command = comment.server.comments
@ -63,7 +63,7 @@ async function checkCommentNotification (
} }
describe('Test blocklist', function () { describe('Test blocklist', function () {
let servers: ServerInfo[] let servers: PeerTubeServer[]
let videoUUID1: string let videoUUID1: string
let videoUUID2: string let videoUUID2: string
let videoUUID3: string let videoUUID3: string
@ -77,7 +77,7 @@ describe('Test blocklist', function () {
before(async function () { before(async function () {
this.timeout(120000) this.timeout(120000)
servers = await flushAndRunMultipleServers(3) servers = await createMultipleServers(3)
await setAccessTokensToServers(servers) await setAccessTokensToServers(servers)
command = servers[0].blocklist command = servers[0].blocklist

View File

@ -7,11 +7,10 @@ import {
BlacklistCommand, BlacklistCommand,
cleanupTests, cleanupTests,
doubleFollow, doubleFollow,
flushAndRunMultipleServers, createMultipleServers,
ImportsCommand, ImportsCommand,
killallServers, killallServers,
reRunServer, PeerTubeServer,
ServerInfo,
setAccessTokensToServers, setAccessTokensToServers,
waitJobs waitJobs
} from '@shared/extra-utils' } from '@shared/extra-utils'
@ -20,11 +19,11 @@ import { UserAdminFlag, UserRole, VideoBlacklist, VideoBlacklistType } from '@sh
const expect = chai.expect const expect = chai.expect
describe('Test video blacklist', function () { describe('Test video blacklist', function () {
let servers: ServerInfo[] = [] let servers: PeerTubeServer[] = []
let videoId: number let videoId: number
let command: BlacklistCommand let command: BlacklistCommand
async function blacklistVideosOnServer (server: ServerInfo) { async function blacklistVideosOnServer (server: PeerTubeServer) {
const { data } = await server.videos.list() const { data } = await server.videos.list()
for (const video of data) { for (const video of data) {
@ -36,7 +35,7 @@ describe('Test video blacklist', function () {
this.timeout(50000) this.timeout(50000)
// Run servers // Run servers
servers = await flushAndRunMultipleServers(2) servers = await createMultipleServers(2)
// Get the access tokens // Get the access tokens
await setAccessTokensToServers(servers) await setAccessTokensToServers(servers)
@ -344,7 +343,7 @@ describe('Test video blacklist', function () {
} }
} }
} }
await reRunServer(servers[0], config) await servers[0].run(config)
{ {
const user = { username: 'user_without_flag', password: 'password' } const user = { username: 'user_without_flag', password: 'password' }

View File

@ -10,13 +10,13 @@ import {
MockJoinPeerTubeVersions, MockJoinPeerTubeVersions,
MockSmtpServer, MockSmtpServer,
prepareNotificationsTest, prepareNotificationsTest,
ServerInfo, PeerTubeServer,
wait wait
} from '@shared/extra-utils' } from '@shared/extra-utils'
import { PluginType, UserNotification, UserNotificationType } from '@shared/models' import { PluginType, UserNotification, UserNotificationType } from '@shared/models'
describe('Test admin notifications', function () { describe('Test admin notifications', function () {
let server: ServerInfo let server: PeerTubeServer
let userNotifications: UserNotification[] = [] let userNotifications: UserNotification[] = []
let adminNotifications: UserNotification[] = [] let adminNotifications: UserNotification[] = []
let emails: object[] = [] let emails: object[] = []

View File

@ -9,7 +9,7 @@ import {
cleanupTests, cleanupTests,
MockSmtpServer, MockSmtpServer,
prepareNotificationsTest, prepareNotificationsTest,
ServerInfo, PeerTubeServer,
waitJobs waitJobs
} from '@shared/extra-utils' } from '@shared/extra-utils'
import { UserNotification } from '@shared/models' import { UserNotification } from '@shared/models'
@ -17,7 +17,7 @@ import { UserNotification } from '@shared/models'
const expect = chai.expect const expect = chai.expect
describe('Test comments notifications', function () { describe('Test comments notifications', function () {
let servers: ServerInfo[] = [] let servers: PeerTubeServer[] = []
let userToken: string let userToken: string
let userNotifications: UserNotification[] = [] let userNotifications: UserNotification[] = []
let emails: object[] = [] let emails: object[] = []

View File

@ -20,14 +20,14 @@ import {
MockInstancesIndex, MockInstancesIndex,
MockSmtpServer, MockSmtpServer,
prepareNotificationsTest, prepareNotificationsTest,
ServerInfo, PeerTubeServer,
wait, wait,
waitJobs waitJobs
} from '@shared/extra-utils' } from '@shared/extra-utils'
import { AbuseState, CustomConfig, UserNotification, VideoPrivacy } from '@shared/models' import { AbuseState, CustomConfig, UserNotification, VideoPrivacy } from '@shared/models'
describe('Test moderation notifications', function () { describe('Test moderation notifications', function () {
let servers: ServerInfo[] = [] let servers: PeerTubeServer[] = []
let userAccessToken: string let userAccessToken: string
let userNotifications: UserNotification[] = [] let userNotifications: UserNotification[] = []
let adminNotifications: UserNotification[] = [] let adminNotifications: UserNotification[] = []

View File

@ -9,7 +9,7 @@ import {
getAllNotificationsSettings, getAllNotificationsSettings,
MockSmtpServer, MockSmtpServer,
prepareNotificationsTest, prepareNotificationsTest,
ServerInfo, PeerTubeServer,
waitJobs waitJobs
} from '@shared/extra-utils' } from '@shared/extra-utils'
import { UserNotification, UserNotificationSettingValue } from '@shared/models' import { UserNotification, UserNotificationSettingValue } from '@shared/models'
@ -17,7 +17,7 @@ import { UserNotification, UserNotificationSettingValue } from '@shared/models'
const expect = chai.expect const expect = chai.expect
describe('Test notifications API', function () { describe('Test notifications API', function () {
let server: ServerInfo let server: PeerTubeServer
let userNotifications: UserNotification[] = [] let userNotifications: UserNotification[] = []
let userToken: string let userToken: string
let emails: object[] = [] let emails: object[] = []

View File

@ -13,7 +13,7 @@ import {
ImportsCommand, ImportsCommand,
MockSmtpServer, MockSmtpServer,
prepareNotificationsTest, prepareNotificationsTest,
ServerInfo, PeerTubeServer,
uploadRandomVideoOnServers, uploadRandomVideoOnServers,
wait, wait,
waitJobs waitJobs
@ -23,7 +23,7 @@ import { UserNotification, UserNotificationType, VideoPrivacy } from '@shared/mo
const expect = chai.expect const expect = chai.expect
describe('Test user notifications', function () { describe('Test user notifications', function () {
let servers: ServerInfo[] = [] let servers: PeerTubeServer[] = []
let userAccessToken: string let userAccessToken: string
let userNotifications: UserNotification[] = [] let userNotifications: UserNotification[] = []
let adminNotifications: UserNotification[] = [] let adminNotifications: UserNotification[] = []

View File

@ -5,9 +5,9 @@ import * as chai from 'chai'
import { import {
cleanupTests, cleanupTests,
doubleFollow, doubleFollow,
flushAndRunMultipleServers, createMultipleServers,
RedundancyCommand, RedundancyCommand,
ServerInfo, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
waitJobs waitJobs
} from '@shared/extra-utils' } from '@shared/extra-utils'
@ -18,7 +18,7 @@ const expect = chai.expect
describe('Test manage videos redundancy', function () { describe('Test manage videos redundancy', function () {
const targets: VideoRedundanciesTarget[] = [ 'my-videos', 'remote-videos' ] const targets: VideoRedundanciesTarget[] = [ 'my-videos', 'remote-videos' ]
let servers: ServerInfo[] let servers: PeerTubeServer[]
let video1Server2UUID: string let video1Server2UUID: string
let video2Server2UUID: string let video2Server2UUID: string
let redundanciesToRemove: number[] = [] let redundanciesToRemove: number[] = []
@ -48,7 +48,7 @@ describe('Test manage videos redundancy', function () {
} }
} }
} }
servers = await flushAndRunMultipleServers(3, config) servers = await createMultipleServers(3, config)
// Get the access tokens // Get the access tokens
await setAccessTokensToServers(servers) await setAccessTokensToServers(servers)

View File

@ -4,19 +4,18 @@ import 'mocha'
import { expect } from 'chai' import { expect } from 'chai'
import { import {
cleanupTests, cleanupTests,
flushAndRunServer, createSingleServer,
killallServers, killallServers,
reRunServer, PeerTubeServer,
ServerInfo,
setAccessTokensToServers, setAccessTokensToServers,
waitJobs waitJobs
} from '@shared/extra-utils' } from '@shared/extra-utils'
import { VideoPrivacy } from '@shared/models' import { VideoPrivacy } from '@shared/models'
describe('Test redundancy constraints', function () { describe('Test redundancy constraints', function () {
let remoteServer: ServerInfo let remoteServer: PeerTubeServer
let localServer: ServerInfo let localServer: PeerTubeServer
let servers: ServerInfo[] let servers: PeerTubeServer[]
const remoteServerConfig = { const remoteServerConfig = {
redundancy: { redundancy: {
@ -59,7 +58,7 @@ describe('Test redundancy constraints', function () {
this.timeout(120000) this.timeout(120000)
{ {
remoteServer = await flushAndRunServer(1, remoteServerConfig) remoteServer = await createSingleServer(1, remoteServerConfig)
} }
{ {
@ -70,7 +69,7 @@ describe('Test redundancy constraints', function () {
} }
} }
} }
localServer = await flushAndRunServer(2, config) localServer = await createSingleServer(2, config)
} }
servers = [ remoteServer, localServer ] servers = [ remoteServer, localServer ]
@ -119,7 +118,7 @@ describe('Test redundancy constraints', function () {
} }
} }
await await killallServers([ localServer ]) await await killallServers([ localServer ])
await reRunServer(localServer, config) await localServer.run(config)
await uploadWrapper('video 2 server 2') await uploadWrapper('video 2 server 2')
@ -148,7 +147,7 @@ describe('Test redundancy constraints', function () {
} }
} }
await killallServers([ localServer ]) await killallServers([ localServer ])
await reRunServer(localServer, config) await localServer.run(config)
await uploadWrapper('video 3 server 2') await uploadWrapper('video 3 server 2')

View File

@ -11,12 +11,11 @@ import {
checkVideoFilesWereRemoved, checkVideoFilesWereRemoved,
cleanupTests, cleanupTests,
doubleFollow, doubleFollow,
flushAndRunMultipleServers, createMultipleServers,
killallServers, killallServers,
makeGetRequest, makeGetRequest,
reRunServer,
root, root,
ServerInfo, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
wait, wait,
waitJobs waitJobs
@ -25,11 +24,11 @@ import { VideoPrivacy, VideoRedundancyStrategy, VideoRedundancyStrategyWithManua
const expect = chai.expect const expect = chai.expect
let servers: ServerInfo[] = [] let servers: PeerTubeServer[] = []
let video1Server2UUID: string let video1Server2UUID: string
let video1Server2Id: number let video1Server2Id: number
function checkMagnetWebseeds (file: { magnetUri: string, resolution: { id: number } }, baseWebseeds: string[], server: ServerInfo) { function checkMagnetWebseeds (file: { magnetUri: string, resolution: { id: number } }, baseWebseeds: string[], server: PeerTubeServer) {
const parsed = magnetUtil.decode(file.magnetUri) const parsed = magnetUtil.decode(file.magnetUri)
for (const ws of baseWebseeds) { for (const ws of baseWebseeds) {
@ -40,7 +39,7 @@ function checkMagnetWebseeds (file: { magnetUri: string, resolution: { id: numbe
expect(parsed.urlList).to.have.lengthOf(baseWebseeds.length) expect(parsed.urlList).to.have.lengthOf(baseWebseeds.length)
} }
async function flushAndRunServers (strategy: VideoRedundancyStrategy | null, additionalParams: any = {}, withWebtorrent = true) { async function createSingleServers (strategy: VideoRedundancyStrategy | null, additionalParams: any = {}, withWebtorrent = true) {
const strategies: any[] = [] const strategies: any[] = []
if (strategy !== null) { if (strategy !== null) {
@ -72,7 +71,7 @@ async function flushAndRunServers (strategy: VideoRedundancyStrategy | null, add
} }
} }
servers = await flushAndRunMultipleServers(3, config) servers = await createMultipleServers(3, config)
// Get the access tokens // Get the access tokens
await setAccessTokensToServers(servers) await setAccessTokensToServers(servers)
@ -288,7 +287,7 @@ describe('Test videos redundancy', function () {
before(function () { before(function () {
this.timeout(120000) this.timeout(120000)
return flushAndRunServers(strategy) return createSingleServers(strategy)
}) })
it('Should have 1 webseed on the first video', async function () { it('Should have 1 webseed on the first video', async function () {
@ -338,7 +337,7 @@ describe('Test videos redundancy', function () {
before(function () { before(function () {
this.timeout(120000) this.timeout(120000)
return flushAndRunServers(strategy) return createSingleServers(strategy)
}) })
it('Should have 1 webseed on the first video', async function () { it('Should have 1 webseed on the first video', async function () {
@ -388,7 +387,7 @@ describe('Test videos redundancy', function () {
before(function () { before(function () {
this.timeout(120000) this.timeout(120000)
return flushAndRunServers(strategy, { min_views: 3 }) return createSingleServers(strategy, { min_views: 3 })
}) })
it('Should have 1 webseed on the first video', async function () { it('Should have 1 webseed on the first video', async function () {
@ -458,7 +457,7 @@ describe('Test videos redundancy', function () {
before(async function () { before(async function () {
this.timeout(120000) this.timeout(120000)
await flushAndRunServers(strategy, { min_views: 3 }, false) await createSingleServers(strategy, { min_views: 3 }, false)
}) })
it('Should have 0 playlist redundancy on the first video', async function () { it('Should have 0 playlist redundancy on the first video', async function () {
@ -519,7 +518,7 @@ describe('Test videos redundancy', function () {
before(function () { before(function () {
this.timeout(120000) this.timeout(120000)
return flushAndRunServers(null) return createSingleServers(null)
}) })
it('Should have 1 webseed on the first video', async function () { it('Should have 1 webseed on the first video', async function () {
@ -575,7 +574,7 @@ describe('Test videos redundancy', function () {
describe('Test expiration', function () { describe('Test expiration', function () {
const strategy = 'recently-added' const strategy = 'recently-added'
async function checkContains (servers: ServerInfo[], str: string) { async function checkContains (servers: PeerTubeServer[], str: string) {
for (const server of servers) { for (const server of servers) {
const video = await server.videos.get({ id: video1Server2UUID }) const video = await server.videos.get({ id: video1Server2UUID })
@ -585,7 +584,7 @@ describe('Test videos redundancy', function () {
} }
} }
async function checkNotContains (servers: ServerInfo[], str: string) { async function checkNotContains (servers: PeerTubeServer[], str: string) {
for (const server of servers) { for (const server of servers) {
const video = await server.videos.get({ id: video1Server2UUID }) const video = await server.videos.get({ id: video1Server2UUID })
@ -598,7 +597,7 @@ describe('Test videos redundancy', function () {
before(async function () { before(async function () {
this.timeout(120000) this.timeout(120000)
await flushAndRunServers(strategy, { min_lifetime: '7 seconds', min_views: 0 }) await createSingleServers(strategy, { min_lifetime: '7 seconds', min_views: 0 })
await enableRedundancyOnServer1() await enableRedundancyOnServer1()
}) })
@ -640,7 +639,7 @@ describe('Test videos redundancy', function () {
before(async function () { before(async function () {
this.timeout(120000) this.timeout(120000)
await flushAndRunServers(strategy, { min_lifetime: '7 seconds', min_views: 0 }) await createSingleServers(strategy, { min_lifetime: '7 seconds', min_views: 0 })
await enableRedundancyOnServer1() await enableRedundancyOnServer1()
@ -691,7 +690,7 @@ describe('Test videos redundancy', function () {
await waitJobs(servers) await waitJobs(servers)
await killallServers([ servers[0] ]) await killallServers([ servers[0] ])
await reRunServer(servers[0], { await servers[0].run({
redundancy: { redundancy: {
videos: { videos: {
check_interval: '1 second', check_interval: '1 second',

View File

@ -4,9 +4,9 @@ import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { import {
cleanupTests, cleanupTests,
flushAndRunMultipleServers, createMultipleServers,
SearchCommand, SearchCommand,
ServerInfo, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
wait, wait,
waitJobs waitJobs
@ -16,7 +16,7 @@ import { VideoChannel } from '@shared/models'
const expect = chai.expect const expect = chai.expect
describe('Test ActivityPub video channels search', function () { describe('Test ActivityPub video channels search', function () {
let servers: ServerInfo[] let servers: PeerTubeServer[]
let userServer2Token: string let userServer2Token: string
let videoServer2UUID: string let videoServer2UUID: string
let channelIdServer2: number let channelIdServer2: number
@ -25,7 +25,7 @@ describe('Test ActivityPub video channels search', function () {
before(async function () { before(async function () {
this.timeout(120000) this.timeout(120000)
servers = await flushAndRunMultipleServers(2) servers = await createMultipleServers(2)
await setAccessTokensToServers(servers) await setAccessTokensToServers(servers)

View File

@ -4,9 +4,9 @@ import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { import {
cleanupTests, cleanupTests,
flushAndRunMultipleServers, createMultipleServers,
SearchCommand, SearchCommand,
ServerInfo, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
setDefaultVideoChannel, setDefaultVideoChannel,
wait, wait,
@ -17,7 +17,7 @@ import { VideoPlaylistPrivacy } from '@shared/models'
const expect = chai.expect const expect = chai.expect
describe('Test ActivityPub playlists search', function () { describe('Test ActivityPub playlists search', function () {
let servers: ServerInfo[] let servers: PeerTubeServer[]
let playlistServer1UUID: string let playlistServer1UUID: string
let playlistServer2UUID: string let playlistServer2UUID: string
let video2Server2: string let video2Server2: string
@ -27,7 +27,7 @@ describe('Test ActivityPub playlists search', function () {
before(async function () { before(async function () {
this.timeout(120000) this.timeout(120000)
servers = await flushAndRunMultipleServers(2) servers = await createMultipleServers(2)
await setAccessTokensToServers(servers) await setAccessTokensToServers(servers)
await setDefaultVideoChannel(servers) await setDefaultVideoChannel(servers)

View File

@ -4,9 +4,9 @@ import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { import {
cleanupTests, cleanupTests,
flushAndRunMultipleServers, createMultipleServers,
SearchCommand, SearchCommand,
ServerInfo, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
wait, wait,
waitJobs waitJobs
@ -16,7 +16,7 @@ import { VideoPrivacy } from '@shared/models'
const expect = chai.expect const expect = chai.expect
describe('Test ActivityPub videos search', function () { describe('Test ActivityPub videos search', function () {
let servers: ServerInfo[] let servers: PeerTubeServer[]
let videoServer1UUID: string let videoServer1UUID: string
let videoServer2UUID: string let videoServer2UUID: string
@ -25,7 +25,7 @@ describe('Test ActivityPub videos search', function () {
before(async function () { before(async function () {
this.timeout(120000) this.timeout(120000)
servers = await flushAndRunMultipleServers(2) servers = await createMultipleServers(2)
await setAccessTokensToServers(servers) await setAccessTokensToServers(servers)

View File

@ -2,19 +2,19 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { cleanupTests, flushAndRunServer, SearchCommand, ServerInfo, setAccessTokensToServers } from '@shared/extra-utils' import { cleanupTests, createSingleServer, SearchCommand, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils'
import { VideoChannel } from '@shared/models' import { VideoChannel } from '@shared/models'
const expect = chai.expect const expect = chai.expect
describe('Test channels search', function () { describe('Test channels search', function () {
let server: ServerInfo = null let server: PeerTubeServer = null
let command: SearchCommand let command: SearchCommand
before(async function () { before(async function () {
this.timeout(30000) this.timeout(30000)
server = await flushAndRunServer(1) server = await createSingleServer(1)
await setAccessTokensToServers([ server ]) await setAccessTokensToServers([ server ])

View File

@ -2,7 +2,7 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { cleanupTests, flushAndRunServer, SearchCommand, ServerInfo, setAccessTokensToServers } from '@shared/extra-utils' import { cleanupTests, createSingleServer, SearchCommand, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils'
import { BooleanBothQuery, VideoPlaylistPrivacy, VideoPlaylistType, VideosSearchQuery } from '@shared/models' import { BooleanBothQuery, VideoPlaylistPrivacy, VideoPlaylistType, VideosSearchQuery } from '@shared/models'
const expect = chai.expect const expect = chai.expect
@ -10,13 +10,13 @@ const expect = chai.expect
describe('Test videos search', function () { describe('Test videos search', function () {
const localVideoName = 'local video' + new Date().toISOString() const localVideoName = 'local video' + new Date().toISOString()
let server: ServerInfo = null let server: PeerTubeServer = null
let command: SearchCommand let command: SearchCommand
before(async function () { before(async function () {
this.timeout(30000) this.timeout(30000)
server = await flushAndRunServer(1) server = await createSingleServer(1)
await setAccessTokensToServers([ server ]) await setAccessTokensToServers([ server ])

View File

@ -4,9 +4,9 @@ import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { import {
cleanupTests, cleanupTests,
flushAndRunServer, createSingleServer,
SearchCommand, SearchCommand,
ServerInfo, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
setDefaultVideoChannel setDefaultVideoChannel
} from '@shared/extra-utils' } from '@shared/extra-utils'
@ -15,13 +15,13 @@ import { VideoPlaylistPrivacy } from '@shared/models'
const expect = chai.expect const expect = chai.expect
describe('Test playlists search', function () { describe('Test playlists search', function () {
let server: ServerInfo = null let server: PeerTubeServer = null
let command: SearchCommand let command: SearchCommand
before(async function () { before(async function () {
this.timeout(30000) this.timeout(30000)
server = await flushAndRunServer(1) server = await createSingleServer(1)
await setAccessTokensToServers([ server ]) await setAccessTokensToServers([ server ])
await setDefaultVideoChannel([ server ]) await setDefaultVideoChannel([ server ])

View File

@ -4,9 +4,9 @@ import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { import {
cleanupTests, cleanupTests,
flushAndRunServer, createSingleServer,
SearchCommand, SearchCommand,
ServerInfo, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
setDefaultVideoChannel, setDefaultVideoChannel,
stopFfmpeg, stopFfmpeg,
@ -17,7 +17,7 @@ import { VideoPrivacy } from '@shared/models'
const expect = chai.expect const expect = chai.expect
describe('Test videos search', function () { describe('Test videos search', function () {
let server: ServerInfo = null let server: PeerTubeServer = null
let startDate: string let startDate: string
let videoUUID: string let videoUUID: string
@ -26,7 +26,7 @@ describe('Test videos search', function () {
before(async function () { before(async function () {
this.timeout(60000) this.timeout(60000)
server = await flushAndRunServer(1) server = await createSingleServer(1)
await setAccessTokensToServers([ server ]) await setAccessTokensToServers([ server ])
await setDefaultVideoChannel([ server ]) await setDefaultVideoChannel([ server ])

View File

@ -4,9 +4,9 @@ import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { import {
cleanupTests, cleanupTests,
flushAndRunMultipleServers, createMultipleServers,
MockInstancesIndex, MockInstancesIndex,
ServerInfo, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
wait, wait,
waitJobs waitJobs
@ -14,7 +14,7 @@ import {
const expect = chai.expect const expect = chai.expect
async function checkFollow (follower: ServerInfo, following: ServerInfo, exists: boolean) { async function checkFollow (follower: PeerTubeServer, following: PeerTubeServer, exists: boolean) {
{ {
const body = await following.follows.getFollowers({ start: 0, count: 5, sort: '-createdAt' }) const body = await following.follows.getFollowers({ start: 0, count: 5, sort: '-createdAt' })
const follow = body.data.find(f => f.follower.host === follower.host && f.state === 'accepted') const follow = body.data.find(f => f.follower.host === follower.host && f.state === 'accepted')
@ -32,13 +32,13 @@ async function checkFollow (follower: ServerInfo, following: ServerInfo, exists:
} }
} }
async function server1Follows2 (servers: ServerInfo[]) { async function server1Follows2 (servers: PeerTubeServer[]) {
await servers[0].follows.follow({ targets: [ servers[1].host ] }) await servers[0].follows.follow({ targets: [ servers[1].host ] })
await waitJobs(servers) await waitJobs(servers)
} }
async function resetFollows (servers: ServerInfo[]) { async function resetFollows (servers: PeerTubeServer[]) {
try { try {
await servers[0].follows.unfollow({ target: servers[1] }) await servers[0].follows.unfollow({ target: servers[1] })
await servers[1].follows.unfollow({ target: servers[0] }) await servers[1].follows.unfollow({ target: servers[0] })
@ -52,12 +52,12 @@ async function resetFollows (servers: ServerInfo[]) {
} }
describe('Test auto follows', function () { describe('Test auto follows', function () {
let servers: ServerInfo[] = [] let servers: PeerTubeServer[] = []
before(async function () { before(async function () {
this.timeout(30000) this.timeout(30000)
servers = await flushAndRunMultipleServers(3) servers = await createMultipleServers(3)
// Get the access tokens // Get the access tokens
await setAccessTokensToServers(servers) await setAccessTokensToServers(servers)

View File

@ -6,8 +6,8 @@ import {
BulkCommand, BulkCommand,
cleanupTests, cleanupTests,
doubleFollow, doubleFollow,
flushAndRunMultipleServers, createMultipleServers,
ServerInfo, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
waitJobs waitJobs
} from '@shared/extra-utils' } from '@shared/extra-utils'
@ -17,7 +17,7 @@ const expect = chai.expect
describe('Test bulk actions', function () { describe('Test bulk actions', function () {
const commentsUser3: { videoId: number, commentId: number }[] = [] const commentsUser3: { videoId: number, commentId: number }[] = []
let servers: ServerInfo[] = [] let servers: PeerTubeServer[] = []
let user1Token: string let user1Token: string
let user2Token: string let user2Token: string
let user3Token: string let user3Token: string
@ -27,7 +27,7 @@ describe('Test bulk actions', function () {
before(async function () { before(async function () {
this.timeout(30000) this.timeout(30000)
servers = await flushAndRunMultipleServers(2) servers = await createMultipleServers(2)
// Get the access tokens // Get the access tokens
await setAccessTokensToServers(servers) await setAccessTokensToServers(servers)

View File

@ -5,19 +5,18 @@ import * as chai from 'chai'
import { HttpStatusCode } from '@shared/core-utils' import { HttpStatusCode } from '@shared/core-utils'
import { import {
cleanupTests, cleanupTests,
flushAndRunServer, createSingleServer,
killallServers, killallServers,
makeGetRequest, makeGetRequest,
parallelTests, parallelTests,
reRunServer, PeerTubeServer,
ServerInfo,
setAccessTokensToServers setAccessTokensToServers
} from '@shared/extra-utils' } from '@shared/extra-utils'
import { CustomConfig } from '@shared/models' import { CustomConfig } from '@shared/models'
const expect = chai.expect const expect = chai.expect
function checkInitialConfig (server: ServerInfo, data: CustomConfig) { function checkInitialConfig (server: PeerTubeServer, data: CustomConfig) {
expect(data.instance.name).to.equal('PeerTube') expect(data.instance.name).to.equal('PeerTube')
expect(data.instance.shortDescription).to.equal( expect(data.instance.shortDescription).to.equal(
'PeerTube, an ActivityPub-federated video streaming platform using P2P directly in your web browser.' 'PeerTube, an ActivityPub-federated video streaming platform using P2P directly in your web browser.'
@ -204,12 +203,12 @@ function checkUpdatedConfig (data: CustomConfig) {
} }
describe('Test config', function () { describe('Test config', function () {
let server: ServerInfo = null let server: PeerTubeServer = null
before(async function () { before(async function () {
this.timeout(30000) this.timeout(30000)
server = await flushAndRunServer(1) server = await createSingleServer(1)
await setAccessTokensToServers([ server ]) await setAccessTokensToServers([ server ])
}) })
@ -456,7 +455,7 @@ describe('Test config', function () {
await killallServers([ server ]) await killallServers([ server ])
await reRunServer(server) await server.run()
const data = await server.config.getCustomConfig() const data = await server.config.getCustomConfig()
@ -512,7 +511,7 @@ describe('Test config', function () {
frameguard: { enabled: false } frameguard: { enabled: false }
} }
} }
server = await reRunServer(server, config) await server.run(config)
{ {
const res = await makeGetRequest({ const res = await makeGetRequest({

View File

@ -3,13 +3,21 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { HttpStatusCode } from '@shared/core-utils' import { HttpStatusCode } from '@shared/core-utils'
import { cleanupTests, flushAndRunServer, MockSmtpServer, ServerInfo, setAccessTokensToServers, wait, waitJobs } from '@shared/extra-utils' import {
import { ContactFormCommand } from '@shared/extra-utils/server' cleanupTests,
ContactFormCommand,
createSingleServer,
MockSmtpServer,
PeerTubeServer,
setAccessTokensToServers,
wait,
waitJobs
} from '@shared/extra-utils'
const expect = chai.expect const expect = chai.expect
describe('Test contact form', function () { describe('Test contact form', function () {
let server: ServerInfo let server: PeerTubeServer
const emails: object[] = [] const emails: object[] = []
let command: ContactFormCommand let command: ContactFormCommand
@ -24,7 +32,7 @@ describe('Test contact form', function () {
port port
} }
} }
server = await flushAndRunServer(1, overrideConfig) server = await createSingleServer(1, overrideConfig)
await setAccessTokensToServers([ server ]) await setAccessTokensToServers([ server ])
command = server.contactForm command = server.contactForm

View File

@ -3,12 +3,12 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { HttpStatusCode } from '@shared/core-utils' import { HttpStatusCode } from '@shared/core-utils'
import { cleanupTests, flushAndRunServer, MockSmtpServer, ServerInfo, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' import { cleanupTests, createSingleServer, MockSmtpServer, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
const expect = chai.expect const expect = chai.expect
describe('Test emails', function () { describe('Test emails', function () {
let server: ServerInfo let server: PeerTubeServer
let userId: number let userId: number
let userId2: number let userId2: number
let userAccessToken: string let userAccessToken: string
@ -39,7 +39,7 @@ describe('Test emails', function () {
port: emailPort port: emailPort
} }
} }
server = await flushAndRunServer(1, overrideConfig) server = await createSingleServer(1, overrideConfig)
await setAccessTokensToServers([ server ]) await setAccessTokensToServers([ server ])
{ {

View File

@ -3,13 +3,13 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { HttpStatusCode } from '@shared/core-utils' import { HttpStatusCode } from '@shared/core-utils'
import { cleanupTests, doubleFollow, flushAndRunMultipleServers, ServerInfo, setAccessTokensToServers } from '@shared/extra-utils' import { cleanupTests, doubleFollow, createMultipleServers, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils'
import { PeerTubeProblemDocument, ServerErrorCode } from '@shared/models' import { PeerTubeProblemDocument, ServerErrorCode } from '@shared/models'
const expect = chai.expect const expect = chai.expect
describe('Test follow constraints', function () { describe('Test follow constraints', function () {
let servers: ServerInfo[] = [] let servers: PeerTubeServer[] = []
let video1UUID: string let video1UUID: string
let video2UUID: string let video2UUID: string
let userToken: string let userToken: string
@ -17,7 +17,7 @@ describe('Test follow constraints', function () {
before(async function () { before(async function () {
this.timeout(90000) this.timeout(90000)
servers = await flushAndRunMultipleServers(2) servers = await createMultipleServers(2)
// Get the access tokens // Get the access tokens
await setAccessTokensToServers(servers) await setAccessTokensToServers(servers)

View File

@ -4,16 +4,16 @@ import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { import {
cleanupTests, cleanupTests,
flushAndRunMultipleServers, createMultipleServers,
FollowsCommand, FollowsCommand,
ServerInfo, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
waitJobs waitJobs
} from '@shared/extra-utils' } from '@shared/extra-utils'
const expect = chai.expect const expect = chai.expect
async function checkServer1And2HasFollowers (servers: ServerInfo[], state = 'accepted') { async function checkServer1And2HasFollowers (servers: PeerTubeServer[], state = 'accepted') {
const fns = [ const fns = [
servers[0].follows.getFollowings.bind(servers[0].follows), servers[0].follows.getFollowings.bind(servers[0].follows),
servers[1].follows.getFollowers.bind(servers[1].follows) servers[1].follows.getFollowers.bind(servers[1].follows)
@ -30,7 +30,7 @@ async function checkServer1And2HasFollowers (servers: ServerInfo[], state = 'acc
} }
} }
async function checkNoFollowers (servers: ServerInfo[]) { async function checkNoFollowers (servers: PeerTubeServer[]) {
const fns = [ const fns = [
servers[0].follows.getFollowings.bind(servers[0].follows), servers[0].follows.getFollowings.bind(servers[0].follows),
servers[1].follows.getFollowers.bind(servers[1].follows) servers[1].follows.getFollowers.bind(servers[1].follows)
@ -43,13 +43,13 @@ async function checkNoFollowers (servers: ServerInfo[]) {
} }
describe('Test follows moderation', function () { describe('Test follows moderation', function () {
let servers: ServerInfo[] = [] let servers: PeerTubeServer[] = []
let commands: FollowsCommand[] let commands: FollowsCommand[]
before(async function () { before(async function () {
this.timeout(30000) this.timeout(30000)
servers = await flushAndRunMultipleServers(3) servers = await createMultipleServers(3)
// Get the access tokens // Get the access tokens
await setAccessTokensToServers(servers) await setAccessTokensToServers(servers)

View File

@ -7,9 +7,9 @@ import {
completeVideoCheck, completeVideoCheck,
dateIsValid, dateIsValid,
expectAccountFollows, expectAccountFollows,
flushAndRunMultipleServers, createMultipleServers,
FollowsCommand, FollowsCommand,
ServerInfo, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
testCaptionFile, testCaptionFile,
waitJobs waitJobs
@ -19,13 +19,13 @@ import { Video, VideoPrivacy } from '@shared/models'
const expect = chai.expect const expect = chai.expect
describe('Test follows', function () { describe('Test follows', function () {
let servers: ServerInfo[] = [] let servers: PeerTubeServer[] = []
let followsCommands: FollowsCommand[] let followsCommands: FollowsCommand[]
before(async function () { before(async function () {
this.timeout(30000) this.timeout(30000)
servers = await flushAndRunMultipleServers(3) servers = await createMultipleServers(3)
followsCommands = servers.map(s => s.follows) followsCommands = servers.map(s => s.follows)
// Get the access tokens // Get the access tokens

View File

@ -7,10 +7,9 @@ import {
cleanupTests, cleanupTests,
CommentsCommand, CommentsCommand,
completeVideoCheck, completeVideoCheck,
flushAndRunMultipleServers, createMultipleServers,
killallServers, killallServers,
reRunServer, PeerTubeServer,
ServerInfo,
setAccessTokensToServers, setAccessTokensToServers,
wait, wait,
waitJobs waitJobs
@ -20,7 +19,7 @@ import { JobState, VideoCreateResult, VideoPrivacy } from '@shared/models'
const expect = chai.expect const expect = chai.expect
describe('Test handle downs', function () { describe('Test handle downs', function () {
let servers: ServerInfo[] = [] let servers: PeerTubeServer[] = []
let threadIdServer1: number let threadIdServer1: number
let threadIdServer2: number let threadIdServer2: number
let commentIdServer1: number let commentIdServer1: number
@ -54,7 +53,7 @@ describe('Test handle downs', function () {
before(async function () { before(async function () {
this.timeout(30000) this.timeout(30000)
servers = await flushAndRunMultipleServers(3) servers = await createMultipleServers(3)
commentCommands = servers.map(s => s.comments) commentCommands = servers.map(s => s.comments)
checkAttributes = { checkAttributes = {
@ -176,8 +175,8 @@ describe('Test handle downs', function () {
it('Should re-follow server 1', async function () { it('Should re-follow server 1', async function () {
this.timeout(35000) this.timeout(35000)
await reRunServer(servers[1]) await servers[1].run()
await reRunServer(servers[2]) await servers[2].run()
await servers[1].follows.unfollow({ target: servers[0] }) await servers[1].follows.unfollow({ target: servers[0] })
await waitJobs(servers) await waitJobs(servers)

View File

@ -6,29 +6,28 @@ import { HttpStatusCode } from '@shared/core-utils'
import { import {
cleanupTests, cleanupTests,
CustomPagesCommand, CustomPagesCommand,
flushAndRunServer, createSingleServer,
killallServers, killallServers,
reRunServer, PeerTubeServer,
ServerInfo,
setAccessTokensToServers setAccessTokensToServers
} from '../../../../shared/extra-utils/index' } from '../../../../shared/extra-utils/index'
const expect = chai.expect const expect = chai.expect
async function getHomepageState (server: ServerInfo) { async function getHomepageState (server: PeerTubeServer) {
const config = await server.config.getConfig() const config = await server.config.getConfig()
return config.homepage.enabled return config.homepage.enabled
} }
describe('Test instance homepage actions', function () { describe('Test instance homepage actions', function () {
let server: ServerInfo let server: PeerTubeServer
let command: CustomPagesCommand let command: CustomPagesCommand
before(async function () { before(async function () {
this.timeout(30000) this.timeout(30000)
server = await flushAndRunServer(1) server = await createSingleServer(1)
await setAccessTokensToServers([ server ]) await setAccessTokensToServers([ server ])
command = server.customPage command = server.customPage
@ -56,7 +55,7 @@ describe('Test instance homepage actions', function () {
await killallServers([ server ]) await killallServers([ server ])
await reRunServer(server) await server.run()
const page = await command.getInstanceHomepage() const page = await command.getInstanceHomepage()
expect(page.content).to.equal('<picsou-magazine></picsou-magazine>') expect(page.content).to.equal('<picsou-magazine></picsou-magazine>')

View File

@ -6,8 +6,8 @@ import {
cleanupTests, cleanupTests,
dateIsValid, dateIsValid,
doubleFollow, doubleFollow,
flushAndRunMultipleServers, createMultipleServers,
ServerInfo, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
waitJobs waitJobs
} from '@shared/extra-utils' } from '@shared/extra-utils'
@ -15,12 +15,12 @@ import {
const expect = chai.expect const expect = chai.expect
describe('Test jobs', function () { describe('Test jobs', function () {
let servers: ServerInfo[] let servers: PeerTubeServer[]
before(async function () { before(async function () {
this.timeout(30000) this.timeout(30000)
servers = await flushAndRunMultipleServers(2) servers = await createMultipleServers(2)
await setAccessTokensToServers(servers) await setAccessTokensToServers(servers)

View File

@ -4,11 +4,10 @@ import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { import {
cleanupTests, cleanupTests,
flushAndRunServer, createSingleServer,
killallServers, killallServers,
LogsCommand, LogsCommand,
reRunServer, PeerTubeServer,
ServerInfo,
setAccessTokensToServers, setAccessTokensToServers,
waitJobs waitJobs
} from '@shared/extra-utils' } from '@shared/extra-utils'
@ -16,13 +15,13 @@ import {
const expect = chai.expect const expect = chai.expect
describe('Test logs', function () { describe('Test logs', function () {
let server: ServerInfo let server: PeerTubeServer
let logsCommand: LogsCommand let logsCommand: LogsCommand
before(async function () { before(async function () {
this.timeout(30000) this.timeout(30000)
server = await flushAndRunServer(1) server = await createSingleServer(1)
await setAccessTokensToServers([ server ]) await setAccessTokensToServers([ server ])
logsCommand = server.logs logsCommand = server.logs
@ -113,7 +112,7 @@ describe('Test logs', function () {
await killallServers([ server ]) await killallServers([ server ])
await reRunServer(server, { log: { log_ping_requests: false } }) await server.run({ log: { log_ping_requests: false } })
const now = new Date() const now = new Date()

View File

@ -1,16 +1,16 @@
import 'mocha' import 'mocha'
import * as request from 'supertest' import * as request from 'supertest'
import { ServerInfo } from '../../../../shared/extra-utils' import { PeerTubeServer } from '../../../../shared/extra-utils'
import { cleanupTests, flushAndRunServer } from '../../../../shared/extra-utils/server/servers' import { cleanupTests, createSingleServer } from '../../../../shared/extra-utils/server/servers'
import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
describe('Start and stop server without web client routes', function () { describe('Start and stop server without web client routes', function () {
let server: ServerInfo let server: PeerTubeServer
before(async function () { before(async function () {
this.timeout(30000) this.timeout(30000)
server = await flushAndRunServer(1, {}, [ '--no-client' ]) server = await createSingleServer(1, {}, [ '--no-client' ])
}) })
it('Should fail getting the client', function () { it('Should fail getting the client', function () {

View File

@ -5,11 +5,10 @@ import * as chai from 'chai'
import { HttpStatusCode } from '@shared/core-utils' import { HttpStatusCode } from '@shared/core-utils'
import { import {
cleanupTests, cleanupTests,
flushAndRunServer, createSingleServer,
killallServers, killallServers,
PluginsCommand, PluginsCommand,
reRunServer, PeerTubeServer,
ServerInfo,
setAccessTokensToServers, setAccessTokensToServers,
testHelloWorldRegisteredSettings, testHelloWorldRegisteredSettings,
wait wait
@ -19,7 +18,7 @@ import { PluginType } from '@shared/models'
const expect = chai.expect const expect = chai.expect
describe('Test plugins', function () { describe('Test plugins', function () {
let server: ServerInfo = null let server: PeerTubeServer = null
let command: PluginsCommand let command: PluginsCommand
before(async function () { before(async function () {
@ -30,7 +29,7 @@ describe('Test plugins', function () {
index: { check_latest_versions_interval: '5 seconds' } index: { check_latest_versions_interval: '5 seconds' }
} }
} }
server = await flushAndRunServer(1, configOverride) server = await createSingleServer(1, configOverride)
await setAccessTokensToServers([ server ]) await setAccessTokensToServers([ server ])
command = server.plugins command = server.plugins
@ -245,7 +244,7 @@ describe('Test plugins', function () {
// Restart the server to take into account this change // Restart the server to take into account this change
await killallServers([ server ]) await killallServers([ server ])
await reRunServer(server) await server.run()
{ {
const body = await command.list({ pluginType: PluginType.PLUGIN }) const body = await command.list({ pluginType: PluginType.PLUGIN })
@ -326,7 +325,7 @@ describe('Test plugins', function () {
await check() await check()
await killallServers([ server ]) await killallServers([ server ])
await reRunServer(server) await server.run()
await check() await check()
}) })

View File

@ -2,10 +2,10 @@
import { expect } from 'chai' import { expect } from 'chai'
import { HttpStatusCode } from '@shared/core-utils' import { HttpStatusCode } from '@shared/core-utils'
import { cleanupTests, flushAndRunServer, ServerInfo, setAccessTokensToServers, wait } from '@shared/extra-utils' import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers, wait } from '@shared/extra-utils'
describe('Test application behind a reverse proxy', function () { describe('Test application behind a reverse proxy', function () {
let server: ServerInfo let server: PeerTubeServer
let videoId: string let videoId: string
before(async function () { before(async function () {
@ -30,7 +30,7 @@ describe('Test application behind a reverse proxy', function () {
} }
} }
server = await flushAndRunServer(1, config) server = await createSingleServer(1, config)
await setAccessTokensToServers([ server ]) await setAccessTokensToServers([ server ])
const { uuid } = await server.videos.upload() const { uuid } = await server.videos.upload()

View File

@ -2,13 +2,13 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { cleanupTests, flushAndRunServer, ServerInfo, setAccessTokensToServers, setDefaultVideoChannel } from '@shared/extra-utils' import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers, setDefaultVideoChannel } from '@shared/extra-utils'
import { Video, VideoPlaylistPrivacy } from '@shared/models' import { Video, VideoPlaylistPrivacy } from '@shared/models'
const expect = chai.expect const expect = chai.expect
describe('Test services', function () { describe('Test services', function () {
let server: ServerInfo = null let server: PeerTubeServer = null
let playlistUUID: string let playlistUUID: string
let playlistDisplayName: string let playlistDisplayName: string
let video: Video let video: Video
@ -16,7 +16,7 @@ describe('Test services', function () {
before(async function () { before(async function () {
this.timeout(30000) this.timeout(30000)
server = await flushAndRunServer(1) server = await createSingleServer(1)
await setAccessTokensToServers([ server ]) await setAccessTokensToServers([ server ])
await setDefaultVideoChannel([ server ]) await setDefaultVideoChannel([ server ])

View File

@ -5,8 +5,8 @@ import * as chai from 'chai'
import { import {
cleanupTests, cleanupTests,
doubleFollow, doubleFollow,
flushAndRunMultipleServers, createMultipleServers,
ServerInfo, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
wait, wait,
waitJobs waitJobs
@ -16,7 +16,7 @@ import { ActivityType, VideoPlaylistPrivacy } from '@shared/models'
const expect = chai.expect const expect = chai.expect
describe('Test stats (excluding redundancy)', function () { describe('Test stats (excluding redundancy)', function () {
let servers: ServerInfo[] = [] let servers: PeerTubeServer[] = []
let channelId let channelId
const user = { const user = {
username: 'user1', username: 'user1',
@ -26,7 +26,7 @@ describe('Test stats (excluding redundancy)', function () {
before(async function () { before(async function () {
this.timeout(60000) this.timeout(60000)
servers = await flushAndRunMultipleServers(3) servers = await createMultipleServers(3)
await setAccessTokensToServers(servers) await setAccessTokensToServers(servers)

View File

@ -3,16 +3,16 @@
import 'mocha' import 'mocha'
import * as magnetUtil from 'magnet-uri' import * as magnetUtil from 'magnet-uri'
import * as WebTorrent from 'webtorrent' import * as WebTorrent from 'webtorrent'
import { cleanupTests, flushAndRunServer, killallServers, reRunServer, ServerInfo, setAccessTokensToServers } from '@shared/extra-utils' import { cleanupTests, createSingleServer, killallServers, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils'
describe('Test tracker', function () { describe('Test tracker', function () {
let server: ServerInfo let server: PeerTubeServer
let badMagnet: string let badMagnet: string
let goodMagnet: string let goodMagnet: string
before(async function () { before(async function () {
this.timeout(60000) this.timeout(60000)
server = await flushAndRunServer(1) server = await createSingleServer(1)
await setAccessTokensToServers([ server ]) await setAccessTokensToServers([ server ])
{ {
@ -48,7 +48,7 @@ describe('Test tracker', function () {
const errCb = () => done(new Error('Tracker is enabled')) const errCb = () => done(new Error('Tracker is enabled'))
killallServers([ server ]) killallServers([ server ])
.then(() => reRunServer(server, { tracker: { enabled: false } })) .then(() => server.run({ tracker: { enabled: false } }))
.then(() => { .then(() => {
const webtorrent = new WebTorrent() const webtorrent = new WebTorrent()
@ -72,7 +72,7 @@ describe('Test tracker', function () {
this.timeout(20000) this.timeout(20000)
killallServers([ server ]) killallServers([ server ])
.then(() => reRunServer(server)) .then(() => server.run())
.then(() => { .then(() => {
const webtorrent = new WebTorrent() const webtorrent = new WebTorrent()

View File

@ -5,8 +5,8 @@ import * as chai from 'chai'
import { import {
cleanupTests, cleanupTests,
doubleFollow, doubleFollow,
flushAndRunMultipleServers, createMultipleServers,
ServerInfo, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
SubscriptionsCommand, SubscriptionsCommand,
waitJobs waitJobs
@ -15,7 +15,7 @@ import {
const expect = chai.expect const expect = chai.expect
describe('Test users subscriptions', function () { describe('Test users subscriptions', function () {
let servers: ServerInfo[] = [] let servers: PeerTubeServer[] = []
const users: { accessToken: string }[] = [] const users: { accessToken: string }[] = []
let video3UUID: string let video3UUID: string
@ -24,7 +24,7 @@ describe('Test users subscriptions', function () {
before(async function () { before(async function () {
this.timeout(120000) this.timeout(120000)
servers = await flushAndRunMultipleServers(3) servers = await createMultipleServers(3)
// Get the access tokens // Get the access tokens
await setAccessTokensToServers(servers) await setAccessTokensToServers(servers)

View File

@ -8,8 +8,8 @@ import {
checkVideoFilesWereRemoved, checkVideoFilesWereRemoved,
cleanupTests, cleanupTests,
doubleFollow, doubleFollow,
flushAndRunMultipleServers, createMultipleServers,
ServerInfo, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
testImage, testImage,
waitJobs waitJobs
@ -19,7 +19,7 @@ import { User } from '@shared/models'
const expect = chai.expect const expect = chai.expect
describe('Test users with multiple servers', function () { describe('Test users with multiple servers', function () {
let servers: ServerInfo[] = [] let servers: PeerTubeServer[] = []
let user: User let user: User
let userId: number let userId: number
let videoUUID: string let videoUUID: string
@ -29,7 +29,7 @@ describe('Test users with multiple servers', function () {
before(async function () { before(async function () {
this.timeout(120_000) this.timeout(120_000)
servers = await flushAndRunMultipleServers(3) servers = await createMultipleServers(3)
// Get the access tokens // Get the access tokens
await setAccessTokensToServers(servers) await setAccessTokensToServers(servers)

View File

@ -3,12 +3,12 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { HttpStatusCode } from '@shared/core-utils' import { HttpStatusCode } from '@shared/core-utils'
import { cleanupTests, flushAndRunServer, MockSmtpServer, ServerInfo, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' import { cleanupTests, createSingleServer, MockSmtpServer, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
const expect = chai.expect const expect = chai.expect
describe('Test users account verification', function () { describe('Test users account verification', function () {
let server: ServerInfo let server: PeerTubeServer
let userId: number let userId: number
let userAccessToken: string let userAccessToken: string
let verificationString: string let verificationString: string
@ -34,7 +34,7 @@ describe('Test users account verification', function () {
port port
} }
} }
server = await flushAndRunServer(1, overrideConfig) server = await createSingleServer(1, overrideConfig)
await setAccessTokensToServers([ server ]) await setAccessTokensToServers([ server ])
}) })

View File

@ -5,11 +5,10 @@ import * as chai from 'chai'
import { HttpStatusCode } from '@shared/core-utils' import { HttpStatusCode } from '@shared/core-utils'
import { import {
cleanupTests, cleanupTests,
flushAndRunServer, createSingleServer,
killallServers, killallServers,
makePutBodyRequest, makePutBodyRequest,
reRunServer, PeerTubeServer,
ServerInfo,
setAccessTokensToServers, setAccessTokensToServers,
testImage, testImage,
waitJobs waitJobs
@ -19,7 +18,7 @@ import { AbuseState, OAuth2ErrorCode, UserAdminFlag, UserRole, Video, VideoPlayl
const expect = chai.expect const expect = chai.expect
describe('Test users', function () { describe('Test users', function () {
let server: ServerInfo let server: PeerTubeServer
let token: string let token: string
let userToken: string let userToken: string
let videoId: number let videoId: number
@ -32,7 +31,7 @@ describe('Test users', function () {
before(async function () { before(async function () {
this.timeout(30000) this.timeout(30000)
server = await flushAndRunServer(1, { server = await createSingleServer(1, {
rates_limit: { rates_limit: {
login: { login: {
max: 30 max: 30
@ -238,7 +237,7 @@ describe('Test users', function () {
await server.sql.setTokenField(server.accessToken, 'refreshTokenExpiresAt', new Date().toISOString()) await server.sql.setTokenField(server.accessToken, 'refreshTokenExpiresAt', new Date().toISOString())
await killallServers([ server ]) await killallServers([ server ])
await reRunServer(server) await server.run()
await server.users.getMyInfo({ expectedStatus: HttpStatusCode.UNAUTHORIZED_401 }) await server.users.getMyInfo({ expectedStatus: HttpStatusCode.UNAUTHORIZED_401 })
}) })
@ -254,7 +253,7 @@ describe('Test users', function () {
await server.sql.setTokenField(server.accessToken, 'refreshTokenExpiresAt', futureDate) await server.sql.setTokenField(server.accessToken, 'refreshTokenExpiresAt', futureDate)
await killallServers([ server ]) await killallServers([ server ])
await reRunServer(server) await server.run()
const res = await server.login.refreshToken({ refreshToken: server.refreshToken }) const res = await server.login.refreshToken({ refreshToken: server.refreshToken })
server.accessToken = res.body.access_token server.accessToken = res.body.access_token

View File

@ -4,12 +4,12 @@ import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { join } from 'path' import { join } from 'path'
import { getAudioStream, getVideoStreamSize } from '@server/helpers/ffprobe-utils' import { getAudioStream, getVideoStreamSize } from '@server/helpers/ffprobe-utils'
import { cleanupTests, doubleFollow, flushAndRunMultipleServers, ServerInfo, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' import { cleanupTests, doubleFollow, createMultipleServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
const expect = chai.expect const expect = chai.expect
describe('Test audio only video transcoding', function () { describe('Test audio only video transcoding', function () {
let servers: ServerInfo[] = [] let servers: PeerTubeServer[] = []
let videoUUID: string let videoUUID: string
before(async function () { before(async function () {
@ -36,7 +36,7 @@ describe('Test audio only video transcoding', function () {
} }
} }
} }
servers = await flushAndRunMultipleServers(2, configOverride) servers = await createMultipleServers(2, configOverride)
// Get the access tokens // Get the access tokens
await setAccessTokensToServers(servers) await setAccessTokensToServers(servers)

View File

@ -12,8 +12,8 @@ import {
completeVideoCheck, completeVideoCheck,
dateIsValid, dateIsValid,
doubleFollow, doubleFollow,
flushAndRunMultipleServers, createMultipleServers,
ServerInfo, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
testImage, testImage,
wait, wait,
@ -25,7 +25,7 @@ import { VideoCommentThreadTree, VideoPrivacy } from '@shared/models'
const expect = chai.expect const expect = chai.expect
describe('Test multiple servers', function () { describe('Test multiple servers', function () {
let servers: ServerInfo[] = [] let servers: PeerTubeServer[] = []
const toRemove = [] const toRemove = []
let videoUUID = '' let videoUUID = ''
let videoChannelId: number let videoChannelId: number
@ -33,7 +33,7 @@ describe('Test multiple servers', function () {
before(async function () { before(async function () {
this.timeout(120000) this.timeout(120000)
servers = await flushAndRunMultipleServers(3) servers = await createMultipleServers(3)
// Get the access tokens // Get the access tokens
await setAccessTokensToServers(servers) await setAccessTokensToServers(servers)

View File

@ -8,8 +8,8 @@ import { HttpStatusCode } from '@shared/core-utils'
import { import {
buildAbsoluteFixturePath, buildAbsoluteFixturePath,
cleanupTests, cleanupTests,
flushAndRunServer, createSingleServer,
ServerInfo, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
setDefaultVideoChannel setDefaultVideoChannel
} from '@shared/extra-utils' } from '@shared/extra-utils'
@ -21,7 +21,7 @@ const expect = chai.expect
describe('Test resumable upload', function () { describe('Test resumable upload', function () {
const defaultFixture = 'video_short.mp4' const defaultFixture = 'video_short.mp4'
let server: ServerInfo let server: PeerTubeServer
let rootId: number let rootId: number
async function buildSize (fixture: string, size?: number) { async function buildSize (fixture: string, size?: number) {
@ -99,7 +99,7 @@ describe('Test resumable upload', function () {
before(async function () { before(async function () {
this.timeout(30000) this.timeout(30000)
server = await flushAndRunServer(1) server = await createSingleServer(1)
await setAccessTokensToServers([ server ]) await setAccessTokensToServers([ server ])
await setDefaultVideoChannel([ server ]) await setDefaultVideoChannel([ server ])

View File

@ -6,8 +6,8 @@ import {
checkVideoFilesWereRemoved, checkVideoFilesWereRemoved,
cleanupTests, cleanupTests,
completeVideoCheck, completeVideoCheck,
flushAndRunServer, createSingleServer,
ServerInfo, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
testImage, testImage,
wait wait
@ -19,7 +19,7 @@ const expect = chai.expect
describe('Test a single server', function () { describe('Test a single server', function () {
function runSuite (mode: 'legacy' | 'resumable') { function runSuite (mode: 'legacy' | 'resumable') {
let server: ServerInfo = null let server: PeerTubeServer = null
let videoId: number | string let videoId: number | string
let videoId2: string let videoId2: string
let videoUUID = '' let videoUUID = ''
@ -94,7 +94,7 @@ describe('Test a single server', function () {
before(async function () { before(async function () {
this.timeout(30000) this.timeout(30000)
server = await flushAndRunServer(1) server = await createSingleServer(1)
await setAccessTokensToServers([ server ]) await setAccessTokensToServers([ server ])
}) })

View File

@ -6,8 +6,8 @@ import {
checkVideoFilesWereRemoved, checkVideoFilesWereRemoved,
cleanupTests, cleanupTests,
doubleFollow, doubleFollow,
flushAndRunMultipleServers, createMultipleServers,
ServerInfo, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
testCaptionFile, testCaptionFile,
wait, wait,
@ -19,13 +19,13 @@ const expect = chai.expect
describe('Test video captions', function () { describe('Test video captions', function () {
const uuidRegex = '[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}' const uuidRegex = '[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}'
let servers: ServerInfo[] let servers: PeerTubeServer[]
let videoUUID: string let videoUUID: string
before(async function () { before(async function () {
this.timeout(60000) this.timeout(60000)
servers = await flushAndRunMultipleServers(2) servers = await createMultipleServers(2)
await setAccessTokensToServers(servers) await setAccessTokensToServers(servers)
await doubleFollow(servers[0], servers[1]) await doubleFollow(servers[0], servers[1])

View File

@ -7,9 +7,9 @@ import {
ChangeOwnershipCommand, ChangeOwnershipCommand,
cleanupTests, cleanupTests,
doubleFollow, doubleFollow,
flushAndRunMultipleServers, createMultipleServers,
flushAndRunServer, createSingleServer,
ServerInfo, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
setDefaultVideoChannel, setDefaultVideoChannel,
waitJobs waitJobs
@ -19,7 +19,7 @@ import { VideoPrivacy } from '@shared/models'
const expect = chai.expect const expect = chai.expect
describe('Test video change ownership - nominal', function () { describe('Test video change ownership - nominal', function () {
let servers: ServerInfo[] = [] let servers: PeerTubeServer[] = []
const firstUser = 'first' const firstUser = 'first'
const secondUser = 'second' const secondUser = 'second'
@ -39,7 +39,7 @@ describe('Test video change ownership - nominal', function () {
before(async function () { before(async function () {
this.timeout(50000) this.timeout(50000)
servers = await flushAndRunMultipleServers(2) servers = await createMultipleServers(2)
await setAccessTokensToServers(servers) await setAccessTokensToServers(servers)
await setDefaultVideoChannel(servers) await setDefaultVideoChannel(servers)
@ -251,7 +251,7 @@ describe('Test video change ownership - nominal', function () {
}) })
describe('Test video change ownership - quota too small', function () { describe('Test video change ownership - quota too small', function () {
let server: ServerInfo let server: PeerTubeServer
const firstUser = 'first' const firstUser = 'first'
const secondUser = 'second' const secondUser = 'second'
@ -263,7 +263,7 @@ describe('Test video change ownership - quota too small', function () {
this.timeout(50000) this.timeout(50000)
// Run one server // Run one server
server = await flushAndRunServer(1) server = await createSingleServer(1)
await setAccessTokensToServers([ server ]) await setAccessTokensToServers([ server ])
await server.users.create({ username: secondUser, videoQuota: 10 }) await server.users.create({ username: secondUser, videoQuota: 10 })

View File

@ -7,8 +7,8 @@ import { ACTOR_IMAGES_SIZE } from '@server/initializers/constants'
import { import {
cleanupTests, cleanupTests,
doubleFollow, doubleFollow,
flushAndRunMultipleServers, createMultipleServers,
ServerInfo, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
setDefaultVideoChannel, setDefaultVideoChannel,
testFileExistsOrNot, testFileExistsOrNot,
@ -20,14 +20,14 @@ import { User, VideoChannel } from '@shared/models'
const expect = chai.expect const expect = chai.expect
async function findChannel (server: ServerInfo, channelId: number) { async function findChannel (server: PeerTubeServer, channelId: number) {
const body = await server.channels.list({ sort: '-name' }) const body = await server.channels.list({ sort: '-name' })
return body.data.find(c => c.id === channelId) return body.data.find(c => c.id === channelId)
} }
describe('Test video channels', function () { describe('Test video channels', function () {
let servers: ServerInfo[] let servers: PeerTubeServer[]
let userInfo: User let userInfo: User
let secondVideoChannelId: number let secondVideoChannelId: number
let totoChannel: number let totoChannel: number
@ -40,7 +40,7 @@ describe('Test video channels', function () {
before(async function () { before(async function () {
this.timeout(60000) this.timeout(60000)
servers = await flushAndRunMultipleServers(2) servers = await createMultipleServers(2)
await setAccessTokensToServers(servers) await setAccessTokensToServers(servers)
await setDefaultVideoChannel(servers) await setDefaultVideoChannel(servers)

View File

@ -6,8 +6,8 @@ import {
cleanupTests, cleanupTests,
CommentsCommand, CommentsCommand,
dateIsValid, dateIsValid,
flushAndRunServer, createSingleServer,
ServerInfo, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
testImage testImage
} from '@shared/extra-utils' } from '@shared/extra-utils'
@ -15,7 +15,7 @@ import {
const expect = chai.expect const expect = chai.expect
describe('Test video comments', function () { describe('Test video comments', function () {
let server: ServerInfo let server: PeerTubeServer
let videoId: number let videoId: number
let videoUUID: string let videoUUID: string
let threadId: number let threadId: number
@ -28,7 +28,7 @@ describe('Test video comments', function () {
before(async function () { before(async function () {
this.timeout(30000) this.timeout(30000)
server = await flushAndRunServer(1) server = await createSingleServer(1)
await setAccessTokensToServers([ server ]) await setAccessTokensToServers([ server ])

View File

@ -2,12 +2,12 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { cleanupTests, doubleFollow, flushAndRunMultipleServers, ServerInfo, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' import { cleanupTests, doubleFollow, createMultipleServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
const expect = chai.expect const expect = chai.expect
describe('Test video description', function () { describe('Test video description', function () {
let servers: ServerInfo[] = [] let servers: PeerTubeServer[] = []
let videoUUID = '' let videoUUID = ''
let videoId: number let videoId: number
const longDescription = 'my super description for server 1'.repeat(50) const longDescription = 'my super description for server 1'.repeat(50)
@ -16,7 +16,7 @@ describe('Test video description', function () {
this.timeout(40000) this.timeout(40000)
// Run servers // Run servers
servers = await flushAndRunMultipleServers(2) servers = await createMultipleServers(2)
// Get the access tokens // Get the access tokens
await setAccessTokensToServers(servers) await setAccessTokensToServers(servers)

View File

@ -11,9 +11,9 @@ import {
checkTmpIsEmpty, checkTmpIsEmpty,
cleanupTests, cleanupTests,
doubleFollow, doubleFollow,
flushAndRunMultipleServers, createMultipleServers,
makeRawRequest, makeRawRequest,
ServerInfo, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
waitJobs, waitJobs,
webtorrentAdd webtorrentAdd
@ -23,7 +23,7 @@ import { DEFAULT_AUDIO_RESOLUTION } from '../../../initializers/constants'
const expect = chai.expect const expect = chai.expect
async function checkHlsPlaylist (servers: ServerInfo[], videoUUID: string, hlsOnly: boolean, resolutions = [ 240, 360, 480, 720 ]) { async function checkHlsPlaylist (servers: PeerTubeServer[], videoUUID: string, hlsOnly: boolean, resolutions = [ 240, 360, 480, 720 ]) {
for (const server of servers) { for (const server of servers) {
const videoDetails = await server.videos.get({ id: videoUUID }) const videoDetails = await server.videos.get({ id: videoUUID })
const baseUrl = `http://${videoDetails.account.host}` const baseUrl = `http://${videoDetails.account.host}`
@ -98,7 +98,7 @@ async function checkHlsPlaylist (servers: ServerInfo[], videoUUID: string, hlsOn
} }
describe('Test HLS videos', function () { describe('Test HLS videos', function () {
let servers: ServerInfo[] = [] let servers: PeerTubeServer[] = []
let videoUUID = '' let videoUUID = ''
let videoAudioUUID = '' let videoAudioUUID = ''
@ -176,7 +176,7 @@ describe('Test HLS videos', function () {
} }
} }
} }
servers = await flushAndRunMultipleServers(2, configOverride) servers = await createMultipleServers(2, configOverride)
// Get the access tokens // Get the access tokens
await setAccessTokensToServers(servers) await setAccessTokensToServers(servers)

View File

@ -6,9 +6,9 @@ import {
areHttpImportTestsDisabled, areHttpImportTestsDisabled,
cleanupTests, cleanupTests,
doubleFollow, doubleFollow,
flushAndRunMultipleServers, createMultipleServers,
ImportsCommand, ImportsCommand,
ServerInfo, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
testCaptionFile, testCaptionFile,
testImage, testImage,
@ -19,13 +19,13 @@ import { VideoPrivacy, VideoResolution } from '@shared/models'
const expect = chai.expect const expect = chai.expect
describe('Test video imports', function () { describe('Test video imports', function () {
let servers: ServerInfo[] = [] let servers: PeerTubeServer[] = []
let channelIdServer1: number let channelIdServer1: number
let channelIdServer2: number let channelIdServer2: number
if (areHttpImportTestsDisabled()) return if (areHttpImportTestsDisabled()) return
async function checkVideosServer1 (server: ServerInfo, idHttp: string, idMagnet: string, idTorrent: string) { async function checkVideosServer1 (server: PeerTubeServer, idHttp: string, idMagnet: string, idTorrent: string) {
const videoHttp = await server.videos.get({ id: idHttp }) const videoHttp = await server.videos.get({ id: idHttp })
expect(videoHttp.name).to.equal('small video - youtube') expect(videoHttp.name).to.equal('small video - youtube')
@ -63,7 +63,7 @@ describe('Test video imports', function () {
expect(bodyCaptions.total).to.equal(2) expect(bodyCaptions.total).to.equal(2)
} }
async function checkVideoServer2 (server: ServerInfo, id: number | string) { async function checkVideoServer2 (server: PeerTubeServer, id: number | string) {
const video = await server.videos.get({ id }) const video = await server.videos.get({ id })
expect(video.name).to.equal('my super name') expect(video.name).to.equal('my super name')
@ -84,7 +84,7 @@ describe('Test video imports', function () {
this.timeout(30_000) this.timeout(30_000)
// Run servers // Run servers
servers = await flushAndRunMultipleServers(2) servers = await createMultipleServers(2)
await setAccessTokensToServers(servers) await setAccessTokensToServers(servers)

View File

@ -2,7 +2,7 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { cleanupTests, flushAndRunServer, ServerInfo, setAccessTokensToServers } from '@shared/extra-utils' import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils'
import { BooleanBothQuery, CustomConfig, ResultList, Video, VideosOverview } from '@shared/models' import { BooleanBothQuery, CustomConfig, ResultList, Video, VideosOverview } from '@shared/models'
const expect = chai.expect const expect = chai.expect
@ -13,7 +13,7 @@ function createOverviewRes (overview: VideosOverview) {
} }
describe('Test video NSFW policy', function () { describe('Test video NSFW policy', function () {
let server: ServerInfo let server: PeerTubeServer
let userAccessToken: string let userAccessToken: string
let customConfig: CustomConfig let customConfig: CustomConfig
@ -61,7 +61,7 @@ describe('Test video NSFW policy', function () {
before(async function () { before(async function () {
this.timeout(50000) this.timeout(50000)
server = await flushAndRunServer(1) server = await createSingleServer(1)
// Get the access tokens // Get the access tokens
await setAccessTokensToServers([ server ]) await setAccessTokensToServers([ server ])

View File

@ -5,8 +5,8 @@ import * as chai from 'chai'
import { import {
cleanupTests, cleanupTests,
doubleFollow, doubleFollow,
flushAndRunMultipleServers, createMultipleServers,
ServerInfo, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
setDefaultVideoChannel, setDefaultVideoChannel,
testImage, testImage,
@ -17,7 +17,7 @@ import { VideoPlaylistPrivacy } from '../../../../shared/models/videos/playlist/
const expect = chai.expect const expect = chai.expect
describe('Playlist thumbnail', function () { describe('Playlist thumbnail', function () {
let servers: ServerInfo[] = [] let servers: PeerTubeServer[] = []
let playlistWithoutThumbnailId: number let playlistWithoutThumbnailId: number
let playlistWithThumbnailId: number let playlistWithThumbnailId: number
@ -30,13 +30,13 @@ describe('Playlist thumbnail', function () {
let video1: number let video1: number
let video2: number let video2: number
async function getPlaylistWithoutThumbnail (server: ServerInfo) { async function getPlaylistWithoutThumbnail (server: PeerTubeServer) {
const body = await server.playlists.list({ start: 0, count: 10 }) const body = await server.playlists.list({ start: 0, count: 10 })
return body.data.find(p => p.displayName === 'playlist without thumbnail') return body.data.find(p => p.displayName === 'playlist without thumbnail')
} }
async function getPlaylistWithThumbnail (server: ServerInfo) { async function getPlaylistWithThumbnail (server: PeerTubeServer) {
const body = await server.playlists.list({ start: 0, count: 10 }) const body = await server.playlists.list({ start: 0, count: 10 })
return body.data.find(p => p.displayName === 'playlist with thumbnail') return body.data.find(p => p.displayName === 'playlist with thumbnail')
@ -45,7 +45,7 @@ describe('Playlist thumbnail', function () {
before(async function () { before(async function () {
this.timeout(120000) this.timeout(120000)
servers = await flushAndRunMultipleServers(2, { transcoding: { enabled: false } }) servers = await createMultipleServers(2, { transcoding: { enabled: false } })
// Get the access tokens // Get the access tokens
await setAccessTokensToServers(servers) await setAccessTokensToServers(servers)

View File

@ -7,9 +7,9 @@ import {
checkPlaylistFilesWereRemoved, checkPlaylistFilesWereRemoved,
cleanupTests, cleanupTests,
doubleFollow, doubleFollow,
flushAndRunMultipleServers, createMultipleServers,
PlaylistsCommand, PlaylistsCommand,
ServerInfo, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
setDefaultVideoChannel, setDefaultVideoChannel,
testImage, testImage,
@ -28,7 +28,7 @@ import {
const expect = chai.expect const expect = chai.expect
async function checkPlaylistElementType ( async function checkPlaylistElementType (
servers: ServerInfo[], servers: PeerTubeServer[],
playlistId: string, playlistId: string,
type: VideoPlaylistElementType, type: VideoPlaylistElementType,
position: number, position: number,
@ -52,7 +52,7 @@ async function checkPlaylistElementType (
} }
describe('Test video playlists', function () { describe('Test video playlists', function () {
let servers: ServerInfo[] = [] let servers: PeerTubeServer[] = []
let playlistServer2Id1: number let playlistServer2Id1: number
let playlistServer2Id2: number let playlistServer2Id2: number
@ -75,7 +75,7 @@ describe('Test video playlists', function () {
before(async function () { before(async function () {
this.timeout(120000) this.timeout(120000)
servers = await flushAndRunMultipleServers(3, { transcoding: { enabled: false } }) servers = await createMultipleServers(3, { transcoding: { enabled: false } })
// Get the access tokens // Get the access tokens
await setAccessTokensToServers(servers) await setAccessTokensToServers(servers)
@ -584,10 +584,10 @@ describe('Test video playlists', function () {
}) })
describe('Element type', function () { describe('Element type', function () {
let groupUser1: ServerInfo[] let groupUser1: PeerTubeServer[]
let groupWithoutToken1: ServerInfo[] let groupWithoutToken1: PeerTubeServer[]
let group1: ServerInfo[] let group1: PeerTubeServer[]
let group2: ServerInfo[] let group2: PeerTubeServer[]
let video1: string let video1: string
let video2: string let video2: string

View File

@ -3,13 +3,13 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { HttpStatusCode } from '@shared/core-utils' import { HttpStatusCode } from '@shared/core-utils'
import { cleanupTests, doubleFollow, flushAndRunServer, ServerInfo, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' import { cleanupTests, doubleFollow, createSingleServer, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
import { VideoCreateResult, VideoPrivacy } from '@shared/models' import { VideoCreateResult, VideoPrivacy } from '@shared/models'
const expect = chai.expect const expect = chai.expect
describe('Test video privacy', function () { describe('Test video privacy', function () {
const servers: ServerInfo[] = [] const servers: PeerTubeServer[] = []
let anotherUserToken: string let anotherUserToken: string
let privateVideoId: number let privateVideoId: number
@ -35,8 +35,8 @@ describe('Test video privacy', function () {
this.timeout(50000) this.timeout(50000)
// Run servers // Run servers
servers.push(await flushAndRunServer(1, dontFederateUnlistedConfig)) servers.push(await createSingleServer(1, dontFederateUnlistedConfig))
servers.push(await flushAndRunServer(2)) servers.push(await createSingleServer(2))
// Get the access tokens // Get the access tokens
await setAccessTokensToServers(servers) await setAccessTokensToServers(servers)

View File

@ -5,8 +5,8 @@ import * as chai from 'chai'
import { import {
cleanupTests, cleanupTests,
doubleFollow, doubleFollow,
flushAndRunMultipleServers, createMultipleServers,
ServerInfo, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
wait, wait,
waitJobs waitJobs
@ -23,14 +23,14 @@ function in10Seconds () {
} }
describe('Test video update scheduler', function () { describe('Test video update scheduler', function () {
let servers: ServerInfo[] = [] let servers: PeerTubeServer[] = []
let video2UUID: string let video2UUID: string
before(async function () { before(async function () {
this.timeout(30000) this.timeout(30000)
// Run servers // Run servers
servers = await flushAndRunMultipleServers(2) servers = await createMultipleServers(2)
await setAccessTokensToServers(servers) await setAccessTokensToServers(servers)

View File

@ -9,11 +9,11 @@ import {
buildAbsoluteFixturePath, buildAbsoluteFixturePath,
cleanupTests, cleanupTests,
doubleFollow, doubleFollow,
flushAndRunMultipleServers, createMultipleServers,
generateHighBitrateVideo, generateHighBitrateVideo,
generateVideoWithFramerate, generateVideoWithFramerate,
makeGetRequest, makeGetRequest,
ServerInfo, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
waitJobs, waitJobs,
webtorrentAdd webtorrentAdd
@ -31,7 +31,7 @@ import {
const expect = chai.expect const expect = chai.expect
function updateConfigForTranscoding (server: ServerInfo) { function updateConfigForTranscoding (server: PeerTubeServer) {
return server.config.updateCustomSubConfig({ return server.config.updateCustomSubConfig({
newConfig: { newConfig: {
transcoding: { transcoding: {
@ -56,14 +56,14 @@ function updateConfigForTranscoding (server: ServerInfo) {
} }
describe('Test video transcoding', function () { describe('Test video transcoding', function () {
let servers: ServerInfo[] = [] let servers: PeerTubeServer[] = []
let video4k: string let video4k: string
before(async function () { before(async function () {
this.timeout(30_000) this.timeout(30_000)
// Run servers // Run servers
servers = await flushAndRunMultipleServers(2) servers = await createMultipleServers(2)
await setAccessTokensToServers(servers) await setAccessTokensToServers(servers)

Some files were not shown because too many files have changed in this diff Show More