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 { 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 { registerTSPaths } from '../server/helpers/register-ts-paths'
registerTSPaths()
let server: ServerInfo
let server: PeerTubeServer
let video: Video
let threadId: number
@ -188,7 +188,7 @@ function runBenchmark (options: {
}
async function prepare () {
server = await flushAndRunServer(1, {
server = await createSingleServer(1, {
rates_limit: {
api: {
max: 5_000_000

View File

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

View File

@ -6,9 +6,9 @@ import { HttpStatusCode } from '@shared/core-utils'
import {
cleanupTests,
doubleFollow,
flushAndRunMultipleServers,
createMultipleServers,
makeActivityPubGetRequest,
ServerInfo,
PeerTubeServer,
setAccessTokensToServers,
setDefaultVideoChannel
} from '@shared/extra-utils'
@ -17,7 +17,7 @@ import { VideoPlaylistPrivacy } from '@shared/models'
const expect = chai.expect
describe('Test activitypub', function () {
let servers: ServerInfo[] = []
let servers: PeerTubeServer[] = []
let video: { 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 () {
this.timeout(30000)
servers = await flushAndRunMultipleServers(2)
servers = await createMultipleServers(2)
await setAccessTokensToServers(servers)
await setDefaultVideoChannel(servers)

View File

@ -2,19 +2,19 @@
import 'mocha'
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
describe('Test ActivityPub fetcher', function () {
let servers: ServerInfo[]
let servers: PeerTubeServer[]
// ---------------------------------------------------------------
before(async function () {
this.timeout(60000)
servers = await flushAndRunMultipleServers(3)
servers = await createMultipleServers(3)
// Get the access tokens
await setAccessTokensToServers(servers)

View File

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

View File

@ -7,10 +7,9 @@ import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-c
import {
buildAbsoluteFixturePath,
cleanupTests,
flushAndRunMultipleServers,
createMultipleServers,
killallServers,
reRunServer,
ServerInfo,
PeerTubeServer,
wait
} from '../../../../shared/extra-utils'
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
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'
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'
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 result: typeof json = {}
@ -54,7 +53,7 @@ function getAnnounceWithoutContext (server: ServerInfo) {
}
describe('Test ActivityPub security', function () {
let servers: ServerInfo[]
let servers: PeerTubeServer[]
let url: string
const keys = require(buildAbsoluteFixturePath('./ap-json/peertube/keys.json'))
@ -72,7 +71,7 @@ describe('Test ActivityPub security', function () {
before(async function () {
this.timeout(60000)
servers = await flushAndRunMultipleServers(3)
servers = await createMultipleServers(3)
url = servers[0].url + '/inbox'
@ -172,7 +171,7 @@ describe('Test ActivityPub security', function () {
// Invalid peertube actor cache
await killallServers([ servers[1] ])
await reRunServer(servers[1])
await servers[1].run()
const body = activityPubContextify(getAnnounceWithoutContext(servers[1]))
const headers = buildGlobalHeaders(body)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,11 +2,11 @@
import 'mocha'
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'
describe('Test contact form API validators', function () {
let server: ServerInfo
let server: PeerTubeServer
const emails: object[] = []
const defaultBody = {
fromName: 'super name',
@ -25,7 +25,7 @@ describe('Test contact form API validators', function () {
emailPort = await MockSmtpServer.Instance.collectEmails(emails)
// Email is disabled
server = await flushAndRunServer(1)
server = await createSingleServer(1)
command = server.contactForm
})
@ -39,7 +39,7 @@ describe('Test contact form API validators', function () {
await killallServers([ server ])
// 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 })
})
@ -49,7 +49,7 @@ describe('Test contact form API validators', function () {
await killallServers([ server ])
// 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 })

View File

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

View File

@ -4,8 +4,8 @@ import 'mocha'
import {
cleanupTests,
flushAndRunServer,
ServerInfo,
createSingleServer,
PeerTubeServer,
setAccessTokensToServers
} from '../../../../shared/extra-utils'
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 () {
const path = '/api/v1/server/debug'
let server: ServerInfo
let server: PeerTubeServer
let userAccessToken = ''
// ---------------------------------------------------------------
@ -21,7 +21,7 @@ describe('Test debug API validators', function () {
before(async function () {
this.timeout(120000)
server = await flushAndRunServer(1)
server = await createSingleServer(1)
await setAccessTokensToServers([ server ])

View File

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

View File

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

View File

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

View File

@ -4,8 +4,8 @@ import 'mocha'
import {
cleanupTests,
flushAndRunServer,
ServerInfo,
createSingleServer,
PeerTubeServer,
setAccessTokensToServers
} from '../../../../shared/extra-utils'
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 () {
const path = '/api/v1/server/logs'
let server: ServerInfo
let server: PeerTubeServer
let userAccessToken = ''
// ---------------------------------------------------------------
@ -21,7 +21,7 @@ describe('Test logs API validators', function () {
before(async function () {
this.timeout(120000)
server = await flushAndRunServer(1)
server = await createSingleServer(1)
await setAccessTokensToServers([ server ])

View File

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

View File

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

View File

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

View File

@ -4,16 +4,16 @@ import 'mocha'
import { HttpStatusCode } from '@shared/core-utils'
import {
cleanupTests,
flushAndRunServer,
createSingleServer,
makeGetRequest,
ServerInfo,
PeerTubeServer,
setAccessTokensToServers,
setDefaultVideoChannel
} from '@shared/extra-utils'
import { VideoPlaylistPrivacy } from '@shared/models'
describe('Test services API validators', function () {
let server: ServerInfo
let server: PeerTubeServer
let playlistUUID: string
// ---------------------------------------------------------------
@ -21,7 +21,7 @@ describe('Test services API validators', function () {
before(async function () {
this.timeout(60000)
server = await flushAndRunServer(1)
server = await createSingleServer(1)
await setAccessTokensToServers([ 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'
return makeGetRequest({

View File

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

View File

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

View File

@ -4,11 +4,11 @@ import 'mocha'
import {
cleanupTests,
flushAndRunServer,
createSingleServer,
makeDeleteRequest,
makeGetRequest,
makePostBodyRequest,
ServerInfo,
PeerTubeServer,
setAccessTokensToServers
} 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 () {
const path = '/api/v1/users/me/subscriptions'
let server: ServerInfo
let server: PeerTubeServer
let userAccessToken = ''
// ---------------------------------------------------------------
@ -30,7 +30,7 @@ describe('Test user subscriptions API validators', function () {
before(async function () {
this.timeout(30000)
server = await flushAndRunServer(1)
server = await createSingleServer(1)
await setAccessTokensToServers([ server ])

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -3,16 +3,16 @@
import 'mocha'
import {
cleanupTests,
flushAndRunServer,
createSingleServer,
makeGetRequest,
ServerInfo,
PeerTubeServer,
setAccessTokensToServers,
setDefaultVideoChannel
} from '../../../../shared/extra-utils'
import { UserRole } from '../../../../shared/models/users'
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 = [
'/api/v1/video-channels/root_channel/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 () {
let server: ServerInfo
let server: PeerTubeServer
let userAccessToken: string
let moderatorAccessToken: string
@ -43,7 +43,7 @@ describe('Test video filters validators', function () {
before(async function () {
this.timeout(30000)
server = await flushAndRunServer(1)
server = await createSingleServer(1)
await setAccessTokensToServers([ server ])
await setDefaultVideoChannel([ server ])

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -6,8 +6,8 @@ import {
AbusesCommand,
cleanupTests,
doubleFollow,
flushAndRunMultipleServers,
ServerInfo,
createMultipleServers,
PeerTubeServer,
setAccessTokensToServers,
waitJobs
} from '@shared/extra-utils'
@ -16,7 +16,7 @@ import { AbuseMessage, AbusePredefinedReasonsString, AbuseState, AdminAbuse, Use
const expect = chai.expect
describe('Test abuses', function () {
let servers: ServerInfo[] = []
let servers: PeerTubeServer[] = []
let abuseServer1: AdminAbuse
let abuseServer2: AdminAbuse
let commands: AbusesCommand[]
@ -25,7 +25,7 @@ describe('Test abuses', function () {
this.timeout(50000)
// Run servers
servers = await flushAndRunMultipleServers(2)
servers = await createMultipleServers(2)
// Get the access tokens
await setAccessTokensToServers(servers)
@ -389,7 +389,7 @@ describe('Test 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'
? await server.videos.getId({ uuid: videoIdArg })
: videoIdArg
@ -591,7 +591,7 @@ describe('Test 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 })
}

View File

@ -2,12 +2,12 @@
import 'mocha'
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'
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 })
expect(data).to.have.lengthOf(expected.length)
@ -17,7 +17,7 @@ async function checkNotifications (server: ServerInfo, token: string, expected:
}
describe('Test blocklist', function () {
let servers: ServerInfo[]
let servers: PeerTubeServer[]
let videoUUID: string
let userToken1: string
@ -62,7 +62,7 @@ describe('Test blocklist', function () {
before(async function () {
this.timeout(60000)
servers = await flushAndRunMultipleServers(2)
servers = await createMultipleServers(2)
await setAccessTokensToServers(servers)
{

View File

@ -7,8 +7,8 @@ import {
cleanupTests,
CommentsCommand,
doubleFollow,
flushAndRunMultipleServers,
ServerInfo,
createMultipleServers,
PeerTubeServer,
setAccessTokensToServers,
waitJobs
} from '@shared/extra-utils'
@ -16,7 +16,7 @@ import { UserNotificationType } from '@shared/models'
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 })
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 threads = data.filter(t => t.isDeleted === false)
@ -41,8 +41,8 @@ async function checkAllComments (server: ServerInfo, token: string, videoUUID: s
}
async function checkCommentNotification (
mainServer: ServerInfo,
comment: { server: ServerInfo, token: string, videoUUID: string, text: string },
mainServer: PeerTubeServer,
comment: { server: PeerTubeServer, token: string, videoUUID: string, text: string },
check: 'presence' | 'absence'
) {
const command = comment.server.comments
@ -63,7 +63,7 @@ async function checkCommentNotification (
}
describe('Test blocklist', function () {
let servers: ServerInfo[]
let servers: PeerTubeServer[]
let videoUUID1: string
let videoUUID2: string
let videoUUID3: string
@ -77,7 +77,7 @@ describe('Test blocklist', function () {
before(async function () {
this.timeout(120000)
servers = await flushAndRunMultipleServers(3)
servers = await createMultipleServers(3)
await setAccessTokensToServers(servers)
command = servers[0].blocklist

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -5,9 +5,9 @@ import * as chai from 'chai'
import {
cleanupTests,
doubleFollow,
flushAndRunMultipleServers,
createMultipleServers,
RedundancyCommand,
ServerInfo,
PeerTubeServer,
setAccessTokensToServers,
waitJobs
} from '@shared/extra-utils'
@ -18,7 +18,7 @@ const expect = chai.expect
describe('Test manage videos redundancy', function () {
const targets: VideoRedundanciesTarget[] = [ 'my-videos', 'remote-videos' ]
let servers: ServerInfo[]
let servers: PeerTubeServer[]
let video1Server2UUID: string
let video2Server2UUID: string
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
await setAccessTokensToServers(servers)

View File

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

View File

@ -11,12 +11,11 @@ import {
checkVideoFilesWereRemoved,
cleanupTests,
doubleFollow,
flushAndRunMultipleServers,
createMultipleServers,
killallServers,
makeGetRequest,
reRunServer,
root,
ServerInfo,
PeerTubeServer,
setAccessTokensToServers,
wait,
waitJobs
@ -25,11 +24,11 @@ import { VideoPrivacy, VideoRedundancyStrategy, VideoRedundancyStrategyWithManua
const expect = chai.expect
let servers: ServerInfo[] = []
let servers: PeerTubeServer[] = []
let video1Server2UUID: string
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)
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)
}
async function flushAndRunServers (strategy: VideoRedundancyStrategy | null, additionalParams: any = {}, withWebtorrent = true) {
async function createSingleServers (strategy: VideoRedundancyStrategy | null, additionalParams: any = {}, withWebtorrent = true) {
const strategies: any[] = []
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
await setAccessTokensToServers(servers)
@ -288,7 +287,7 @@ describe('Test videos redundancy', function () {
before(function () {
this.timeout(120000)
return flushAndRunServers(strategy)
return createSingleServers(strategy)
})
it('Should have 1 webseed on the first video', async function () {
@ -338,7 +337,7 @@ describe('Test videos redundancy', function () {
before(function () {
this.timeout(120000)
return flushAndRunServers(strategy)
return createSingleServers(strategy)
})
it('Should have 1 webseed on the first video', async function () {
@ -388,7 +387,7 @@ describe('Test videos redundancy', function () {
before(function () {
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 () {
@ -458,7 +457,7 @@ describe('Test videos redundancy', function () {
before(async function () {
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 () {
@ -519,7 +518,7 @@ describe('Test videos redundancy', function () {
before(function () {
this.timeout(120000)
return flushAndRunServers(null)
return createSingleServers(null)
})
it('Should have 1 webseed on the first video', async function () {
@ -575,7 +574,7 @@ describe('Test videos redundancy', function () {
describe('Test expiration', function () {
const strategy = 'recently-added'
async function checkContains (servers: ServerInfo[], str: string) {
async function checkContains (servers: PeerTubeServer[], str: string) {
for (const server of servers) {
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) {
const video = await server.videos.get({ id: video1Server2UUID })
@ -598,7 +597,7 @@ describe('Test videos redundancy', function () {
before(async function () {
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()
})
@ -640,7 +639,7 @@ describe('Test videos redundancy', function () {
before(async function () {
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()
@ -691,7 +690,7 @@ describe('Test videos redundancy', function () {
await waitJobs(servers)
await killallServers([ servers[0] ])
await reRunServer(servers[0], {
await servers[0].run({
redundancy: {
videos: {
check_interval: '1 second',

View File

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

View File

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

View File

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

View File

@ -2,19 +2,19 @@
import 'mocha'
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'
const expect = chai.expect
describe('Test channels search', function () {
let server: ServerInfo = null
let server: PeerTubeServer = null
let command: SearchCommand
before(async function () {
this.timeout(30000)
server = await flushAndRunServer(1)
server = await createSingleServer(1)
await setAccessTokensToServers([ server ])

View File

@ -2,7 +2,7 @@
import 'mocha'
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'
const expect = chai.expect
@ -10,13 +10,13 @@ const expect = chai.expect
describe('Test videos search', function () {
const localVideoName = 'local video' + new Date().toISOString()
let server: ServerInfo = null
let server: PeerTubeServer = null
let command: SearchCommand
before(async function () {
this.timeout(30000)
server = await flushAndRunServer(1)
server = await createSingleServer(1)
await setAccessTokensToServers([ server ])

View File

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

View File

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

View File

@ -4,9 +4,9 @@ import 'mocha'
import * as chai from 'chai'
import {
cleanupTests,
flushAndRunMultipleServers,
createMultipleServers,
MockInstancesIndex,
ServerInfo,
PeerTubeServer,
setAccessTokensToServers,
wait,
waitJobs
@ -14,7 +14,7 @@ import {
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 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 waitJobs(servers)
}
async function resetFollows (servers: ServerInfo[]) {
async function resetFollows (servers: PeerTubeServer[]) {
try {
await servers[0].follows.unfollow({ target: servers[1] })
await servers[1].follows.unfollow({ target: servers[0] })
@ -52,12 +52,12 @@ async function resetFollows (servers: ServerInfo[]) {
}
describe('Test auto follows', function () {
let servers: ServerInfo[] = []
let servers: PeerTubeServer[] = []
before(async function () {
this.timeout(30000)
servers = await flushAndRunMultipleServers(3)
servers = await createMultipleServers(3)
// Get the access tokens
await setAccessTokensToServers(servers)

View File

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

View File

@ -5,19 +5,18 @@ import * as chai from 'chai'
import { HttpStatusCode } from '@shared/core-utils'
import {
cleanupTests,
flushAndRunServer,
createSingleServer,
killallServers,
makeGetRequest,
parallelTests,
reRunServer,
ServerInfo,
PeerTubeServer,
setAccessTokensToServers
} from '@shared/extra-utils'
import { CustomConfig } from '@shared/models'
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.shortDescription).to.equal(
'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 () {
let server: ServerInfo = null
let server: PeerTubeServer = null
before(async function () {
this.timeout(30000)
server = await flushAndRunServer(1)
server = await createSingleServer(1)
await setAccessTokensToServers([ server ])
})
@ -456,7 +455,7 @@ describe('Test config', function () {
await killallServers([ server ])
await reRunServer(server)
await server.run()
const data = await server.config.getCustomConfig()
@ -512,7 +511,7 @@ describe('Test config', function () {
frameguard: { enabled: false }
}
}
server = await reRunServer(server, config)
await server.run(config)
{
const res = await makeGetRequest({

View File

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

View File

@ -3,12 +3,12 @@
import 'mocha'
import * as chai from 'chai'
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
describe('Test emails', function () {
let server: ServerInfo
let server: PeerTubeServer
let userId: number
let userId2: number
let userAccessToken: string
@ -39,7 +39,7 @@ describe('Test emails', function () {
port: emailPort
}
}
server = await flushAndRunServer(1, overrideConfig)
server = await createSingleServer(1, overrideConfig)
await setAccessTokensToServers([ server ])
{

View File

@ -3,13 +3,13 @@
import 'mocha'
import * as chai from 'chai'
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'
const expect = chai.expect
describe('Test follow constraints', function () {
let servers: ServerInfo[] = []
let servers: PeerTubeServer[] = []
let video1UUID: string
let video2UUID: string
let userToken: string
@ -17,7 +17,7 @@ describe('Test follow constraints', function () {
before(async function () {
this.timeout(90000)
servers = await flushAndRunMultipleServers(2)
servers = await createMultipleServers(2)
// Get the access tokens
await setAccessTokensToServers(servers)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,16 +1,16 @@
import 'mocha'
import * as request from 'supertest'
import { ServerInfo } from '../../../../shared/extra-utils'
import { cleanupTests, flushAndRunServer } from '../../../../shared/extra-utils/server/servers'
import { PeerTubeServer } from '../../../../shared/extra-utils'
import { cleanupTests, createSingleServer } from '../../../../shared/extra-utils/server/servers'
import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
describe('Start and stop server without web client routes', function () {
let server: ServerInfo
let server: PeerTubeServer
before(async function () {
this.timeout(30000)
server = await flushAndRunServer(1, {}, [ '--no-client' ])
server = await createSingleServer(1, {}, [ '--no-client' ])
})
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 {
cleanupTests,
flushAndRunServer,
createSingleServer,
killallServers,
PluginsCommand,
reRunServer,
ServerInfo,
PeerTubeServer,
setAccessTokensToServers,
testHelloWorldRegisteredSettings,
wait
@ -19,7 +18,7 @@ import { PluginType } from '@shared/models'
const expect = chai.expect
describe('Test plugins', function () {
let server: ServerInfo = null
let server: PeerTubeServer = null
let command: PluginsCommand
before(async function () {
@ -30,7 +29,7 @@ describe('Test plugins', function () {
index: { check_latest_versions_interval: '5 seconds' }
}
}
server = await flushAndRunServer(1, configOverride)
server = await createSingleServer(1, configOverride)
await setAccessTokensToServers([ server ])
command = server.plugins
@ -245,7 +244,7 @@ describe('Test plugins', function () {
// Restart the server to take into account this change
await killallServers([ server ])
await reRunServer(server)
await server.run()
{
const body = await command.list({ pluginType: PluginType.PLUGIN })
@ -326,7 +325,7 @@ describe('Test plugins', function () {
await check()
await killallServers([ server ])
await reRunServer(server)
await server.run()
await check()
})

View File

@ -2,10 +2,10 @@
import { expect } from 'chai'
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 () {
let server: ServerInfo
let server: PeerTubeServer
let videoId: string
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 ])
const { uuid } = await server.videos.upload()

View File

@ -2,13 +2,13 @@
import 'mocha'
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'
const expect = chai.expect
describe('Test services', function () {
let server: ServerInfo = null
let server: PeerTubeServer = null
let playlistUUID: string
let playlistDisplayName: string
let video: Video
@ -16,7 +16,7 @@ describe('Test services', function () {
before(async function () {
this.timeout(30000)
server = await flushAndRunServer(1)
server = await createSingleServer(1)
await setAccessTokensToServers([ server ])
await setDefaultVideoChannel([ server ])

View File

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

View File

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

View File

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

View File

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

View File

@ -3,12 +3,12 @@
import 'mocha'
import * as chai from 'chai'
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
describe('Test users account verification', function () {
let server: ServerInfo
let server: PeerTubeServer
let userId: number
let userAccessToken: string
let verificationString: string
@ -34,7 +34,7 @@ describe('Test users account verification', function () {
port
}
}
server = await flushAndRunServer(1, overrideConfig)
server = await createSingleServer(1, overrideConfig)
await setAccessTokensToServers([ server ])
})

View File

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

View File

@ -4,12 +4,12 @@ import 'mocha'
import * as chai from 'chai'
import { join } from 'path'
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
describe('Test audio only video transcoding', function () {
let servers: ServerInfo[] = []
let servers: PeerTubeServer[] = []
let videoUUID: string
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
await setAccessTokensToServers(servers)

View File

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

View File

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

View File

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

View File

@ -6,8 +6,8 @@ import {
checkVideoFilesWereRemoved,
cleanupTests,
doubleFollow,
flushAndRunMultipleServers,
ServerInfo,
createMultipleServers,
PeerTubeServer,
setAccessTokensToServers,
testCaptionFile,
wait,
@ -19,13 +19,13 @@ const expect = chai.expect
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}'
let servers: ServerInfo[]
let servers: PeerTubeServer[]
let videoUUID: string
before(async function () {
this.timeout(60000)
servers = await flushAndRunMultipleServers(2)
servers = await createMultipleServers(2)
await setAccessTokensToServers(servers)
await doubleFollow(servers[0], servers[1])

View File

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

View File

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

View File

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

View File

@ -2,12 +2,12 @@
import 'mocha'
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
describe('Test video description', function () {
let servers: ServerInfo[] = []
let servers: PeerTubeServer[] = []
let videoUUID = ''
let videoId: number
const longDescription = 'my super description for server 1'.repeat(50)
@ -16,7 +16,7 @@ describe('Test video description', function () {
this.timeout(40000)
// Run servers
servers = await flushAndRunMultipleServers(2)
servers = await createMultipleServers(2)
// Get the access tokens
await setAccessTokensToServers(servers)

View File

@ -11,9 +11,9 @@ import {
checkTmpIsEmpty,
cleanupTests,
doubleFollow,
flushAndRunMultipleServers,
createMultipleServers,
makeRawRequest,
ServerInfo,
PeerTubeServer,
setAccessTokensToServers,
waitJobs,
webtorrentAdd
@ -23,7 +23,7 @@ import { DEFAULT_AUDIO_RESOLUTION } from '../../../initializers/constants'
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) {
const videoDetails = await server.videos.get({ id: videoUUID })
const baseUrl = `http://${videoDetails.account.host}`
@ -98,7 +98,7 @@ async function checkHlsPlaylist (servers: ServerInfo[], videoUUID: string, hlsOn
}
describe('Test HLS videos', function () {
let servers: ServerInfo[] = []
let servers: PeerTubeServer[] = []
let videoUUID = ''
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
await setAccessTokensToServers(servers)

View File

@ -6,9 +6,9 @@ import {
areHttpImportTestsDisabled,
cleanupTests,
doubleFollow,
flushAndRunMultipleServers,
createMultipleServers,
ImportsCommand,
ServerInfo,
PeerTubeServer,
setAccessTokensToServers,
testCaptionFile,
testImage,
@ -19,13 +19,13 @@ import { VideoPrivacy, VideoResolution } from '@shared/models'
const expect = chai.expect
describe('Test video imports', function () {
let servers: ServerInfo[] = []
let servers: PeerTubeServer[] = []
let channelIdServer1: number
let channelIdServer2: number
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 })
expect(videoHttp.name).to.equal('small video - youtube')
@ -63,7 +63,7 @@ describe('Test video imports', function () {
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 })
expect(video.name).to.equal('my super name')
@ -84,7 +84,7 @@ describe('Test video imports', function () {
this.timeout(30_000)
// Run servers
servers = await flushAndRunMultipleServers(2)
servers = await createMultipleServers(2)
await setAccessTokensToServers(servers)

View File

@ -2,7 +2,7 @@
import 'mocha'
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'
const expect = chai.expect
@ -13,7 +13,7 @@ function createOverviewRes (overview: VideosOverview) {
}
describe('Test video NSFW policy', function () {
let server: ServerInfo
let server: PeerTubeServer
let userAccessToken: string
let customConfig: CustomConfig
@ -61,7 +61,7 @@ describe('Test video NSFW policy', function () {
before(async function () {
this.timeout(50000)
server = await flushAndRunServer(1)
server = await createSingleServer(1)
// Get the access tokens
await setAccessTokensToServers([ server ])

View File

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

View File

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

View File

@ -3,13 +3,13 @@
import 'mocha'
import * as chai from 'chai'
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'
const expect = chai.expect
describe('Test video privacy', function () {
const servers: ServerInfo[] = []
const servers: PeerTubeServer[] = []
let anotherUserToken: string
let privateVideoId: number
@ -35,8 +35,8 @@ describe('Test video privacy', function () {
this.timeout(50000)
// Run servers
servers.push(await flushAndRunServer(1, dontFederateUnlistedConfig))
servers.push(await flushAndRunServer(2))
servers.push(await createSingleServer(1, dontFederateUnlistedConfig))
servers.push(await createSingleServer(2))
// Get the access tokens
await setAccessTokensToServers(servers)

View File

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

View File

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

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