aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api')
-rw-r--r--server/tests/api/activitypub/cleaner.ts8
-rw-r--r--server/tests/api/activitypub/client.ts8
-rw-r--r--server/tests/api/activitypub/fetch.ts6
-rw-r--r--server/tests/api/activitypub/refresher.ts11
-rw-r--r--server/tests/api/activitypub/security.ts17
-rw-r--r--server/tests/api/check-params/abuses.ts12
-rw-r--r--server/tests/api/check-params/accounts.ts8
-rw-r--r--server/tests/api/check-params/blocklist.ts10
-rw-r--r--server/tests/api/check-params/bulk.ts8
-rw-r--r--server/tests/api/check-params/config.ts8
-rw-r--r--server/tests/api/check-params/contact-form.ts10
-rw-r--r--server/tests/api/check-params/custom-pages.ts8
-rw-r--r--server/tests/api/check-params/debug.ts8
-rw-r--r--server/tests/api/check-params/follows.ts8
-rw-r--r--server/tests/api/check-params/jobs.ts8
-rw-r--r--server/tests/api/check-params/live.ts8
-rw-r--r--server/tests/api/check-params/logs.ts8
-rw-r--r--server/tests/api/check-params/plugins.ts8
-rw-r--r--server/tests/api/check-params/redundancy.ts8
-rw-r--r--server/tests/api/check-params/search.ts10
-rw-r--r--server/tests/api/check-params/services.ts10
-rw-r--r--server/tests/api/check-params/upload-quota.ts8
-rw-r--r--server/tests/api/check-params/user-notifications.ts8
-rw-r--r--server/tests/api/check-params/user-subscriptions.ts8
-rw-r--r--server/tests/api/check-params/users.ts15
-rw-r--r--server/tests/api/check-params/video-blacklist.ts8
-rw-r--r--server/tests/api/check-params/video-captions.ts8
-rw-r--r--server/tests/api/check-params/video-channels.ts8
-rw-r--r--server/tests/api/check-params/video-comments.ts8
-rw-r--r--server/tests/api/check-params/video-imports.ts8
-rw-r--r--server/tests/api/check-params/video-playlists.ts8
-rw-r--r--server/tests/api/check-params/videos-filter.ts10
-rw-r--r--server/tests/api/check-params/videos-history.ts8
-rw-r--r--server/tests/api/check-params/videos-overviews.ts6
-rw-r--r--server/tests/api/check-params/videos.ts8
-rw-r--r--server/tests/api/live/live-constraints.ts8
-rw-r--r--server/tests/api/live/live-permanent.ts8
-rw-r--r--server/tests/api/live/live-save-replay.ts8
-rw-r--r--server/tests/api/live/live-socket-messages.ts8
-rw-r--r--server/tests/api/live/live-views.ts8
-rw-r--r--server/tests/api/live/live.ts11
-rw-r--r--server/tests/api/moderation/abuses.ts12
-rw-r--r--server/tests/api/moderation/blocklist-notification.ts8
-rw-r--r--server/tests/api/moderation/blocklist.ts16
-rw-r--r--server/tests/api/moderation/video-blacklist.ts13
-rw-r--r--server/tests/api/notifications/admin-notifications.ts4
-rw-r--r--server/tests/api/notifications/comments-notifications.ts4
-rw-r--r--server/tests/api/notifications/moderation-notifications.ts4
-rw-r--r--server/tests/api/notifications/notifications-api.ts4
-rw-r--r--server/tests/api/notifications/user-notifications.ts4
-rw-r--r--server/tests/api/redundancy/manage-redundancy.ts8
-rw-r--r--server/tests/api/redundancy/redundancy-constraints.ts19
-rw-r--r--server/tests/api/redundancy/redundancy.ts33
-rw-r--r--server/tests/api/search/search-activitypub-video-channels.ts8
-rw-r--r--server/tests/api/search/search-activitypub-video-playlists.ts8
-rw-r--r--server/tests/api/search/search-activitypub-videos.ts8
-rw-r--r--server/tests/api/search/search-channels.ts6
-rw-r--r--server/tests/api/search/search-index.ts6
-rw-r--r--server/tests/api/search/search-playlists.ts8
-rw-r--r--server/tests/api/search/search-videos.ts8
-rw-r--r--server/tests/api/server/auto-follows.ts14
-rw-r--r--server/tests/api/server/bulk.ts8
-rw-r--r--server/tests/api/server/config.ts15
-rw-r--r--server/tests/api/server/contact-form.ts16
-rw-r--r--server/tests/api/server/email.ts6
-rw-r--r--server/tests/api/server/follow-constraints.ts6
-rw-r--r--server/tests/api/server/follows-moderation.ts12
-rw-r--r--server/tests/api/server/follows.ts8
-rw-r--r--server/tests/api/server/handle-down.ts13
-rw-r--r--server/tests/api/server/homepage.ts13
-rw-r--r--server/tests/api/server/jobs.ts8
-rw-r--r--server/tests/api/server/logs.ts11
-rw-r--r--server/tests/api/server/no-client.ts8
-rw-r--r--server/tests/api/server/plugins.ts13
-rw-r--r--server/tests/api/server/reverse-proxy.ts6
-rw-r--r--server/tests/api/server/services.ts6
-rw-r--r--server/tests/api/server/stats.ts8
-rw-r--r--server/tests/api/server/tracker.ts10
-rw-r--r--server/tests/api/users/user-subscriptions.ts8
-rw-r--r--server/tests/api/users/users-multiple-servers.ts8
-rw-r--r--server/tests/api/users/users-verification.ts6
-rw-r--r--server/tests/api/users/users.ts13
-rw-r--r--server/tests/api/videos/audio-only.ts6
-rw-r--r--server/tests/api/videos/multiple-servers.ts8
-rw-r--r--server/tests/api/videos/resumable-upload.ts8
-rw-r--r--server/tests/api/videos/single-server.ts8
-rw-r--r--server/tests/api/videos/video-captions.ts8
-rw-r--r--server/tests/api/videos/video-change-ownership.ts14
-rw-r--r--server/tests/api/videos/video-channels.ts10
-rw-r--r--server/tests/api/videos/video-comments.ts8
-rw-r--r--server/tests/api/videos/video-description.ts6
-rw-r--r--server/tests/api/videos/video-hls.ts10
-rw-r--r--server/tests/api/videos/video-imports.ts12
-rw-r--r--server/tests/api/videos/video-nsfw.ts6
-rw-r--r--server/tests/api/videos/video-playlist-thumbnails.ts12
-rw-r--r--server/tests/api/videos/video-playlists.ts18
-rw-r--r--server/tests/api/videos/video-privacy.ts8
-rw-r--r--server/tests/api/videos/video-schedule-update.ts8
-rw-r--r--server/tests/api/videos/video-transcoder.ts10
-rw-r--r--server/tests/api/videos/videos-filter.ts10
-rw-r--r--server/tests/api/videos/videos-history.ts13
-rw-r--r--server/tests/api/videos/videos-overview.ts6
-rw-r--r--server/tests/api/videos/videos-views-cleaner.ts13
103 files changed, 476 insertions, 483 deletions
diff --git a/server/tests/api/activitypub/cleaner.ts b/server/tests/api/activitypub/cleaner.ts
index 1421824da..a5ce449f3 100644
--- a/server/tests/api/activitypub/cleaner.ts
+++ b/server/tests/api/activitypub/cleaner.ts
@@ -5,8 +5,8 @@ import * as chai from 'chai'
5import { 5import {
6 cleanupTests, 6 cleanupTests,
7 doubleFollow, 7 doubleFollow,
8 flushAndRunMultipleServers, 8 createMultipleServers,
9 ServerInfo, 9 PeerTubeServer,
10 setAccessTokensToServers, 10 setAccessTokensToServers,
11 wait, 11 wait,
12 waitJobs 12 waitJobs
@@ -15,7 +15,7 @@ import {
15const expect = chai.expect 15const expect = chai.expect
16 16
17describe('Test AP cleaner', function () { 17describe('Test AP cleaner', function () {
18 let servers: ServerInfo[] = [] 18 let servers: PeerTubeServer[] = []
19 let videoUUID1: string 19 let videoUUID1: string
20 let videoUUID2: string 20 let videoUUID2: string
21 let videoUUID3: string 21 let videoUUID3: string
@@ -30,7 +30,7 @@ describe('Test AP cleaner', function () {
30 videos: { cleanup_remote_interactions: true } 30 videos: { cleanup_remote_interactions: true }
31 } 31 }
32 } 32 }
33 servers = await flushAndRunMultipleServers(3, config) 33 servers = await createMultipleServers(3, config)
34 34
35 // Get the access tokens 35 // Get the access tokens
36 await setAccessTokensToServers(servers) 36 await setAccessTokensToServers(servers)
diff --git a/server/tests/api/activitypub/client.ts b/server/tests/api/activitypub/client.ts
index 5845045a3..720231f02 100644
--- a/server/tests/api/activitypub/client.ts
+++ b/server/tests/api/activitypub/client.ts
@@ -6,9 +6,9 @@ import { HttpStatusCode } from '@shared/core-utils'
6import { 6import {
7 cleanupTests, 7 cleanupTests,
8 doubleFollow, 8 doubleFollow,
9 flushAndRunMultipleServers, 9 createMultipleServers,
10 makeActivityPubGetRequest, 10 makeActivityPubGetRequest,
11 ServerInfo, 11 PeerTubeServer,
12 setAccessTokensToServers, 12 setAccessTokensToServers,
13 setDefaultVideoChannel 13 setDefaultVideoChannel
14} from '@shared/extra-utils' 14} from '@shared/extra-utils'
@@ -17,7 +17,7 @@ import { VideoPlaylistPrivacy } from '@shared/models'
17const expect = chai.expect 17const expect = chai.expect
18 18
19describe('Test activitypub', function () { 19describe('Test activitypub', function () {
20 let servers: ServerInfo[] = [] 20 let servers: PeerTubeServer[] = []
21 let video: { id: number, uuid: string, shortUUID: string } 21 let video: { id: number, uuid: string, shortUUID: string }
22 let playlist: { id: number, uuid: string, shortUUID: string } 22 let playlist: { id: number, uuid: string, shortUUID: string }
23 23
@@ -62,7 +62,7 @@ describe('Test activitypub', function () {
62 before(async function () { 62 before(async function () {
63 this.timeout(30000) 63 this.timeout(30000)
64 64
65 servers = await flushAndRunMultipleServers(2) 65 servers = await createMultipleServers(2)
66 66
67 await setAccessTokensToServers(servers) 67 await setAccessTokensToServers(servers)
68 await setDefaultVideoChannel(servers) 68 await setDefaultVideoChannel(servers)
diff --git a/server/tests/api/activitypub/fetch.ts b/server/tests/api/activitypub/fetch.ts
index 34694a773..ddfe6cfe0 100644
--- a/server/tests/api/activitypub/fetch.ts
+++ b/server/tests/api/activitypub/fetch.ts
@@ -2,19 +2,19 @@
2 2
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { cleanupTests, doubleFollow, flushAndRunMultipleServers, ServerInfo, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' 5import { cleanupTests, doubleFollow, createMultipleServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
6 6
7const expect = chai.expect 7const expect = chai.expect
8 8
9describe('Test ActivityPub fetcher', function () { 9describe('Test ActivityPub fetcher', function () {
10 let servers: ServerInfo[] 10 let servers: PeerTubeServer[]
11 11
12 // --------------------------------------------------------------- 12 // ---------------------------------------------------------------
13 13
14 before(async function () { 14 before(async function () {
15 this.timeout(60000) 15 this.timeout(60000)
16 16
17 servers = await flushAndRunMultipleServers(3) 17 servers = await createMultipleServers(3)
18 18
19 // Get the access tokens 19 // Get the access tokens
20 await setAccessTokensToServers(servers) 20 await setAccessTokensToServers(servers)
diff --git a/server/tests/api/activitypub/refresher.ts b/server/tests/api/activitypub/refresher.ts
index d2f71e857..bbec0d309 100644
--- a/server/tests/api/activitypub/refresher.ts
+++ b/server/tests/api/activitypub/refresher.ts
@@ -5,10 +5,9 @@ import { HttpStatusCode } from '@shared/core-utils'
5import { 5import {
6 cleanupTests, 6 cleanupTests,
7 doubleFollow, 7 doubleFollow,
8 flushAndRunMultipleServers, 8 createMultipleServers,
9 killallServers, 9 killallServers,
10 reRunServer, 10 PeerTubeServer,
11 ServerInfo,
12 setAccessTokensToServers, 11 setAccessTokensToServers,
13 setDefaultVideoChannel, 12 setDefaultVideoChannel,
14 wait, 13 wait,
@@ -17,7 +16,7 @@ import {
17import { VideoPlaylistPrivacy } from '@shared/models' 16import { VideoPlaylistPrivacy } from '@shared/models'
18 17
19describe('Test AP refresher', function () { 18describe('Test AP refresher', function () {
20 let servers: ServerInfo[] = [] 19 let servers: PeerTubeServer[] = []
21 let videoUUID1: string 20 let videoUUID1: string
22 let videoUUID2: string 21 let videoUUID2: string
23 let videoUUID3: string 22 let videoUUID3: string
@@ -27,7 +26,7 @@ describe('Test AP refresher', function () {
27 before(async function () { 26 before(async function () {
28 this.timeout(60000) 27 this.timeout(60000)
29 28
30 servers = await flushAndRunMultipleServers(2, { transcoding: { enabled: false } }) 29 servers = await createMultipleServers(2, { transcoding: { enabled: false } })
31 30
32 // Get the access tokens 31 // Get the access tokens
33 await setAccessTokensToServers(servers) 32 await setAccessTokensToServers(servers)
@@ -95,7 +94,7 @@ describe('Test AP refresher', function () {
95 // The refresh should fail 94 // The refresh should fail
96 await waitJobs([ servers[0] ]) 95 await waitJobs([ servers[0] ])
97 96
98 await reRunServer(servers[1]) 97 await servers[1].run()
99 98
100 await servers[0].videos.get({ id: videoUUID3 }) 99 await servers[0].videos.get({ id: videoUUID3 })
101 }) 100 })
diff --git a/server/tests/api/activitypub/security.ts b/server/tests/api/activitypub/security.ts
index ab0eb256e..c173648b3 100644
--- a/server/tests/api/activitypub/security.ts
+++ b/server/tests/api/activitypub/security.ts
@@ -7,10 +7,9 @@ import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-c
7import { 7import {
8 buildAbsoluteFixturePath, 8 buildAbsoluteFixturePath,
9 cleanupTests, 9 cleanupTests,
10 flushAndRunMultipleServers, 10 createMultipleServers,
11 killallServers, 11 killallServers,
12 reRunServer, 12 PeerTubeServer,
13 ServerInfo,
14 wait 13 wait
15} from '../../../../shared/extra-utils' 14} from '../../../../shared/extra-utils'
16import { makeFollowRequest, makePOSTAPRequest } from '../../../../shared/extra-utils/requests/activitypub' 15import { makeFollowRequest, makePOSTAPRequest } from '../../../../shared/extra-utils/requests/activitypub'
@@ -20,7 +19,7 @@ import { buildGlobalHeaders } from '../../../lib/job-queue/handlers/utils/activi
20 19
21const expect = chai.expect 20const expect = chai.expect
22 21
23function setKeysOfServer (onServer: ServerInfo, ofServer: ServerInfo, publicKey: string, privateKey: string) { 22function setKeysOfServer (onServer: PeerTubeServer, ofServer: PeerTubeServer, publicKey: string, privateKey: string) {
24 const url = 'http://localhost:' + ofServer.port + '/accounts/peertube' 23 const url = 'http://localhost:' + ofServer.port + '/accounts/peertube'
25 24
26 return Promise.all([ 25 return Promise.all([
@@ -29,7 +28,7 @@ function setKeysOfServer (onServer: ServerInfo, ofServer: ServerInfo, publicKey:
29 ]) 28 ])
30} 29}
31 30
32function setUpdatedAtOfServer (onServer: ServerInfo, ofServer: ServerInfo, updatedAt: string) { 31function setUpdatedAtOfServer (onServer: PeerTubeServer, ofServer: PeerTubeServer, updatedAt: string) {
33 const url = 'http://localhost:' + ofServer.port + '/accounts/peertube' 32 const url = 'http://localhost:' + ofServer.port + '/accounts/peertube'
34 33
35 return Promise.all([ 34 return Promise.all([
@@ -38,7 +37,7 @@ function setUpdatedAtOfServer (onServer: ServerInfo, ofServer: ServerInfo, updat
38 ]) 37 ])
39} 38}
40 39
41function getAnnounceWithoutContext (server: ServerInfo) { 40function getAnnounceWithoutContext (server: PeerTubeServer) {
42 const json = require(buildAbsoluteFixturePath('./ap-json/peertube/announce-without-context.json')) 41 const json = require(buildAbsoluteFixturePath('./ap-json/peertube/announce-without-context.json'))
43 const result: typeof json = {} 42 const result: typeof json = {}
44 43
@@ -54,7 +53,7 @@ function getAnnounceWithoutContext (server: ServerInfo) {
54} 53}
55 54
56describe('Test ActivityPub security', function () { 55describe('Test ActivityPub security', function () {
57 let servers: ServerInfo[] 56 let servers: PeerTubeServer[]
58 let url: string 57 let url: string
59 58
60 const keys = require(buildAbsoluteFixturePath('./ap-json/peertube/keys.json')) 59 const keys = require(buildAbsoluteFixturePath('./ap-json/peertube/keys.json'))
@@ -72,7 +71,7 @@ describe('Test ActivityPub security', function () {
72 before(async function () { 71 before(async function () {
73 this.timeout(60000) 72 this.timeout(60000)
74 73
75 servers = await flushAndRunMultipleServers(3) 74 servers = await createMultipleServers(3)
76 75
77 url = servers[0].url + '/inbox' 76 url = servers[0].url + '/inbox'
78 77
@@ -172,7 +171,7 @@ describe('Test ActivityPub security', function () {
172 171
173 // Invalid peertube actor cache 172 // Invalid peertube actor cache
174 await killallServers([ servers[1] ]) 173 await killallServers([ servers[1] ])
175 await reRunServer(servers[1]) 174 await servers[1].run()
176 175
177 const body = activityPubContextify(getAnnounceWithoutContext(servers[1])) 176 const body = activityPubContextify(getAnnounceWithoutContext(servers[1]))
178 const headers = buildGlobalHeaders(body) 177 const headers = buildGlobalHeaders(body)
diff --git a/server/tests/api/check-params/abuses.ts b/server/tests/api/check-params/abuses.ts
index 7a6790ba8..62811f932 100644
--- a/server/tests/api/check-params/abuses.ts
+++ b/server/tests/api/check-params/abuses.ts
@@ -9,10 +9,10 @@ import {
9 checkBadStartPagination, 9 checkBadStartPagination,
10 cleanupTests, 10 cleanupTests,
11 doubleFollow, 11 doubleFollow,
12 flushAndRunServer, 12 createSingleServer,
13 makeGetRequest, 13 makeGetRequest,
14 makePostBodyRequest, 14 makePostBodyRequest,
15 ServerInfo, 15 PeerTubeServer,
16 setAccessTokensToServers, 16 setAccessTokensToServers,
17 waitJobs 17 waitJobs
18} from '@shared/extra-utils' 18} from '@shared/extra-utils'
@@ -21,7 +21,7 @@ import { AbuseCreate, AbuseState } from '@shared/models'
21describe('Test abuses API validators', function () { 21describe('Test abuses API validators', function () {
22 const basePath = '/api/v1/abuses/' 22 const basePath = '/api/v1/abuses/'
23 23
24 let server: ServerInfo 24 let server: PeerTubeServer
25 25
26 let userToken = '' 26 let userToken = ''
27 let userToken2 = '' 27 let userToken2 = ''
@@ -35,7 +35,7 @@ describe('Test abuses API validators', function () {
35 before(async function () { 35 before(async function () {
36 this.timeout(30000) 36 this.timeout(30000)
37 37
38 server = await flushAndRunServer(1) 38 server = await createSingleServer(1)
39 39
40 await setAccessTokensToServers([ server ]) 40 await setAccessTokensToServers([ server ])
41 41
@@ -404,12 +404,12 @@ describe('Test abuses API validators', function () {
404 404
405 describe('When trying to manage messages of a remote abuse', function () { 405 describe('When trying to manage messages of a remote abuse', function () {
406 let remoteAbuseId: number 406 let remoteAbuseId: number
407 let anotherServer: ServerInfo 407 let anotherServer: PeerTubeServer
408 408
409 before(async function () { 409 before(async function () {
410 this.timeout(50000) 410 this.timeout(50000)
411 411
412 anotherServer = await flushAndRunServer(2) 412 anotherServer = await createSingleServer(2)
413 await setAccessTokensToServers([ anotherServer ]) 413 await setAccessTokensToServers([ anotherServer ])
414 414
415 await doubleFollow(anotherServer, server) 415 await doubleFollow(anotherServer, server)
diff --git a/server/tests/api/check-params/accounts.ts b/server/tests/api/check-params/accounts.ts
index 223322626..e866593db 100644
--- a/server/tests/api/check-params/accounts.ts
+++ b/server/tests/api/check-params/accounts.ts
@@ -7,20 +7,20 @@ import {
7 checkBadSortPagination, 7 checkBadSortPagination,
8 checkBadStartPagination, 8 checkBadStartPagination,
9 cleanupTests, 9 cleanupTests,
10 flushAndRunServer, 10 createSingleServer,
11 ServerInfo 11 PeerTubeServer
12} from '@shared/extra-utils' 12} from '@shared/extra-utils'
13 13
14describe('Test accounts API validators', function () { 14describe('Test accounts API validators', function () {
15 const path = '/api/v1/accounts/' 15 const path = '/api/v1/accounts/'
16 let server: ServerInfo 16 let server: PeerTubeServer
17 17
18 // --------------------------------------------------------------- 18 // ---------------------------------------------------------------
19 19
20 before(async function () { 20 before(async function () {
21 this.timeout(30000) 21 this.timeout(30000)
22 22
23 server = await flushAndRunServer(1) 23 server = await createSingleServer(1)
24 }) 24 })
25 25
26 describe('When listing accounts', function () { 26 describe('When listing accounts', function () {
diff --git a/server/tests/api/check-params/blocklist.ts b/server/tests/api/check-params/blocklist.ts
index 14e45e503..b2a1cc4e2 100644
--- a/server/tests/api/check-params/blocklist.ts
+++ b/server/tests/api/check-params/blocklist.ts
@@ -5,11 +5,11 @@ import 'mocha'
5import { 5import {
6 cleanupTests, 6 cleanupTests,
7 doubleFollow, 7 doubleFollow,
8 flushAndRunMultipleServers, 8 createMultipleServers,
9 makeDeleteRequest, 9 makeDeleteRequest,
10 makeGetRequest, 10 makeGetRequest,
11 makePostBodyRequest, 11 makePostBodyRequest,
12 ServerInfo, 12 PeerTubeServer,
13 setAccessTokensToServers 13 setAccessTokensToServers
14} from '../../../../shared/extra-utils' 14} from '../../../../shared/extra-utils'
15import { 15import {
@@ -20,14 +20,14 @@ import {
20import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' 20import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
21 21
22describe('Test blocklist API validators', function () { 22describe('Test blocklist API validators', function () {
23 let servers: ServerInfo[] 23 let servers: PeerTubeServer[]
24 let server: ServerInfo 24 let server: PeerTubeServer
25 let userAccessToken: string 25 let userAccessToken: string
26 26
27 before(async function () { 27 before(async function () {
28 this.timeout(60000) 28 this.timeout(60000)
29 29
30 servers = await flushAndRunMultipleServers(2) 30 servers = await createMultipleServers(2)
31 await setAccessTokensToServers(servers) 31 await setAccessTokensToServers(servers)
32 32
33 server = servers[0] 33 server = servers[0]
diff --git a/server/tests/api/check-params/bulk.ts b/server/tests/api/check-params/bulk.ts
index 69ff7dd96..a660c3d80 100644
--- a/server/tests/api/check-params/bulk.ts
+++ b/server/tests/api/check-params/bulk.ts
@@ -3,15 +3,15 @@
3import 'mocha' 3import 'mocha'
4import { 4import {
5 cleanupTests, 5 cleanupTests,
6 flushAndRunServer, 6 createSingleServer,
7 ServerInfo, 7 PeerTubeServer,
8 setAccessTokensToServers 8 setAccessTokensToServers
9} from '../../../../shared/extra-utils' 9} from '../../../../shared/extra-utils'
10import { makePostBodyRequest } from '../../../../shared/extra-utils/requests/requests' 10import { makePostBodyRequest } from '../../../../shared/extra-utils/requests/requests'
11import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' 11import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
12 12
13describe('Test bulk API validators', function () { 13describe('Test bulk API validators', function () {
14 let server: ServerInfo 14 let server: PeerTubeServer
15 let userAccessToken: string 15 let userAccessToken: string
16 16
17 // --------------------------------------------------------------- 17 // ---------------------------------------------------------------
@@ -19,7 +19,7 @@ describe('Test bulk API validators', function () {
19 before(async function () { 19 before(async function () {
20 this.timeout(120000) 20 this.timeout(120000)
21 21
22 server = await flushAndRunServer(1) 22 server = await createSingleServer(1)
23 await setAccessTokensToServers([ server ]) 23 await setAccessTokensToServers([ server ])
24 24
25 const user = { username: 'user1', password: 'password' } 25 const user = { username: 'user1', password: 'password' }
diff --git a/server/tests/api/check-params/config.ts b/server/tests/api/check-params/config.ts
index 6fd26864e..1756d58ee 100644
--- a/server/tests/api/check-params/config.ts
+++ b/server/tests/api/check-params/config.ts
@@ -5,18 +5,18 @@ import { omit } from 'lodash'
5import { HttpStatusCode } from '@shared/core-utils' 5import { HttpStatusCode } from '@shared/core-utils'
6import { 6import {
7 cleanupTests, 7 cleanupTests,
8 flushAndRunServer, 8 createSingleServer,
9 makeDeleteRequest, 9 makeDeleteRequest,
10 makeGetRequest, 10 makeGetRequest,
11 makePutBodyRequest, 11 makePutBodyRequest,
12 ServerInfo, 12 PeerTubeServer,
13 setAccessTokensToServers 13 setAccessTokensToServers
14} from '@shared/extra-utils' 14} from '@shared/extra-utils'
15import { CustomConfig } from '@shared/models' 15import { CustomConfig } from '@shared/models'
16 16
17describe('Test config API validators', function () { 17describe('Test config API validators', function () {
18 const path = '/api/v1/config/custom' 18 const path = '/api/v1/config/custom'
19 let server: ServerInfo 19 let server: PeerTubeServer
20 let userAccessToken: string 20 let userAccessToken: string
21 const updateParams: CustomConfig = { 21 const updateParams: CustomConfig = {
22 instance: { 22 instance: {
@@ -197,7 +197,7 @@ describe('Test config API validators', function () {
197 before(async function () { 197 before(async function () {
198 this.timeout(30000) 198 this.timeout(30000)
199 199
200 server = await flushAndRunServer(1) 200 server = await createSingleServer(1)
201 201
202 await setAccessTokensToServers([ server ]) 202 await setAccessTokensToServers([ server ])
203 203
diff --git a/server/tests/api/check-params/contact-form.ts b/server/tests/api/check-params/contact-form.ts
index d2541777f..8c2b2a84b 100644
--- a/server/tests/api/check-params/contact-form.ts
+++ b/server/tests/api/check-params/contact-form.ts
@@ -2,11 +2,11 @@
2 2
3import 'mocha' 3import 'mocha'
4import { HttpStatusCode } from '@shared/core-utils' 4import { HttpStatusCode } from '@shared/core-utils'
5import { cleanupTests, flushAndRunServer, killallServers, MockSmtpServer, reRunServer, ServerInfo } from '@shared/extra-utils' 5import { cleanupTests, createSingleServer, killallServers, MockSmtpServer, PeerTubeServer } from '@shared/extra-utils'
6import { ContactFormCommand } from '@shared/extra-utils/server' 6import { ContactFormCommand } from '@shared/extra-utils/server'
7 7
8describe('Test contact form API validators', function () { 8describe('Test contact form API validators', function () {
9 let server: ServerInfo 9 let server: PeerTubeServer
10 const emails: object[] = [] 10 const emails: object[] = []
11 const defaultBody = { 11 const defaultBody = {
12 fromName: 'super name', 12 fromName: 'super name',
@@ -25,7 +25,7 @@ describe('Test contact form API validators', function () {
25 emailPort = await MockSmtpServer.Instance.collectEmails(emails) 25 emailPort = await MockSmtpServer.Instance.collectEmails(emails)
26 26
27 // Email is disabled 27 // Email is disabled
28 server = await flushAndRunServer(1) 28 server = await createSingleServer(1)
29 command = server.contactForm 29 command = server.contactForm
30 }) 30 })
31 31
@@ -39,7 +39,7 @@ describe('Test contact form API validators', function () {
39 await killallServers([ server ]) 39 await killallServers([ server ])
40 40
41 // Contact form is disabled 41 // Contact form is disabled
42 await reRunServer(server, { smtp: { hostname: 'localhost', port: emailPort }, contact_form: { enabled: false } }) 42 await server.run({ smtp: { hostname: 'localhost', port: emailPort }, contact_form: { enabled: false } })
43 await command.send({ ...defaultBody, expectedStatus: HttpStatusCode.CONFLICT_409 }) 43 await command.send({ ...defaultBody, expectedStatus: HttpStatusCode.CONFLICT_409 })
44 }) 44 })
45 45
@@ -49,7 +49,7 @@ describe('Test contact form API validators', function () {
49 await killallServers([ server ]) 49 await killallServers([ server ])
50 50
51 // Email & contact form enabled 51 // Email & contact form enabled
52 await reRunServer(server, { smtp: { hostname: 'localhost', port: emailPort } }) 52 await server.run({ smtp: { hostname: 'localhost', port: emailPort } })
53 53
54 await command.send({ ...defaultBody, fromEmail: 'badEmail', expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) 54 await command.send({ ...defaultBody, fromEmail: 'badEmail', expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
55 await command.send({ ...defaultBody, fromEmail: 'badEmail@', expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) 55 await command.send({ ...defaultBody, fromEmail: 'badEmail@', expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
diff --git a/server/tests/api/check-params/custom-pages.ts b/server/tests/api/check-params/custom-pages.ts
index 3d84fb3e6..043505e32 100644
--- a/server/tests/api/check-params/custom-pages.ts
+++ b/server/tests/api/check-params/custom-pages.ts
@@ -4,8 +4,8 @@ import 'mocha'
4import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' 4import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
5import { 5import {
6 cleanupTests, 6 cleanupTests,
7 flushAndRunServer, 7 createSingleServer,
8 ServerInfo, 8 PeerTubeServer,
9 setAccessTokensToServers 9 setAccessTokensToServers
10} from '../../../../shared/extra-utils' 10} from '../../../../shared/extra-utils'
11import { makeGetRequest, makePutBodyRequest } from '../../../../shared/extra-utils/requests/requests' 11import { makeGetRequest, makePutBodyRequest } from '../../../../shared/extra-utils/requests/requests'
@@ -13,7 +13,7 @@ import { makeGetRequest, makePutBodyRequest } from '../../../../shared/extra-uti
13describe('Test custom pages validators', function () { 13describe('Test custom pages validators', function () {
14 const path = '/api/v1/custom-pages/homepage/instance' 14 const path = '/api/v1/custom-pages/homepage/instance'
15 15
16 let server: ServerInfo 16 let server: PeerTubeServer
17 let userAccessToken: string 17 let userAccessToken: string
18 18
19 // --------------------------------------------------------------- 19 // ---------------------------------------------------------------
@@ -21,7 +21,7 @@ describe('Test custom pages validators', function () {
21 before(async function () { 21 before(async function () {
22 this.timeout(120000) 22 this.timeout(120000)
23 23
24 server = await flushAndRunServer(1) 24 server = await createSingleServer(1)
25 await setAccessTokensToServers([ server ]) 25 await setAccessTokensToServers([ server ])
26 26
27 const user = { username: 'user1', password: 'password' } 27 const user = { username: 'user1', password: 'password' }
diff --git a/server/tests/api/check-params/debug.ts b/server/tests/api/check-params/debug.ts
index 609f9566e..9c13e9daf 100644
--- a/server/tests/api/check-params/debug.ts
+++ b/server/tests/api/check-params/debug.ts
@@ -4,8 +4,8 @@ import 'mocha'
4 4
5import { 5import {
6 cleanupTests, 6 cleanupTests,
7 flushAndRunServer, 7 createSingleServer,
8 ServerInfo, 8 PeerTubeServer,
9 setAccessTokensToServers 9 setAccessTokensToServers
10} from '../../../../shared/extra-utils' 10} from '../../../../shared/extra-utils'
11import { makeGetRequest } from '../../../../shared/extra-utils/requests/requests' 11import { makeGetRequest } from '../../../../shared/extra-utils/requests/requests'
@@ -13,7 +13,7 @@ import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-c
13 13
14describe('Test debug API validators', function () { 14describe('Test debug API validators', function () {
15 const path = '/api/v1/server/debug' 15 const path = '/api/v1/server/debug'
16 let server: ServerInfo 16 let server: PeerTubeServer
17 let userAccessToken = '' 17 let userAccessToken = ''
18 18
19 // --------------------------------------------------------------- 19 // ---------------------------------------------------------------
@@ -21,7 +21,7 @@ describe('Test debug API validators', function () {
21 before(async function () { 21 before(async function () {
22 this.timeout(120000) 22 this.timeout(120000)
23 23
24 server = await flushAndRunServer(1) 24 server = await createSingleServer(1)
25 25
26 await setAccessTokensToServers([ server ]) 26 await setAccessTokensToServers([ server ])
27 27
diff --git a/server/tests/api/check-params/follows.ts b/server/tests/api/check-params/follows.ts
index fae3712ce..0fd2b4925 100644
--- a/server/tests/api/check-params/follows.ts
+++ b/server/tests/api/check-params/follows.ts
@@ -4,10 +4,10 @@ import 'mocha'
4 4
5import { 5import {
6 cleanupTests, 6 cleanupTests,
7 flushAndRunServer, 7 createSingleServer,
8 makeDeleteRequest, makeGetRequest, 8 makeDeleteRequest, makeGetRequest,
9 makePostBodyRequest, 9 makePostBodyRequest,
10 ServerInfo, 10 PeerTubeServer,
11 setAccessTokensToServers 11 setAccessTokensToServers
12} from '../../../../shared/extra-utils' 12} from '../../../../shared/extra-utils'
13import { 13import {
@@ -18,14 +18,14 @@ import {
18import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' 18import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
19 19
20describe('Test server follows API validators', function () { 20describe('Test server follows API validators', function () {
21 let server: ServerInfo 21 let server: PeerTubeServer
22 22
23 // --------------------------------------------------------------- 23 // ---------------------------------------------------------------
24 24
25 before(async function () { 25 before(async function () {
26 this.timeout(30000) 26 this.timeout(30000)
27 27
28 server = await flushAndRunServer(1) 28 server = await createSingleServer(1)
29 29
30 await setAccessTokensToServers([ server ]) 30 await setAccessTokensToServers([ server ])
31 }) 31 })
diff --git a/server/tests/api/check-params/jobs.ts b/server/tests/api/check-params/jobs.ts
index 3786e8612..a370ec2d3 100644
--- a/server/tests/api/check-params/jobs.ts
+++ b/server/tests/api/check-params/jobs.ts
@@ -4,8 +4,8 @@ import 'mocha'
4 4
5import { 5import {
6 cleanupTests, 6 cleanupTests,
7 flushAndRunServer, 7 createSingleServer,
8 ServerInfo, 8 PeerTubeServer,
9 setAccessTokensToServers 9 setAccessTokensToServers
10} from '../../../../shared/extra-utils' 10} from '../../../../shared/extra-utils'
11import { 11import {
@@ -18,7 +18,7 @@ import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-c
18 18
19describe('Test jobs API validators', function () { 19describe('Test jobs API validators', function () {
20 const path = '/api/v1/jobs/failed' 20 const path = '/api/v1/jobs/failed'
21 let server: ServerInfo 21 let server: PeerTubeServer
22 let userAccessToken = '' 22 let userAccessToken = ''
23 23
24 // --------------------------------------------------------------- 24 // ---------------------------------------------------------------
@@ -26,7 +26,7 @@ describe('Test jobs API validators', function () {
26 before(async function () { 26 before(async function () {
27 this.timeout(120000) 27 this.timeout(120000)
28 28
29 server = await flushAndRunServer(1) 29 server = await createSingleServer(1)
30 30
31 await setAccessTokensToServers([ server ]) 31 await setAccessTokensToServers([ server ])
32 32
diff --git a/server/tests/api/check-params/live.ts b/server/tests/api/check-params/live.ts
index 20f27dd1d..eb5cdd1d8 100644
--- a/server/tests/api/check-params/live.ts
+++ b/server/tests/api/check-params/live.ts
@@ -6,12 +6,12 @@ import { HttpStatusCode } from '@shared/core-utils'
6import { 6import {
7 buildAbsoluteFixturePath, 7 buildAbsoluteFixturePath,
8 cleanupTests, 8 cleanupTests,
9 flushAndRunServer, 9 createSingleServer,
10 LiveCommand, 10 LiveCommand,
11 makePostBodyRequest, 11 makePostBodyRequest,
12 makeUploadRequest, 12 makeUploadRequest,
13 sendRTMPStream, 13 sendRTMPStream,
14 ServerInfo, 14 PeerTubeServer,
15 setAccessTokensToServers, 15 setAccessTokensToServers,
16 stopFfmpeg 16 stopFfmpeg
17} from '@shared/extra-utils' 17} from '@shared/extra-utils'
@@ -19,7 +19,7 @@ import { VideoCreateResult, VideoPrivacy } from '@shared/models'
19 19
20describe('Test video lives API validator', function () { 20describe('Test video lives API validator', function () {
21 const path = '/api/v1/videos/live' 21 const path = '/api/v1/videos/live'
22 let server: ServerInfo 22 let server: PeerTubeServer
23 let userAccessToken = '' 23 let userAccessToken = ''
24 let channelId: number 24 let channelId: number
25 let video: VideoCreateResult 25 let video: VideoCreateResult
@@ -31,7 +31,7 @@ describe('Test video lives API validator', function () {
31 before(async function () { 31 before(async function () {
32 this.timeout(30000) 32 this.timeout(30000)
33 33
34 server = await flushAndRunServer(1) 34 server = await createSingleServer(1)
35 35
36 await setAccessTokensToServers([ server ]) 36 await setAccessTokensToServers([ server ])
37 37
diff --git a/server/tests/api/check-params/logs.ts b/server/tests/api/check-params/logs.ts
index cf8f77959..2eb074007 100644
--- a/server/tests/api/check-params/logs.ts
+++ b/server/tests/api/check-params/logs.ts
@@ -4,8 +4,8 @@ import 'mocha'
4 4
5import { 5import {
6 cleanupTests, 6 cleanupTests,
7 flushAndRunServer, 7 createSingleServer,
8 ServerInfo, 8 PeerTubeServer,
9 setAccessTokensToServers 9 setAccessTokensToServers
10} from '../../../../shared/extra-utils' 10} from '../../../../shared/extra-utils'
11import { makeGetRequest } from '../../../../shared/extra-utils/requests/requests' 11import { makeGetRequest } from '../../../../shared/extra-utils/requests/requests'
@@ -13,7 +13,7 @@ import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-c
13 13
14describe('Test logs API validators', function () { 14describe('Test logs API validators', function () {
15 const path = '/api/v1/server/logs' 15 const path = '/api/v1/server/logs'
16 let server: ServerInfo 16 let server: PeerTubeServer
17 let userAccessToken = '' 17 let userAccessToken = ''
18 18
19 // --------------------------------------------------------------- 19 // ---------------------------------------------------------------
@@ -21,7 +21,7 @@ describe('Test logs API validators', function () {
21 before(async function () { 21 before(async function () {
22 this.timeout(120000) 22 this.timeout(120000)
23 23
24 server = await flushAndRunServer(1) 24 server = await createSingleServer(1)
25 25
26 await setAccessTokensToServers([ server ]) 26 await setAccessTokensToServers([ server ])
27 27
diff --git a/server/tests/api/check-params/plugins.ts b/server/tests/api/check-params/plugins.ts
index d4b72c0f4..2b471ee7d 100644
--- a/server/tests/api/check-params/plugins.ts
+++ b/server/tests/api/check-params/plugins.ts
@@ -7,17 +7,17 @@ import {
7 checkBadSortPagination, 7 checkBadSortPagination,
8 checkBadStartPagination, 8 checkBadStartPagination,
9 cleanupTests, 9 cleanupTests,
10 flushAndRunServer, 10 createSingleServer,
11 makeGetRequest, 11 makeGetRequest,
12 makePostBodyRequest, 12 makePostBodyRequest,
13 makePutBodyRequest, 13 makePutBodyRequest,
14 ServerInfo, 14 PeerTubeServer,
15 setAccessTokensToServers 15 setAccessTokensToServers
16} from '@shared/extra-utils' 16} from '@shared/extra-utils'
17import { PeerTubePlugin, PluginType } from '@shared/models' 17import { PeerTubePlugin, PluginType } from '@shared/models'
18 18
19describe('Test server plugins API validators', function () { 19describe('Test server plugins API validators', function () {
20 let server: ServerInfo 20 let server: PeerTubeServer
21 let userAccessToken = null 21 let userAccessToken = null
22 22
23 const npmPlugin = 'peertube-plugin-hello-world' 23 const npmPlugin = 'peertube-plugin-hello-world'
@@ -33,7 +33,7 @@ describe('Test server plugins API validators', function () {
33 before(async function () { 33 before(async function () {
34 this.timeout(30000) 34 this.timeout(30000)
35 35
36 server = await flushAndRunServer(1) 36 server = await createSingleServer(1)
37 37
38 await setAccessTokensToServers([ server ]) 38 await setAccessTokensToServers([ server ])
39 39
diff --git a/server/tests/api/check-params/redundancy.ts b/server/tests/api/check-params/redundancy.ts
index fca92fde4..18b98a0f9 100644
--- a/server/tests/api/check-params/redundancy.ts
+++ b/server/tests/api/check-params/redundancy.ts
@@ -9,18 +9,18 @@ import {
9 checkBadStartPagination, 9 checkBadStartPagination,
10 cleanupTests, 10 cleanupTests,
11 doubleFollow, 11 doubleFollow,
12 flushAndRunMultipleServers, 12 createMultipleServers,
13 makeDeleteRequest, 13 makeDeleteRequest,
14 makeGetRequest, 14 makeGetRequest,
15 makePostBodyRequest, 15 makePostBodyRequest,
16 makePutBodyRequest, 16 makePutBodyRequest,
17 ServerInfo, 17 PeerTubeServer,
18 setAccessTokensToServers, 18 setAccessTokensToServers,
19 waitJobs 19 waitJobs
20} from '../../../../shared/extra-utils' 20} from '../../../../shared/extra-utils'
21 21
22describe('Test server redundancy API validators', function () { 22describe('Test server redundancy API validators', function () {
23 let servers: ServerInfo[] 23 let servers: PeerTubeServer[]
24 let userAccessToken = null 24 let userAccessToken = null
25 let videoIdLocal: number 25 let videoIdLocal: number
26 let videoRemote: VideoCreateResult 26 let videoRemote: VideoCreateResult
@@ -30,7 +30,7 @@ describe('Test server redundancy API validators', function () {
30 before(async function () { 30 before(async function () {
31 this.timeout(80000) 31 this.timeout(80000)
32 32
33 servers = await flushAndRunMultipleServers(2) 33 servers = await createMultipleServers(2)
34 34
35 await setAccessTokensToServers(servers) 35 await setAccessTokensToServers(servers)
36 await doubleFollow(servers[0], servers[1]) 36 await doubleFollow(servers[0], servers[1])
diff --git a/server/tests/api/check-params/search.ts b/server/tests/api/check-params/search.ts
index 1acfa0922..43cd81af9 100644
--- a/server/tests/api/check-params/search.ts
+++ b/server/tests/api/check-params/search.ts
@@ -7,13 +7,13 @@ import {
7 checkBadSortPagination, 7 checkBadSortPagination,
8 checkBadStartPagination, 8 checkBadStartPagination,
9 cleanupTests, 9 cleanupTests,
10 flushAndRunServer, 10 createSingleServer,
11 makeGetRequest, 11 makeGetRequest,
12 ServerInfo, 12 PeerTubeServer,
13 setAccessTokensToServers 13 setAccessTokensToServers
14} from '@shared/extra-utils' 14} from '@shared/extra-utils'
15 15
16function updateSearchIndex (server: ServerInfo, enabled: boolean, disableLocalSearch = false) { 16function updateSearchIndex (server: PeerTubeServer, enabled: boolean, disableLocalSearch = false) {
17 return server.config.updateCustomSubConfig({ 17 return server.config.updateCustomSubConfig({
18 newConfig: { 18 newConfig: {
19 search: { 19 search: {
@@ -27,14 +27,14 @@ function updateSearchIndex (server: ServerInfo, enabled: boolean, disableLocalSe
27} 27}
28 28
29describe('Test videos API validator', function () { 29describe('Test videos API validator', function () {
30 let server: ServerInfo 30 let server: PeerTubeServer
31 31
32 // --------------------------------------------------------------- 32 // ---------------------------------------------------------------
33 33
34 before(async function () { 34 before(async function () {
35 this.timeout(30000) 35 this.timeout(30000)
36 36
37 server = await flushAndRunServer(1) 37 server = await createSingleServer(1)
38 await setAccessTokensToServers([ server ]) 38 await setAccessTokensToServers([ server ])
39 }) 39 })
40 40
diff --git a/server/tests/api/check-params/services.ts b/server/tests/api/check-params/services.ts
index 83435c24a..c623240b7 100644
--- a/server/tests/api/check-params/services.ts
+++ b/server/tests/api/check-params/services.ts
@@ -4,16 +4,16 @@ import 'mocha'
4import { HttpStatusCode } from '@shared/core-utils' 4import { HttpStatusCode } from '@shared/core-utils'
5import { 5import {
6 cleanupTests, 6 cleanupTests,
7 flushAndRunServer, 7 createSingleServer,
8 makeGetRequest, 8 makeGetRequest,
9 ServerInfo, 9 PeerTubeServer,
10 setAccessTokensToServers, 10 setAccessTokensToServers,
11 setDefaultVideoChannel 11 setDefaultVideoChannel
12} from '@shared/extra-utils' 12} from '@shared/extra-utils'
13import { VideoPlaylistPrivacy } from '@shared/models' 13import { VideoPlaylistPrivacy } from '@shared/models'
14 14
15describe('Test services API validators', function () { 15describe('Test services API validators', function () {
16 let server: ServerInfo 16 let server: PeerTubeServer
17 let playlistUUID: string 17 let playlistUUID: string
18 18
19 // --------------------------------------------------------------- 19 // ---------------------------------------------------------------
@@ -21,7 +21,7 @@ describe('Test services API validators', function () {
21 before(async function () { 21 before(async function () {
22 this.timeout(60000) 22 this.timeout(60000)
23 23
24 server = await flushAndRunServer(1) 24 server = await createSingleServer(1)
25 await setAccessTokensToServers([ server ]) 25 await setAccessTokensToServers([ server ])
26 await setDefaultVideoChannel([ server ]) 26 await setDefaultVideoChannel([ server ])
27 27
@@ -120,7 +120,7 @@ describe('Test services API validators', function () {
120 }) 120 })
121}) 121})
122 122
123function checkParamEmbed (server: ServerInfo, embedUrl: string, statusCodeExpected = HttpStatusCode.BAD_REQUEST_400, query = {}) { 123function checkParamEmbed (server: PeerTubeServer, embedUrl: string, statusCodeExpected = HttpStatusCode.BAD_REQUEST_400, query = {}) {
124 const path = '/services/oembed' 124 const path = '/services/oembed'
125 125
126 return makeGetRequest({ 126 return makeGetRequest({
diff --git a/server/tests/api/check-params/upload-quota.ts b/server/tests/api/check-params/upload-quota.ts
index 4ca544790..2c73e6a19 100644
--- a/server/tests/api/check-params/upload-quota.ts
+++ b/server/tests/api/check-params/upload-quota.ts
@@ -5,9 +5,9 @@ import { expect } from 'chai'
5import { HttpStatusCode, randomInt } from '@shared/core-utils' 5import { HttpStatusCode, randomInt } from '@shared/core-utils'
6import { 6import {
7 cleanupTests, 7 cleanupTests,
8 flushAndRunServer, 8 createSingleServer,
9 ImportsCommand, 9 ImportsCommand,
10 ServerInfo, 10 PeerTubeServer,
11 setAccessTokensToServers, 11 setAccessTokensToServers,
12 setDefaultVideoChannel, 12 setDefaultVideoChannel,
13 VideosCommand, 13 VideosCommand,
@@ -16,7 +16,7 @@ import {
16import { VideoImportState, VideoPrivacy } from '@shared/models' 16import { VideoImportState, VideoPrivacy } from '@shared/models'
17 17
18describe('Test upload quota', function () { 18describe('Test upload quota', function () {
19 let server: ServerInfo 19 let server: PeerTubeServer
20 let rootId: number 20 let rootId: number
21 let command: VideosCommand 21 let command: VideosCommand
22 22
@@ -25,7 +25,7 @@ describe('Test upload quota', function () {
25 before(async function () { 25 before(async function () {
26 this.timeout(30000) 26 this.timeout(30000)
27 27
28 server = await flushAndRunServer(1) 28 server = await createSingleServer(1)
29 await setAccessTokensToServers([ server ]) 29 await setAccessTokensToServers([ server ])
30 await setDefaultVideoChannel([ server ]) 30 await setDefaultVideoChannel([ server ])
31 31
diff --git a/server/tests/api/check-params/user-notifications.ts b/server/tests/api/check-params/user-notifications.ts
index 913eca366..038c444b3 100644
--- a/server/tests/api/check-params/user-notifications.ts
+++ b/server/tests/api/check-params/user-notifications.ts
@@ -8,25 +8,25 @@ import {
8 checkBadSortPagination, 8 checkBadSortPagination,
9 checkBadStartPagination, 9 checkBadStartPagination,
10 cleanupTests, 10 cleanupTests,
11 flushAndRunServer, 11 createSingleServer,
12 makeGetRequest, 12 makeGetRequest,
13 makePostBodyRequest, 13 makePostBodyRequest,
14 makePutBodyRequest, 14 makePutBodyRequest,
15 ServerInfo, 15 PeerTubeServer,
16 setAccessTokensToServers, 16 setAccessTokensToServers,
17 wait 17 wait
18} from '@shared/extra-utils' 18} from '@shared/extra-utils'
19import { UserNotificationSetting, UserNotificationSettingValue } from '@shared/models' 19import { UserNotificationSetting, UserNotificationSettingValue } from '@shared/models'
20 20
21describe('Test user notifications API validators', function () { 21describe('Test user notifications API validators', function () {
22 let server: ServerInfo 22 let server: PeerTubeServer
23 23
24 // --------------------------------------------------------------- 24 // ---------------------------------------------------------------
25 25
26 before(async function () { 26 before(async function () {
27 this.timeout(30000) 27 this.timeout(30000)
28 28
29 server = await flushAndRunServer(1) 29 server = await createSingleServer(1)
30 30
31 await setAccessTokensToServers([ server ]) 31 await setAccessTokensToServers([ server ])
32 }) 32 })
diff --git a/server/tests/api/check-params/user-subscriptions.ts b/server/tests/api/check-params/user-subscriptions.ts
index 885ad68e4..22cf130c2 100644
--- a/server/tests/api/check-params/user-subscriptions.ts
+++ b/server/tests/api/check-params/user-subscriptions.ts
@@ -4,11 +4,11 @@ import 'mocha'
4 4
5import { 5import {
6 cleanupTests, 6 cleanupTests,
7 flushAndRunServer, 7 createSingleServer,
8 makeDeleteRequest, 8 makeDeleteRequest,
9 makeGetRequest, 9 makeGetRequest,
10 makePostBodyRequest, 10 makePostBodyRequest,
11 ServerInfo, 11 PeerTubeServer,
12 setAccessTokensToServers 12 setAccessTokensToServers
13} from '../../../../shared/extra-utils' 13} from '../../../../shared/extra-utils'
14 14
@@ -22,7 +22,7 @@ import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-c
22 22
23describe('Test user subscriptions API validators', function () { 23describe('Test user subscriptions API validators', function () {
24 const path = '/api/v1/users/me/subscriptions' 24 const path = '/api/v1/users/me/subscriptions'
25 let server: ServerInfo 25 let server: PeerTubeServer
26 let userAccessToken = '' 26 let userAccessToken = ''
27 27
28 // --------------------------------------------------------------- 28 // ---------------------------------------------------------------
@@ -30,7 +30,7 @@ describe('Test user subscriptions API validators', function () {
30 before(async function () { 30 before(async function () {
31 this.timeout(30000) 31 this.timeout(30000)
32 32
33 server = await flushAndRunServer(1) 33 server = await createSingleServer(1)
34 34
35 await setAccessTokensToServers([ server ]) 35 await setAccessTokensToServers([ server ])
36 36
diff --git a/server/tests/api/check-params/users.ts b/server/tests/api/check-params/users.ts
index bce3f0774..c2c98f429 100644
--- a/server/tests/api/check-params/users.ts
+++ b/server/tests/api/check-params/users.ts
@@ -9,15 +9,14 @@ import {
9 checkBadSortPagination, 9 checkBadSortPagination,
10 checkBadStartPagination, 10 checkBadStartPagination,
11 cleanupTests, 11 cleanupTests,
12 flushAndRunServer, 12 createSingleServer,
13 killallServers, 13 killallServers,
14 makeGetRequest, 14 makeGetRequest,
15 makePostBodyRequest, 15 makePostBodyRequest,
16 makePutBodyRequest, 16 makePutBodyRequest,
17 makeUploadRequest, 17 makeUploadRequest,
18 MockSmtpServer, 18 MockSmtpServer,
19 reRunServer, 19 PeerTubeServer,
20 ServerInfo,
21 setAccessTokensToServers, 20 setAccessTokensToServers,
22 UsersCommand 21 UsersCommand
23} from '@shared/extra-utils' 22} from '@shared/extra-utils'
@@ -29,8 +28,8 @@ describe('Test users API validators', function () {
29 let rootId: number 28 let rootId: number
30 let moderatorId: number 29 let moderatorId: number
31 let video: VideoCreateResult 30 let video: VideoCreateResult
32 let server: ServerInfo 31 let server: PeerTubeServer
33 let serverWithRegistrationDisabled: ServerInfo 32 let serverWithRegistrationDisabled: PeerTubeServer
34 let userToken = '' 33 let userToken = ''
35 let moderatorToken = '' 34 let moderatorToken = ''
36 let emailPort: number 35 let emailPort: number
@@ -48,8 +47,8 @@ describe('Test users API validators', function () {
48 47
49 { 48 {
50 const res = await Promise.all([ 49 const res = await Promise.all([
51 flushAndRunServer(1, overrideConfig), 50 createSingleServer(1, overrideConfig),
52 flushAndRunServer(2) 51 createSingleServer(2)
53 ]) 52 ])
54 53
55 server = res[0] 54 server = res[0]
@@ -196,7 +195,7 @@ describe('Test users API validators', function () {
196 port: emailPort 195 port: emailPort
197 } 196 }
198 } 197 }
199 await reRunServer(server, config) 198 await server.run(config)
200 199
201 const fields = { 200 const fields = {
202 ...baseCorrectParams, 201 ...baseCorrectParams,
diff --git a/server/tests/api/check-params/video-blacklist.ts b/server/tests/api/check-params/video-blacklist.ts
index 51609b982..b5d0e0778 100644
--- a/server/tests/api/check-params/video-blacklist.ts
+++ b/server/tests/api/check-params/video-blacklist.ts
@@ -10,17 +10,17 @@ import {
10 checkBadStartPagination, 10 checkBadStartPagination,
11 cleanupTests, 11 cleanupTests,
12 doubleFollow, 12 doubleFollow,
13 flushAndRunMultipleServers, 13 createMultipleServers,
14 makePostBodyRequest, 14 makePostBodyRequest,
15 makePutBodyRequest, 15 makePutBodyRequest,
16 ServerInfo, 16 PeerTubeServer,
17 setAccessTokensToServers, 17 setAccessTokensToServers,
18 waitJobs 18 waitJobs
19} from '@shared/extra-utils' 19} from '@shared/extra-utils'
20import { VideoBlacklistType } from '@shared/models' 20import { VideoBlacklistType } from '@shared/models'
21 21
22describe('Test video blacklist API validators', function () { 22describe('Test video blacklist API validators', function () {
23 let servers: ServerInfo[] 23 let servers: PeerTubeServer[]
24 let notBlacklistedVideoId: string 24 let notBlacklistedVideoId: string
25 let remoteVideoUUID: string 25 let remoteVideoUUID: string
26 let userAccessToken1 = '' 26 let userAccessToken1 = ''
@@ -32,7 +32,7 @@ describe('Test video blacklist API validators', function () {
32 before(async function () { 32 before(async function () {
33 this.timeout(120000) 33 this.timeout(120000)
34 34
35 servers = await flushAndRunMultipleServers(2) 35 servers = await createMultipleServers(2)
36 36
37 await setAccessTokensToServers(servers) 37 await setAccessTokensToServers(servers)
38 await doubleFollow(servers[0], servers[1]) 38 await doubleFollow(servers[0], servers[1])
diff --git a/server/tests/api/check-params/video-captions.ts b/server/tests/api/check-params/video-captions.ts
index 913f894b9..26aab79e7 100644
--- a/server/tests/api/check-params/video-captions.ts
+++ b/server/tests/api/check-params/video-captions.ts
@@ -5,11 +5,11 @@ import { HttpStatusCode } from '@shared/core-utils'
5import { 5import {
6 buildAbsoluteFixturePath, 6 buildAbsoluteFixturePath,
7 cleanupTests, 7 cleanupTests,
8 flushAndRunServer, 8 createSingleServer,
9 makeDeleteRequest, 9 makeDeleteRequest,
10 makeGetRequest, 10 makeGetRequest,
11 makeUploadRequest, 11 makeUploadRequest,
12 ServerInfo, 12 PeerTubeServer,
13 setAccessTokensToServers 13 setAccessTokensToServers
14} from '@shared/extra-utils' 14} from '@shared/extra-utils'
15import { VideoCreateResult } from '@shared/models' 15import { VideoCreateResult } from '@shared/models'
@@ -17,7 +17,7 @@ import { VideoCreateResult } from '@shared/models'
17describe('Test video captions API validator', function () { 17describe('Test video captions API validator', function () {
18 const path = '/api/v1/videos/' 18 const path = '/api/v1/videos/'
19 19
20 let server: ServerInfo 20 let server: PeerTubeServer
21 let userAccessToken: string 21 let userAccessToken: string
22 let video: VideoCreateResult 22 let video: VideoCreateResult
23 23
@@ -26,7 +26,7 @@ describe('Test video captions API validator', function () {
26 before(async function () { 26 before(async function () {
27 this.timeout(30000) 27 this.timeout(30000)
28 28
29 server = await flushAndRunServer(1) 29 server = await createSingleServer(1)
30 30
31 await setAccessTokensToServers([ server ]) 31 await setAccessTokensToServers([ server ])
32 32
diff --git a/server/tests/api/check-params/video-channels.ts b/server/tests/api/check-params/video-channels.ts
index 8e6e32f20..62b8fa4f6 100644
--- a/server/tests/api/check-params/video-channels.ts
+++ b/server/tests/api/check-params/video-channels.ts
@@ -11,12 +11,12 @@ import {
11 checkBadSortPagination, 11 checkBadSortPagination,
12 checkBadStartPagination, 12 checkBadStartPagination,
13 cleanupTests, 13 cleanupTests,
14 flushAndRunServer, 14 createSingleServer,
15 makeGetRequest, 15 makeGetRequest,
16 makePostBodyRequest, 16 makePostBodyRequest,
17 makePutBodyRequest, 17 makePutBodyRequest,
18 makeUploadRequest, 18 makeUploadRequest,
19 ServerInfo, 19 PeerTubeServer,
20 setAccessTokensToServers 20 setAccessTokensToServers
21} from '@shared/extra-utils' 21} from '@shared/extra-utils'
22import { VideoChannelUpdate } from '@shared/models' 22import { VideoChannelUpdate } from '@shared/models'
@@ -25,7 +25,7 @@ const expect = chai.expect
25 25
26describe('Test video channels API validator', function () { 26describe('Test video channels API validator', function () {
27 const videoChannelPath = '/api/v1/video-channels' 27 const videoChannelPath = '/api/v1/video-channels'
28 let server: ServerInfo 28 let server: PeerTubeServer
29 let accessTokenUser: string 29 let accessTokenUser: string
30 let command: ChannelsCommand 30 let command: ChannelsCommand
31 31
@@ -34,7 +34,7 @@ describe('Test video channels API validator', function () {
34 before(async function () { 34 before(async function () {
35 this.timeout(30000) 35 this.timeout(30000)
36 36
37 server = await flushAndRunServer(1) 37 server = await createSingleServer(1)
38 38
39 await setAccessTokensToServers([ server ]) 39 await setAccessTokensToServers([ server ])
40 40
diff --git a/server/tests/api/check-params/video-comments.ts b/server/tests/api/check-params/video-comments.ts
index 44af9d7e3..ea5340b40 100644
--- a/server/tests/api/check-params/video-comments.ts
+++ b/server/tests/api/check-params/video-comments.ts
@@ -8,11 +8,11 @@ import {
8 checkBadSortPagination, 8 checkBadSortPagination,
9 checkBadStartPagination, 9 checkBadStartPagination,
10 cleanupTests, 10 cleanupTests,
11 flushAndRunServer, 11 createSingleServer,
12 makeDeleteRequest, 12 makeDeleteRequest,
13 makeGetRequest, 13 makeGetRequest,
14 makePostBodyRequest, 14 makePostBodyRequest,
15 ServerInfo, 15 PeerTubeServer,
16 setAccessTokensToServers 16 setAccessTokensToServers
17} from '@shared/extra-utils' 17} from '@shared/extra-utils'
18import { VideoCreateResult } from '@shared/models' 18import { VideoCreateResult } from '@shared/models'
@@ -22,7 +22,7 @@ const expect = chai.expect
22describe('Test video comments API validator', function () { 22describe('Test video comments API validator', function () {
23 let pathThread: string 23 let pathThread: string
24 let pathComment: string 24 let pathComment: string
25 let server: ServerInfo 25 let server: PeerTubeServer
26 let video: VideoCreateResult 26 let video: VideoCreateResult
27 let userAccessToken: string 27 let userAccessToken: string
28 let userAccessToken2: string 28 let userAccessToken2: string
@@ -33,7 +33,7 @@ describe('Test video comments API validator', function () {
33 before(async function () { 33 before(async function () {
34 this.timeout(30000) 34 this.timeout(30000)
35 35
36 server = await flushAndRunServer(1) 36 server = await createSingleServer(1)
37 37
38 await setAccessTokensToServers([ server ]) 38 await setAccessTokensToServers([ server ])
39 39
diff --git a/server/tests/api/check-params/video-imports.ts b/server/tests/api/check-params/video-imports.ts
index 1a6b6075f..627f0c7ad 100644
--- a/server/tests/api/check-params/video-imports.ts
+++ b/server/tests/api/check-params/video-imports.ts
@@ -9,19 +9,19 @@ import {
9 checkBadSortPagination, 9 checkBadSortPagination,
10 checkBadStartPagination, 10 checkBadStartPagination,
11 cleanupTests, 11 cleanupTests,
12 flushAndRunServer, 12 createSingleServer,
13 ImportsCommand, 13 ImportsCommand,
14 makeGetRequest, 14 makeGetRequest,
15 makePostBodyRequest, 15 makePostBodyRequest,
16 makeUploadRequest, 16 makeUploadRequest,
17 ServerInfo, 17 PeerTubeServer,
18 setAccessTokensToServers 18 setAccessTokensToServers
19} from '@shared/extra-utils' 19} from '@shared/extra-utils'
20import { VideoPrivacy } from '@shared/models' 20import { VideoPrivacy } from '@shared/models'
21 21
22describe('Test video imports API validator', function () { 22describe('Test video imports API validator', function () {
23 const path = '/api/v1/videos/imports' 23 const path = '/api/v1/videos/imports'
24 let server: ServerInfo 24 let server: PeerTubeServer
25 let userAccessToken = '' 25 let userAccessToken = ''
26 let channelId: number 26 let channelId: number
27 27
@@ -30,7 +30,7 @@ describe('Test video imports API validator', function () {
30 before(async function () { 30 before(async function () {
31 this.timeout(30000) 31 this.timeout(30000)
32 32
33 server = await flushAndRunServer(1) 33 server = await createSingleServer(1)
34 34
35 await setAccessTokensToServers([ server ]) 35 await setAccessTokensToServers([ server ])
36 36
diff --git a/server/tests/api/check-params/video-playlists.ts b/server/tests/api/check-params/video-playlists.ts
index e0e42ebb0..9d054b176 100644
--- a/server/tests/api/check-params/video-playlists.ts
+++ b/server/tests/api/check-params/video-playlists.ts
@@ -7,10 +7,10 @@ import {
7 checkBadSortPagination, 7 checkBadSortPagination,
8 checkBadStartPagination, 8 checkBadStartPagination,
9 cleanupTests, 9 cleanupTests,
10 flushAndRunServer, 10 createSingleServer,
11 makeGetRequest, 11 makeGetRequest,
12 PlaylistsCommand, 12 PlaylistsCommand,
13 ServerInfo, 13 PeerTubeServer,
14 setAccessTokensToServers, 14 setAccessTokensToServers,
15 setDefaultVideoChannel 15 setDefaultVideoChannel
16} from '@shared/extra-utils' 16} from '@shared/extra-utils'
@@ -25,7 +25,7 @@ import {
25} from '@shared/models' 25} from '@shared/models'
26 26
27describe('Test video playlists API validator', function () { 27describe('Test video playlists API validator', function () {
28 let server: ServerInfo 28 let server: PeerTubeServer
29 let userAccessToken: string 29 let userAccessToken: string
30 30
31 let playlist: VideoPlaylistCreateResult 31 let playlist: VideoPlaylistCreateResult
@@ -42,7 +42,7 @@ describe('Test video playlists API validator', function () {
42 before(async function () { 42 before(async function () {
43 this.timeout(30000) 43 this.timeout(30000)
44 44
45 server = await flushAndRunServer(1) 45 server = await createSingleServer(1)
46 46
47 await setAccessTokensToServers([ server ]) 47 await setAccessTokensToServers([ server ])
48 await setDefaultVideoChannel([ server ]) 48 await setDefaultVideoChannel([ server ])
diff --git a/server/tests/api/check-params/videos-filter.ts b/server/tests/api/check-params/videos-filter.ts
index cbfdef1db..e4e799cc7 100644
--- a/server/tests/api/check-params/videos-filter.ts
+++ b/server/tests/api/check-params/videos-filter.ts
@@ -3,16 +3,16 @@
3import 'mocha' 3import 'mocha'
4import { 4import {
5 cleanupTests, 5 cleanupTests,
6 flushAndRunServer, 6 createSingleServer,
7 makeGetRequest, 7 makeGetRequest,
8 ServerInfo, 8 PeerTubeServer,
9 setAccessTokensToServers, 9 setAccessTokensToServers,
10 setDefaultVideoChannel 10 setDefaultVideoChannel
11} from '../../../../shared/extra-utils' 11} from '../../../../shared/extra-utils'
12import { UserRole } from '../../../../shared/models/users' 12import { UserRole } from '../../../../shared/models/users'
13import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' 13import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
14 14
15async function testEndpoints (server: ServerInfo, token: string, filter: string, statusCodeExpected: HttpStatusCode) { 15async function testEndpoints (server: PeerTubeServer, token: string, filter: string, statusCodeExpected: HttpStatusCode) {
16 const paths = [ 16 const paths = [
17 '/api/v1/video-channels/root_channel/videos', 17 '/api/v1/video-channels/root_channel/videos',
18 '/api/v1/accounts/root/videos', 18 '/api/v1/accounts/root/videos',
@@ -34,7 +34,7 @@ async function testEndpoints (server: ServerInfo, token: string, filter: string,
34} 34}
35 35
36describe('Test video filters validators', function () { 36describe('Test video filters validators', function () {
37 let server: ServerInfo 37 let server: PeerTubeServer
38 let userAccessToken: string 38 let userAccessToken: string
39 let moderatorAccessToken: string 39 let moderatorAccessToken: string
40 40
@@ -43,7 +43,7 @@ describe('Test video filters validators', function () {
43 before(async function () { 43 before(async function () {
44 this.timeout(30000) 44 this.timeout(30000)
45 45
46 server = await flushAndRunServer(1) 46 server = await createSingleServer(1)
47 47
48 await setAccessTokensToServers([ server ]) 48 await setAccessTokensToServers([ server ])
49 await setDefaultVideoChannel([ server ]) 49 await setDefaultVideoChannel([ server ])
diff --git a/server/tests/api/check-params/videos-history.ts b/server/tests/api/check-params/videos-history.ts
index 549c9fa1f..3c1f479e4 100644
--- a/server/tests/api/check-params/videos-history.ts
+++ b/server/tests/api/check-params/videos-history.ts
@@ -6,11 +6,11 @@ import {
6 checkBadCountPagination, 6 checkBadCountPagination,
7 checkBadStartPagination, 7 checkBadStartPagination,
8 cleanupTests, 8 cleanupTests,
9 flushAndRunServer, 9 createSingleServer,
10 makeGetRequest, 10 makeGetRequest,
11 makePostBodyRequest, 11 makePostBodyRequest,
12 makePutBodyRequest, 12 makePutBodyRequest,
13 ServerInfo, 13 PeerTubeServer,
14 setAccessTokensToServers 14 setAccessTokensToServers
15} from '@shared/extra-utils' 15} from '@shared/extra-utils'
16 16
@@ -18,14 +18,14 @@ describe('Test videos history API validator', function () {
18 const myHistoryPath = '/api/v1/users/me/history/videos' 18 const myHistoryPath = '/api/v1/users/me/history/videos'
19 const myHistoryRemove = myHistoryPath + '/remove' 19 const myHistoryRemove = myHistoryPath + '/remove'
20 let watchingPath: string 20 let watchingPath: string
21 let server: ServerInfo 21 let server: PeerTubeServer
22 22
23 // --------------------------------------------------------------- 23 // ---------------------------------------------------------------
24 24
25 before(async function () { 25 before(async function () {
26 this.timeout(30000) 26 this.timeout(30000)
27 27
28 server = await flushAndRunServer(1) 28 server = await createSingleServer(1)
29 29
30 await setAccessTokensToServers([ server ]) 30 await setAccessTokensToServers([ server ])
31 31
diff --git a/server/tests/api/check-params/videos-overviews.ts b/server/tests/api/check-params/videos-overviews.ts
index 3597c81d3..c2139d74b 100644
--- a/server/tests/api/check-params/videos-overviews.ts
+++ b/server/tests/api/check-params/videos-overviews.ts
@@ -1,17 +1,17 @@
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ 1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2 2
3import 'mocha' 3import 'mocha'
4import { cleanupTests, flushAndRunServer, ServerInfo } from '@shared/extra-utils' 4import { cleanupTests, createSingleServer, PeerTubeServer } from '@shared/extra-utils'
5 5
6describe('Test videos overview', function () { 6describe('Test videos overview', function () {
7 let server: ServerInfo 7 let server: PeerTubeServer
8 8
9 // --------------------------------------------------------------- 9 // ---------------------------------------------------------------
10 10
11 before(async function () { 11 before(async function () {
12 this.timeout(30000) 12 this.timeout(30000)
13 13
14 server = await flushAndRunServer(1) 14 server = await createSingleServer(1)
15 }) 15 })
16 16
17 describe('When getting videos overview', function () { 17 describe('When getting videos overview', function () {
diff --git a/server/tests/api/check-params/videos.ts b/server/tests/api/check-params/videos.ts
index 69bdae7cf..c60de2640 100644
--- a/server/tests/api/check-params/videos.ts
+++ b/server/tests/api/check-params/videos.ts
@@ -11,13 +11,13 @@ import {
11 checkBadStartPagination, 11 checkBadStartPagination,
12 checkUploadVideoParam, 12 checkUploadVideoParam,
13 cleanupTests, 13 cleanupTests,
14 flushAndRunServer, 14 createSingleServer,
15 makeDeleteRequest, 15 makeDeleteRequest,
16 makeGetRequest, 16 makeGetRequest,
17 makePutBodyRequest, 17 makePutBodyRequest,
18 makeUploadRequest, 18 makeUploadRequest,
19 root, 19 root,
20 ServerInfo, 20 PeerTubeServer,
21 setAccessTokensToServers 21 setAccessTokensToServers
22} from '@shared/extra-utils' 22} from '@shared/extra-utils'
23import { PeerTubeProblemDocument, VideoCreateResult, VideoPrivacy } from '@shared/models' 23import { PeerTubeProblemDocument, VideoCreateResult, VideoPrivacy } from '@shared/models'
@@ -26,7 +26,7 @@ const expect = chai.expect
26 26
27describe('Test videos API validator', function () { 27describe('Test videos API validator', function () {
28 const path = '/api/v1/videos/' 28 const path = '/api/v1/videos/'
29 let server: ServerInfo 29 let server: PeerTubeServer
30 let userAccessToken = '' 30 let userAccessToken = ''
31 let accountName: string 31 let accountName: string
32 let channelId: number 32 let channelId: number
@@ -38,7 +38,7 @@ describe('Test videos API validator', function () {
38 before(async function () { 38 before(async function () {
39 this.timeout(30000) 39 this.timeout(30000)
40 40
41 server = await flushAndRunServer(1) 41 server = await createSingleServer(1)
42 42
43 await setAccessTokensToServers([ server ]) 43 await setAccessTokensToServers([ server ])
44 44
diff --git a/server/tests/api/live/live-constraints.ts b/server/tests/api/live/live-constraints.ts
index 1c380883c..a00833569 100644
--- a/server/tests/api/live/live-constraints.ts
+++ b/server/tests/api/live/live-constraints.ts
@@ -8,8 +8,8 @@ import {
8 cleanupTests, 8 cleanupTests,
9 ConfigCommand, 9 ConfigCommand,
10 doubleFollow, 10 doubleFollow,
11 flushAndRunMultipleServers, 11 createMultipleServers,
12 ServerInfo, 12 PeerTubeServer,
13 setAccessTokensToServers, 13 setAccessTokensToServers,
14 setDefaultVideoChannel, 14 setDefaultVideoChannel,
15 wait, 15 wait,
@@ -19,7 +19,7 @@ import {
19const expect = chai.expect 19const expect = chai.expect
20 20
21describe('Test live constraints', function () { 21describe('Test live constraints', function () {
22 let servers: ServerInfo[] = [] 22 let servers: PeerTubeServer[] = []
23 let userId: number 23 let userId: number
24 let userAccessToken: string 24 let userAccessToken: string
25 let userChannelId: number 25 let userChannelId: number
@@ -63,7 +63,7 @@ describe('Test live constraints', function () {
63 before(async function () { 63 before(async function () {
64 this.timeout(120000) 64 this.timeout(120000)
65 65
66 servers = await flushAndRunMultipleServers(2) 66 servers = await createMultipleServers(2)
67 67
68 // Get the access tokens 68 // Get the access tokens
69 await setAccessTokensToServers(servers) 69 await setAccessTokensToServers(servers)
diff --git a/server/tests/api/live/live-permanent.ts b/server/tests/api/live/live-permanent.ts
index 900bd6f5c..30d499e20 100644
--- a/server/tests/api/live/live-permanent.ts
+++ b/server/tests/api/live/live-permanent.ts
@@ -7,8 +7,8 @@ import {
7 cleanupTests, 7 cleanupTests,
8 ConfigCommand, 8 ConfigCommand,
9 doubleFollow, 9 doubleFollow,
10 flushAndRunMultipleServers, 10 createMultipleServers,
11 ServerInfo, 11 PeerTubeServer,
12 setAccessTokensToServers, 12 setAccessTokensToServers,
13 setDefaultVideoChannel, 13 setDefaultVideoChannel,
14 stopFfmpeg, 14 stopFfmpeg,
@@ -19,7 +19,7 @@ import {
19const expect = chai.expect 19const expect = chai.expect
20 20
21describe('Permanent live', function () { 21describe('Permanent live', function () {
22 let servers: ServerInfo[] = [] 22 let servers: PeerTubeServer[] = []
23 let videoUUID: string 23 let videoUUID: string
24 24
25 async function createLiveWrapper (permanentLive: boolean) { 25 async function createLiveWrapper (permanentLive: boolean) {
@@ -45,7 +45,7 @@ describe('Permanent live', function () {
45 before(async function () { 45 before(async function () {
46 this.timeout(120000) 46 this.timeout(120000)
47 47
48 servers = await flushAndRunMultipleServers(2) 48 servers = await createMultipleServers(2)
49 49
50 // Get the access tokens 50 // Get the access tokens
51 await setAccessTokensToServers(servers) 51 await setAccessTokensToServers(servers)
diff --git a/server/tests/api/live/live-save-replay.ts b/server/tests/api/live/live-save-replay.ts
index 7a33df90a..d403f27bf 100644
--- a/server/tests/api/live/live-save-replay.ts
+++ b/server/tests/api/live/live-save-replay.ts
@@ -9,8 +9,8 @@ import {
9 cleanupTests, 9 cleanupTests,
10 ConfigCommand, 10 ConfigCommand,
11 doubleFollow, 11 doubleFollow,
12 flushAndRunMultipleServers, 12 createMultipleServers,
13 ServerInfo, 13 PeerTubeServer,
14 setAccessTokensToServers, 14 setAccessTokensToServers,
15 setDefaultVideoChannel, 15 setDefaultVideoChannel,
16 stopFfmpeg, 16 stopFfmpeg,
@@ -23,7 +23,7 @@ import { LiveVideoCreate, VideoPrivacy, VideoState } from '@shared/models'
23const expect = chai.expect 23const expect = chai.expect
24 24
25describe('Save replay setting', function () { 25describe('Save replay setting', function () {
26 let servers: ServerInfo[] = [] 26 let servers: PeerTubeServer[] = []
27 let liveVideoUUID: string 27 let liveVideoUUID: string
28 let ffmpegCommand: FfmpegCommand 28 let ffmpegCommand: FfmpegCommand
29 29
@@ -82,7 +82,7 @@ describe('Save replay setting', function () {
82 before(async function () { 82 before(async function () {
83 this.timeout(120000) 83 this.timeout(120000)
84 84
85 servers = await flushAndRunMultipleServers(2) 85 servers = await createMultipleServers(2)
86 86
87 // Get the access tokens 87 // Get the access tokens
88 await setAccessTokensToServers(servers) 88 await setAccessTokensToServers(servers)
diff --git a/server/tests/api/live/live-socket-messages.ts b/server/tests/api/live/live-socket-messages.ts
index ad67d6285..3808964d1 100644
--- a/server/tests/api/live/live-socket-messages.ts
+++ b/server/tests/api/live/live-socket-messages.ts
@@ -6,8 +6,8 @@ import { VideoPrivacy, VideoState } from '@shared/models'
6import { 6import {
7 cleanupTests, 7 cleanupTests,
8 doubleFollow, 8 doubleFollow,
9 flushAndRunMultipleServers, 9 createMultipleServers,
10 ServerInfo, 10 PeerTubeServer,
11 setAccessTokensToServers, 11 setAccessTokensToServers,
12 setDefaultVideoChannel, 12 setDefaultVideoChannel,
13 stopFfmpeg, 13 stopFfmpeg,
@@ -19,12 +19,12 @@ import {
19const expect = chai.expect 19const expect = chai.expect
20 20
21describe('Test live', function () { 21describe('Test live', function () {
22 let servers: ServerInfo[] = [] 22 let servers: PeerTubeServer[] = []
23 23
24 before(async function () { 24 before(async function () {
25 this.timeout(120000) 25 this.timeout(120000)
26 26
27 servers = await flushAndRunMultipleServers(2) 27 servers = await createMultipleServers(2)
28 28
29 // Get the access tokens 29 // Get the access tokens
30 await setAccessTokensToServers(servers) 30 await setAccessTokensToServers(servers)
diff --git a/server/tests/api/live/live-views.ts b/server/tests/api/live/live-views.ts
index 43222f9c9..4a137b185 100644
--- a/server/tests/api/live/live-views.ts
+++ b/server/tests/api/live/live-views.ts
@@ -7,8 +7,8 @@ import { VideoPrivacy } from '@shared/models'
7import { 7import {
8 cleanupTests, 8 cleanupTests,
9 doubleFollow, 9 doubleFollow,
10 flushAndRunMultipleServers, 10 createMultipleServers,
11 ServerInfo, 11 PeerTubeServer,
12 setAccessTokensToServers, 12 setAccessTokensToServers,
13 setDefaultVideoChannel, 13 setDefaultVideoChannel,
14 stopFfmpeg, 14 stopFfmpeg,
@@ -20,12 +20,12 @@ import {
20const expect = chai.expect 20const expect = chai.expect
21 21
22describe('Test live', function () { 22describe('Test live', function () {
23 let servers: ServerInfo[] = [] 23 let servers: PeerTubeServer[] = []
24 24
25 before(async function () { 25 before(async function () {
26 this.timeout(120000) 26 this.timeout(120000)
27 27
28 servers = await flushAndRunMultipleServers(2) 28 servers = await createMultipleServers(2)
29 29
30 // Get the access tokens 30 // Get the access tokens
31 await setAccessTokensToServers(servers) 31 await setAccessTokensToServers(servers)
diff --git a/server/tests/api/live/live.ts b/server/tests/api/live/live.ts
index 2cce1f448..7cfac522c 100644
--- a/server/tests/api/live/live.ts
+++ b/server/tests/api/live/live.ts
@@ -11,13 +11,12 @@ import {
11 checkResolutionsInMasterPlaylist, 11 checkResolutionsInMasterPlaylist,
12 cleanupTests, 12 cleanupTests,
13 doubleFollow, 13 doubleFollow,
14 flushAndRunMultipleServers, 14 createMultipleServers,
15 killallServers, 15 killallServers,
16 LiveCommand, 16 LiveCommand,
17 makeRawRequest, 17 makeRawRequest,
18 reRunServer,
19 sendRTMPStream, 18 sendRTMPStream,
20 ServerInfo, 19 PeerTubeServer,
21 setAccessTokensToServers, 20 setAccessTokensToServers,
22 setDefaultVideoChannel, 21 setDefaultVideoChannel,
23 stopFfmpeg, 22 stopFfmpeg,
@@ -32,13 +31,13 @@ import { LiveVideo, LiveVideoCreate, VideoDetails, VideoPrivacy, VideoState, Vid
32const expect = chai.expect 31const expect = chai.expect
33 32
34describe('Test live', function () { 33describe('Test live', function () {
35 let servers: ServerInfo[] = [] 34 let servers: PeerTubeServer[] = []
36 let commands: LiveCommand[] 35 let commands: LiveCommand[]
37 36
38 before(async function () { 37 before(async function () {
39 this.timeout(120000) 38 this.timeout(120000)
40 39
41 servers = await flushAndRunMultipleServers(2) 40 servers = await createMultipleServers(2)
42 41
43 // Get the access tokens 42 // Get the access tokens
44 await setAccessTokensToServers(servers) 43 await setAccessTokensToServers(servers)
@@ -571,7 +570,7 @@ describe('Test live', function () {
571 await commands[0].waitUntilSegmentGeneration({ videoUUID: liveVideoReplayId, resolution: 0, segment: 2 }) 570 await commands[0].waitUntilSegmentGeneration({ videoUUID: liveVideoReplayId, resolution: 0, segment: 2 })
572 571
573 await killallServers([ servers[0] ]) 572 await killallServers([ servers[0] ])
574 await reRunServer(servers[0]) 573 await servers[0].run()
575 574
576 await wait(5000) 575 await wait(5000)
577 }) 576 })
diff --git a/server/tests/api/moderation/abuses.ts b/server/tests/api/moderation/abuses.ts
index 97a0d95c4..360b9de35 100644
--- a/server/tests/api/moderation/abuses.ts
+++ b/server/tests/api/moderation/abuses.ts
@@ -6,8 +6,8 @@ import {
6 AbusesCommand, 6 AbusesCommand,
7 cleanupTests, 7 cleanupTests,
8 doubleFollow, 8 doubleFollow,
9 flushAndRunMultipleServers, 9 createMultipleServers,
10 ServerInfo, 10 PeerTubeServer,
11 setAccessTokensToServers, 11 setAccessTokensToServers,
12 waitJobs 12 waitJobs
13} from '@shared/extra-utils' 13} from '@shared/extra-utils'
@@ -16,7 +16,7 @@ import { AbuseMessage, AbusePredefinedReasonsString, AbuseState, AdminAbuse, Use
16const expect = chai.expect 16const expect = chai.expect
17 17
18describe('Test abuses', function () { 18describe('Test abuses', function () {
19 let servers: ServerInfo[] = [] 19 let servers: PeerTubeServer[] = []
20 let abuseServer1: AdminAbuse 20 let abuseServer1: AdminAbuse
21 let abuseServer2: AdminAbuse 21 let abuseServer2: AdminAbuse
22 let commands: AbusesCommand[] 22 let commands: AbusesCommand[]
@@ -25,7 +25,7 @@ describe('Test abuses', function () {
25 this.timeout(50000) 25 this.timeout(50000)
26 26
27 // Run servers 27 // Run servers
28 servers = await flushAndRunMultipleServers(2) 28 servers = await createMultipleServers(2)
29 29
30 // Get the access tokens 30 // Get the access tokens
31 await setAccessTokensToServers(servers) 31 await setAccessTokensToServers(servers)
@@ -389,7 +389,7 @@ describe('Test abuses', function () {
389 389
390 describe('Comment abuses', function () { 390 describe('Comment abuses', function () {
391 391
392 async function getComment (server: ServerInfo, videoIdArg: number | string) { 392 async function getComment (server: PeerTubeServer, videoIdArg: number | string) {
393 const videoId = typeof videoIdArg === 'string' 393 const videoId = typeof videoIdArg === 'string'
394 ? await server.videos.getId({ uuid: videoIdArg }) 394 ? await server.videos.getId({ uuid: videoIdArg })
395 : videoIdArg 395 : videoIdArg
@@ -591,7 +591,7 @@ describe('Test abuses', function () {
591 591
592 describe('Account abuses', function () { 592 describe('Account abuses', function () {
593 593
594 function getAccountFromServer (server: ServerInfo, targetName: string, targetServer: ServerInfo) { 594 function getAccountFromServer (server: PeerTubeServer, targetName: string, targetServer: PeerTubeServer) {
595 return server.accounts.get({ accountName: targetName + '@' + targetServer.host }) 595 return server.accounts.get({ accountName: targetName + '@' + targetServer.host })
596 } 596 }
597 597
diff --git a/server/tests/api/moderation/blocklist-notification.ts b/server/tests/api/moderation/blocklist-notification.ts
index 6b56fdd65..fdfbcbced 100644
--- a/server/tests/api/moderation/blocklist-notification.ts
+++ b/server/tests/api/moderation/blocklist-notification.ts
@@ -2,12 +2,12 @@
2 2
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { cleanupTests, doubleFollow, flushAndRunMultipleServers, ServerInfo, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' 5import { cleanupTests, doubleFollow, createMultipleServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
6import { UserNotificationType } from '@shared/models' 6import { UserNotificationType } from '@shared/models'
7 7
8const expect = chai.expect 8const expect = chai.expect
9 9
10async function checkNotifications (server: ServerInfo, token: string, expected: UserNotificationType[]) { 10async function checkNotifications (server: PeerTubeServer, token: string, expected: UserNotificationType[]) {
11 const { data } = await server.notifications.list({ token, start: 0, count: 10, unread: true }) 11 const { data } = await server.notifications.list({ token, start: 0, count: 10, unread: true })
12 expect(data).to.have.lengthOf(expected.length) 12 expect(data).to.have.lengthOf(expected.length)
13 13
@@ -17,7 +17,7 @@ async function checkNotifications (server: ServerInfo, token: string, expected:
17} 17}
18 18
19describe('Test blocklist', function () { 19describe('Test blocklist', function () {
20 let servers: ServerInfo[] 20 let servers: PeerTubeServer[]
21 let videoUUID: string 21 let videoUUID: string
22 22
23 let userToken1: string 23 let userToken1: string
@@ -62,7 +62,7 @@ describe('Test blocklist', function () {
62 before(async function () { 62 before(async function () {
63 this.timeout(60000) 63 this.timeout(60000)
64 64
65 servers = await flushAndRunMultipleServers(2) 65 servers = await createMultipleServers(2)
66 await setAccessTokensToServers(servers) 66 await setAccessTokensToServers(servers)
67 67
68 { 68 {
diff --git a/server/tests/api/moderation/blocklist.ts b/server/tests/api/moderation/blocklist.ts
index 9a4a3b3b9..593291e87 100644
--- a/server/tests/api/moderation/blocklist.ts
+++ b/server/tests/api/moderation/blocklist.ts
@@ -7,8 +7,8 @@ import {
7 cleanupTests, 7 cleanupTests,
8 CommentsCommand, 8 CommentsCommand,
9 doubleFollow, 9 doubleFollow,
10 flushAndRunMultipleServers, 10 createMultipleServers,
11 ServerInfo, 11 PeerTubeServer,
12 setAccessTokensToServers, 12 setAccessTokensToServers,
13 waitJobs 13 waitJobs
14} from '@shared/extra-utils' 14} from '@shared/extra-utils'
@@ -16,7 +16,7 @@ import { UserNotificationType } from '@shared/models'
16 16
17const expect = chai.expect 17const expect = chai.expect
18 18
19async function checkAllVideos (server: ServerInfo, token: string) { 19async function checkAllVideos (server: PeerTubeServer, token: string) {
20 { 20 {
21 const { data } = await server.videos.listWithToken({ token }) 21 const { data } = await server.videos.listWithToken({ token })
22 expect(data).to.have.lengthOf(5) 22 expect(data).to.have.lengthOf(5)
@@ -28,7 +28,7 @@ async function checkAllVideos (server: ServerInfo, token: string) {
28 } 28 }
29} 29}
30 30
31async function checkAllComments (server: ServerInfo, token: string, videoUUID: string) { 31async function checkAllComments (server: PeerTubeServer, token: string, videoUUID: string) {
32 const { data } = await server.comments.listThreads({ videoId: videoUUID, start: 0, count: 25, sort: '-createdAt', token }) 32 const { data } = await server.comments.listThreads({ videoId: videoUUID, start: 0, count: 25, sort: '-createdAt', token })
33 33
34 const threads = data.filter(t => t.isDeleted === false) 34 const threads = data.filter(t => t.isDeleted === false)
@@ -41,8 +41,8 @@ async function checkAllComments (server: ServerInfo, token: string, videoUUID: s
41} 41}
42 42
43async function checkCommentNotification ( 43async function checkCommentNotification (
44 mainServer: ServerInfo, 44 mainServer: PeerTubeServer,
45 comment: { server: ServerInfo, token: string, videoUUID: string, text: string }, 45 comment: { server: PeerTubeServer, token: string, videoUUID: string, text: string },
46 check: 'presence' | 'absence' 46 check: 'presence' | 'absence'
47) { 47) {
48 const command = comment.server.comments 48 const command = comment.server.comments
@@ -63,7 +63,7 @@ async function checkCommentNotification (
63} 63}
64 64
65describe('Test blocklist', function () { 65describe('Test blocklist', function () {
66 let servers: ServerInfo[] 66 let servers: PeerTubeServer[]
67 let videoUUID1: string 67 let videoUUID1: string
68 let videoUUID2: string 68 let videoUUID2: string
69 let videoUUID3: string 69 let videoUUID3: string
@@ -77,7 +77,7 @@ describe('Test blocklist', function () {
77 before(async function () { 77 before(async function () {
78 this.timeout(120000) 78 this.timeout(120000)
79 79
80 servers = await flushAndRunMultipleServers(3) 80 servers = await createMultipleServers(3)
81 await setAccessTokensToServers(servers) 81 await setAccessTokensToServers(servers)
82 82
83 command = servers[0].blocklist 83 command = servers[0].blocklist
diff --git a/server/tests/api/moderation/video-blacklist.ts b/server/tests/api/moderation/video-blacklist.ts
index d23d23bcb..62cbf2e07 100644
--- a/server/tests/api/moderation/video-blacklist.ts
+++ b/server/tests/api/moderation/video-blacklist.ts
@@ -7,11 +7,10 @@ import {
7 BlacklistCommand, 7 BlacklistCommand,
8 cleanupTests, 8 cleanupTests,
9 doubleFollow, 9 doubleFollow,
10 flushAndRunMultipleServers, 10 createMultipleServers,
11 ImportsCommand, 11 ImportsCommand,
12 killallServers, 12 killallServers,
13 reRunServer, 13 PeerTubeServer,
14 ServerInfo,
15 setAccessTokensToServers, 14 setAccessTokensToServers,
16 waitJobs 15 waitJobs
17} from '@shared/extra-utils' 16} from '@shared/extra-utils'
@@ -20,11 +19,11 @@ import { UserAdminFlag, UserRole, VideoBlacklist, VideoBlacklistType } from '@sh
20const expect = chai.expect 19const expect = chai.expect
21 20
22describe('Test video blacklist', function () { 21describe('Test video blacklist', function () {
23 let servers: ServerInfo[] = [] 22 let servers: PeerTubeServer[] = []
24 let videoId: number 23 let videoId: number
25 let command: BlacklistCommand 24 let command: BlacklistCommand
26 25
27 async function blacklistVideosOnServer (server: ServerInfo) { 26 async function blacklistVideosOnServer (server: PeerTubeServer) {
28 const { data } = await server.videos.list() 27 const { data } = await server.videos.list()
29 28
30 for (const video of data) { 29 for (const video of data) {
@@ -36,7 +35,7 @@ describe('Test video blacklist', function () {
36 this.timeout(50000) 35 this.timeout(50000)
37 36
38 // Run servers 37 // Run servers
39 servers = await flushAndRunMultipleServers(2) 38 servers = await createMultipleServers(2)
40 39
41 // Get the access tokens 40 // Get the access tokens
42 await setAccessTokensToServers(servers) 41 await setAccessTokensToServers(servers)
@@ -344,7 +343,7 @@ describe('Test video blacklist', function () {
344 } 343 }
345 } 344 }
346 } 345 }
347 await reRunServer(servers[0], config) 346 await servers[0].run(config)
348 347
349 { 348 {
350 const user = { username: 'user_without_flag', password: 'password' } 349 const user = { username: 'user_without_flag', password: 'password' }
diff --git a/server/tests/api/notifications/admin-notifications.ts b/server/tests/api/notifications/admin-notifications.ts
index 5a5bdb0c8..d65551f0a 100644
--- a/server/tests/api/notifications/admin-notifications.ts
+++ b/server/tests/api/notifications/admin-notifications.ts
@@ -10,13 +10,13 @@ import {
10 MockJoinPeerTubeVersions, 10 MockJoinPeerTubeVersions,
11 MockSmtpServer, 11 MockSmtpServer,
12 prepareNotificationsTest, 12 prepareNotificationsTest,
13 ServerInfo, 13 PeerTubeServer,
14 wait 14 wait
15} from '@shared/extra-utils' 15} from '@shared/extra-utils'
16import { PluginType, UserNotification, UserNotificationType } from '@shared/models' 16import { PluginType, UserNotification, UserNotificationType } from '@shared/models'
17 17
18describe('Test admin notifications', function () { 18describe('Test admin notifications', function () {
19 let server: ServerInfo 19 let server: PeerTubeServer
20 let userNotifications: UserNotification[] = [] 20 let userNotifications: UserNotification[] = []
21 let adminNotifications: UserNotification[] = [] 21 let adminNotifications: UserNotification[] = []
22 let emails: object[] = [] 22 let emails: object[] = []
diff --git a/server/tests/api/notifications/comments-notifications.ts b/server/tests/api/notifications/comments-notifications.ts
index 133b6340f..d54819aaa 100644
--- a/server/tests/api/notifications/comments-notifications.ts
+++ b/server/tests/api/notifications/comments-notifications.ts
@@ -9,7 +9,7 @@ import {
9 cleanupTests, 9 cleanupTests,
10 MockSmtpServer, 10 MockSmtpServer,
11 prepareNotificationsTest, 11 prepareNotificationsTest,
12 ServerInfo, 12 PeerTubeServer,
13 waitJobs 13 waitJobs
14} from '@shared/extra-utils' 14} from '@shared/extra-utils'
15import { UserNotification } from '@shared/models' 15import { UserNotification } from '@shared/models'
@@ -17,7 +17,7 @@ import { UserNotification } from '@shared/models'
17const expect = chai.expect 17const expect = chai.expect
18 18
19describe('Test comments notifications', function () { 19describe('Test comments notifications', function () {
20 let servers: ServerInfo[] = [] 20 let servers: PeerTubeServer[] = []
21 let userToken: string 21 let userToken: string
22 let userNotifications: UserNotification[] = [] 22 let userNotifications: UserNotification[] = []
23 let emails: object[] = [] 23 let emails: object[] = []
diff --git a/server/tests/api/notifications/moderation-notifications.ts b/server/tests/api/notifications/moderation-notifications.ts
index e7c5badd2..3a294192b 100644
--- a/server/tests/api/notifications/moderation-notifications.ts
+++ b/server/tests/api/notifications/moderation-notifications.ts
@@ -20,14 +20,14 @@ import {
20 MockInstancesIndex, 20 MockInstancesIndex,
21 MockSmtpServer, 21 MockSmtpServer,
22 prepareNotificationsTest, 22 prepareNotificationsTest,
23 ServerInfo, 23 PeerTubeServer,
24 wait, 24 wait,
25 waitJobs 25 waitJobs
26} from '@shared/extra-utils' 26} from '@shared/extra-utils'
27import { AbuseState, CustomConfig, UserNotification, VideoPrivacy } from '@shared/models' 27import { AbuseState, CustomConfig, UserNotification, VideoPrivacy } from '@shared/models'
28 28
29describe('Test moderation notifications', function () { 29describe('Test moderation notifications', function () {
30 let servers: ServerInfo[] = [] 30 let servers: PeerTubeServer[] = []
31 let userAccessToken: string 31 let userAccessToken: string
32 let userNotifications: UserNotification[] = [] 32 let userNotifications: UserNotification[] = []
33 let adminNotifications: UserNotification[] = [] 33 let adminNotifications: UserNotification[] = []
diff --git a/server/tests/api/notifications/notifications-api.ts b/server/tests/api/notifications/notifications-api.ts
index 647d783b5..178b20687 100644
--- a/server/tests/api/notifications/notifications-api.ts
+++ b/server/tests/api/notifications/notifications-api.ts
@@ -9,7 +9,7 @@ import {
9 getAllNotificationsSettings, 9 getAllNotificationsSettings,
10 MockSmtpServer, 10 MockSmtpServer,
11 prepareNotificationsTest, 11 prepareNotificationsTest,
12 ServerInfo, 12 PeerTubeServer,
13 waitJobs 13 waitJobs
14} from '@shared/extra-utils' 14} from '@shared/extra-utils'
15import { UserNotification, UserNotificationSettingValue } from '@shared/models' 15import { UserNotification, UserNotificationSettingValue } from '@shared/models'
@@ -17,7 +17,7 @@ import { UserNotification, UserNotificationSettingValue } from '@shared/models'
17const expect = chai.expect 17const expect = chai.expect
18 18
19describe('Test notifications API', function () { 19describe('Test notifications API', function () {
20 let server: ServerInfo 20 let server: PeerTubeServer
21 let userNotifications: UserNotification[] = [] 21 let userNotifications: UserNotification[] = []
22 let userToken: string 22 let userToken: string
23 let emails: object[] = [] 23 let emails: object[] = []
diff --git a/server/tests/api/notifications/user-notifications.ts b/server/tests/api/notifications/user-notifications.ts
index 53f8c7594..b7c22d118 100644
--- a/server/tests/api/notifications/user-notifications.ts
+++ b/server/tests/api/notifications/user-notifications.ts
@@ -13,7 +13,7 @@ import {
13 ImportsCommand, 13 ImportsCommand,
14 MockSmtpServer, 14 MockSmtpServer,
15 prepareNotificationsTest, 15 prepareNotificationsTest,
16 ServerInfo, 16 PeerTubeServer,
17 uploadRandomVideoOnServers, 17 uploadRandomVideoOnServers,
18 wait, 18 wait,
19 waitJobs 19 waitJobs
@@ -23,7 +23,7 @@ import { UserNotification, UserNotificationType, VideoPrivacy } from '@shared/mo
23const expect = chai.expect 23const expect = chai.expect
24 24
25describe('Test user notifications', function () { 25describe('Test user notifications', function () {
26 let servers: ServerInfo[] = [] 26 let servers: PeerTubeServer[] = []
27 let userAccessToken: string 27 let userAccessToken: string
28 let userNotifications: UserNotification[] = [] 28 let userNotifications: UserNotification[] = []
29 let adminNotifications: UserNotification[] = [] 29 let adminNotifications: UserNotification[] = []
diff --git a/server/tests/api/redundancy/manage-redundancy.ts b/server/tests/api/redundancy/manage-redundancy.ts
index e193b968e..aff64e2eb 100644
--- a/server/tests/api/redundancy/manage-redundancy.ts
+++ b/server/tests/api/redundancy/manage-redundancy.ts
@@ -5,9 +5,9 @@ import * as chai from 'chai'
5import { 5import {
6 cleanupTests, 6 cleanupTests,
7 doubleFollow, 7 doubleFollow,
8 flushAndRunMultipleServers, 8 createMultipleServers,
9 RedundancyCommand, 9 RedundancyCommand,
10 ServerInfo, 10 PeerTubeServer,
11 setAccessTokensToServers, 11 setAccessTokensToServers,
12 waitJobs 12 waitJobs
13} from '@shared/extra-utils' 13} from '@shared/extra-utils'
@@ -18,7 +18,7 @@ const expect = chai.expect
18describe('Test manage videos redundancy', function () { 18describe('Test manage videos redundancy', function () {
19 const targets: VideoRedundanciesTarget[] = [ 'my-videos', 'remote-videos' ] 19 const targets: VideoRedundanciesTarget[] = [ 'my-videos', 'remote-videos' ]
20 20
21 let servers: ServerInfo[] 21 let servers: PeerTubeServer[]
22 let video1Server2UUID: string 22 let video1Server2UUID: string
23 let video2Server2UUID: string 23 let video2Server2UUID: string
24 let redundanciesToRemove: number[] = [] 24 let redundanciesToRemove: number[] = []
@@ -48,7 +48,7 @@ describe('Test manage videos redundancy', function () {
48 } 48 }
49 } 49 }
50 } 50 }
51 servers = await flushAndRunMultipleServers(3, config) 51 servers = await createMultipleServers(3, config)
52 52
53 // Get the access tokens 53 // Get the access tokens
54 await setAccessTokensToServers(servers) 54 await setAccessTokensToServers(servers)
diff --git a/server/tests/api/redundancy/redundancy-constraints.ts b/server/tests/api/redundancy/redundancy-constraints.ts
index 0378cc122..217691fb6 100644
--- a/server/tests/api/redundancy/redundancy-constraints.ts
+++ b/server/tests/api/redundancy/redundancy-constraints.ts
@@ -4,19 +4,18 @@ import 'mocha'
4import { expect } from 'chai' 4import { expect } from 'chai'
5import { 5import {
6 cleanupTests, 6 cleanupTests,
7 flushAndRunServer, 7 createSingleServer,
8 killallServers, 8 killallServers,
9 reRunServer, 9 PeerTubeServer,
10 ServerInfo,
11 setAccessTokensToServers, 10 setAccessTokensToServers,
12 waitJobs 11 waitJobs
13} from '@shared/extra-utils' 12} from '@shared/extra-utils'
14import { VideoPrivacy } from '@shared/models' 13import { VideoPrivacy } from '@shared/models'
15 14
16describe('Test redundancy constraints', function () { 15describe('Test redundancy constraints', function () {
17 let remoteServer: ServerInfo 16 let remoteServer: PeerTubeServer
18 let localServer: ServerInfo 17 let localServer: PeerTubeServer
19 let servers: ServerInfo[] 18 let servers: PeerTubeServer[]
20 19
21 const remoteServerConfig = { 20 const remoteServerConfig = {
22 redundancy: { 21 redundancy: {
@@ -59,7 +58,7 @@ describe('Test redundancy constraints', function () {
59 this.timeout(120000) 58 this.timeout(120000)
60 59
61 { 60 {
62 remoteServer = await flushAndRunServer(1, remoteServerConfig) 61 remoteServer = await createSingleServer(1, remoteServerConfig)
63 } 62 }
64 63
65 { 64 {
@@ -70,7 +69,7 @@ describe('Test redundancy constraints', function () {
70 } 69 }
71 } 70 }
72 } 71 }
73 localServer = await flushAndRunServer(2, config) 72 localServer = await createSingleServer(2, config)
74 } 73 }
75 74
76 servers = [ remoteServer, localServer ] 75 servers = [ remoteServer, localServer ]
@@ -119,7 +118,7 @@ describe('Test redundancy constraints', function () {
119 } 118 }
120 } 119 }
121 await await killallServers([ localServer ]) 120 await await killallServers([ localServer ])
122 await reRunServer(localServer, config) 121 await localServer.run(config)
123 122
124 await uploadWrapper('video 2 server 2') 123 await uploadWrapper('video 2 server 2')
125 124
@@ -148,7 +147,7 @@ describe('Test redundancy constraints', function () {
148 } 147 }
149 } 148 }
150 await killallServers([ localServer ]) 149 await killallServers([ localServer ])
151 await reRunServer(localServer, config) 150 await localServer.run(config)
152 151
153 await uploadWrapper('video 3 server 2') 152 await uploadWrapper('video 3 server 2')
154 153
diff --git a/server/tests/api/redundancy/redundancy.ts b/server/tests/api/redundancy/redundancy.ts
index 77ea2278e..9d5d96efd 100644
--- a/server/tests/api/redundancy/redundancy.ts
+++ b/server/tests/api/redundancy/redundancy.ts
@@ -11,12 +11,11 @@ import {
11 checkVideoFilesWereRemoved, 11 checkVideoFilesWereRemoved,
12 cleanupTests, 12 cleanupTests,
13 doubleFollow, 13 doubleFollow,
14 flushAndRunMultipleServers, 14 createMultipleServers,
15 killallServers, 15 killallServers,
16 makeGetRequest, 16 makeGetRequest,
17 reRunServer,
18 root, 17 root,
19 ServerInfo, 18 PeerTubeServer,
20 setAccessTokensToServers, 19 setAccessTokensToServers,
21 wait, 20 wait,
22 waitJobs 21 waitJobs
@@ -25,11 +24,11 @@ import { VideoPrivacy, VideoRedundancyStrategy, VideoRedundancyStrategyWithManua
25 24
26const expect = chai.expect 25const expect = chai.expect
27 26
28let servers: ServerInfo[] = [] 27let servers: PeerTubeServer[] = []
29let video1Server2UUID: string 28let video1Server2UUID: string
30let video1Server2Id: number 29let video1Server2Id: number
31 30
32function checkMagnetWebseeds (file: { magnetUri: string, resolution: { id: number } }, baseWebseeds: string[], server: ServerInfo) { 31function checkMagnetWebseeds (file: { magnetUri: string, resolution: { id: number } }, baseWebseeds: string[], server: PeerTubeServer) {
33 const parsed = magnetUtil.decode(file.magnetUri) 32 const parsed = magnetUtil.decode(file.magnetUri)
34 33
35 for (const ws of baseWebseeds) { 34 for (const ws of baseWebseeds) {
@@ -40,7 +39,7 @@ function checkMagnetWebseeds (file: { magnetUri: string, resolution: { id: numbe
40 expect(parsed.urlList).to.have.lengthOf(baseWebseeds.length) 39 expect(parsed.urlList).to.have.lengthOf(baseWebseeds.length)
41} 40}
42 41
43async function flushAndRunServers (strategy: VideoRedundancyStrategy | null, additionalParams: any = {}, withWebtorrent = true) { 42async function createSingleServers (strategy: VideoRedundancyStrategy | null, additionalParams: any = {}, withWebtorrent = true) {
44 const strategies: any[] = [] 43 const strategies: any[] = []
45 44
46 if (strategy !== null) { 45 if (strategy !== null) {
@@ -72,7 +71,7 @@ async function flushAndRunServers (strategy: VideoRedundancyStrategy | null, add
72 } 71 }
73 } 72 }
74 73
75 servers = await flushAndRunMultipleServers(3, config) 74 servers = await createMultipleServers(3, config)
76 75
77 // Get the access tokens 76 // Get the access tokens
78 await setAccessTokensToServers(servers) 77 await setAccessTokensToServers(servers)
@@ -288,7 +287,7 @@ describe('Test videos redundancy', function () {
288 before(function () { 287 before(function () {
289 this.timeout(120000) 288 this.timeout(120000)
290 289
291 return flushAndRunServers(strategy) 290 return createSingleServers(strategy)
292 }) 291 })
293 292
294 it('Should have 1 webseed on the first video', async function () { 293 it('Should have 1 webseed on the first video', async function () {
@@ -338,7 +337,7 @@ describe('Test videos redundancy', function () {
338 before(function () { 337 before(function () {
339 this.timeout(120000) 338 this.timeout(120000)
340 339
341 return flushAndRunServers(strategy) 340 return createSingleServers(strategy)
342 }) 341 })
343 342
344 it('Should have 1 webseed on the first video', async function () { 343 it('Should have 1 webseed on the first video', async function () {
@@ -388,7 +387,7 @@ describe('Test videos redundancy', function () {
388 before(function () { 387 before(function () {
389 this.timeout(120000) 388 this.timeout(120000)
390 389
391 return flushAndRunServers(strategy, { min_views: 3 }) 390 return createSingleServers(strategy, { min_views: 3 })
392 }) 391 })
393 392
394 it('Should have 1 webseed on the first video', async function () { 393 it('Should have 1 webseed on the first video', async function () {
@@ -458,7 +457,7 @@ describe('Test videos redundancy', function () {
458 before(async function () { 457 before(async function () {
459 this.timeout(120000) 458 this.timeout(120000)
460 459
461 await flushAndRunServers(strategy, { min_views: 3 }, false) 460 await createSingleServers(strategy, { min_views: 3 }, false)
462 }) 461 })
463 462
464 it('Should have 0 playlist redundancy on the first video', async function () { 463 it('Should have 0 playlist redundancy on the first video', async function () {
@@ -519,7 +518,7 @@ describe('Test videos redundancy', function () {
519 before(function () { 518 before(function () {
520 this.timeout(120000) 519 this.timeout(120000)
521 520
522 return flushAndRunServers(null) 521 return createSingleServers(null)
523 }) 522 })
524 523
525 it('Should have 1 webseed on the first video', async function () { 524 it('Should have 1 webseed on the first video', async function () {
@@ -575,7 +574,7 @@ describe('Test videos redundancy', function () {
575 describe('Test expiration', function () { 574 describe('Test expiration', function () {
576 const strategy = 'recently-added' 575 const strategy = 'recently-added'
577 576
578 async function checkContains (servers: ServerInfo[], str: string) { 577 async function checkContains (servers: PeerTubeServer[], str: string) {
579 for (const server of servers) { 578 for (const server of servers) {
580 const video = await server.videos.get({ id: video1Server2UUID }) 579 const video = await server.videos.get({ id: video1Server2UUID })
581 580
@@ -585,7 +584,7 @@ describe('Test videos redundancy', function () {
585 } 584 }
586 } 585 }
587 586
588 async function checkNotContains (servers: ServerInfo[], str: string) { 587 async function checkNotContains (servers: PeerTubeServer[], str: string) {
589 for (const server of servers) { 588 for (const server of servers) {
590 const video = await server.videos.get({ id: video1Server2UUID }) 589 const video = await server.videos.get({ id: video1Server2UUID })
591 590
@@ -598,7 +597,7 @@ describe('Test videos redundancy', function () {
598 before(async function () { 597 before(async function () {
599 this.timeout(120000) 598 this.timeout(120000)
600 599
601 await flushAndRunServers(strategy, { min_lifetime: '7 seconds', min_views: 0 }) 600 await createSingleServers(strategy, { min_lifetime: '7 seconds', min_views: 0 })
602 601
603 await enableRedundancyOnServer1() 602 await enableRedundancyOnServer1()
604 }) 603 })
@@ -640,7 +639,7 @@ describe('Test videos redundancy', function () {
640 before(async function () { 639 before(async function () {
641 this.timeout(120000) 640 this.timeout(120000)
642 641
643 await flushAndRunServers(strategy, { min_lifetime: '7 seconds', min_views: 0 }) 642 await createSingleServers(strategy, { min_lifetime: '7 seconds', min_views: 0 })
644 643
645 await enableRedundancyOnServer1() 644 await enableRedundancyOnServer1()
646 645
@@ -691,7 +690,7 @@ describe('Test videos redundancy', function () {
691 await waitJobs(servers) 690 await waitJobs(servers)
692 691
693 await killallServers([ servers[0] ]) 692 await killallServers([ servers[0] ])
694 await reRunServer(servers[0], { 693 await servers[0].run({
695 redundancy: { 694 redundancy: {
696 videos: { 695 videos: {
697 check_interval: '1 second', 696 check_interval: '1 second',
diff --git a/server/tests/api/search/search-activitypub-video-channels.ts b/server/tests/api/search/search-activitypub-video-channels.ts
index 71e9367e5..f5896ec25 100644
--- a/server/tests/api/search/search-activitypub-video-channels.ts
+++ b/server/tests/api/search/search-activitypub-video-channels.ts
@@ -4,9 +4,9 @@ import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { 5import {
6 cleanupTests, 6 cleanupTests,
7 flushAndRunMultipleServers, 7 createMultipleServers,
8 SearchCommand, 8 SearchCommand,
9 ServerInfo, 9 PeerTubeServer,
10 setAccessTokensToServers, 10 setAccessTokensToServers,
11 wait, 11 wait,
12 waitJobs 12 waitJobs
@@ -16,7 +16,7 @@ import { VideoChannel } from '@shared/models'
16const expect = chai.expect 16const expect = chai.expect
17 17
18describe('Test ActivityPub video channels search', function () { 18describe('Test ActivityPub video channels search', function () {
19 let servers: ServerInfo[] 19 let servers: PeerTubeServer[]
20 let userServer2Token: string 20 let userServer2Token: string
21 let videoServer2UUID: string 21 let videoServer2UUID: string
22 let channelIdServer2: number 22 let channelIdServer2: number
@@ -25,7 +25,7 @@ describe('Test ActivityPub video channels search', function () {
25 before(async function () { 25 before(async function () {
26 this.timeout(120000) 26 this.timeout(120000)
27 27
28 servers = await flushAndRunMultipleServers(2) 28 servers = await createMultipleServers(2)
29 29
30 await setAccessTokensToServers(servers) 30 await setAccessTokensToServers(servers)
31 31
diff --git a/server/tests/api/search/search-activitypub-video-playlists.ts b/server/tests/api/search/search-activitypub-video-playlists.ts
index 7c99b954b..ada2d3d6c 100644
--- a/server/tests/api/search/search-activitypub-video-playlists.ts
+++ b/server/tests/api/search/search-activitypub-video-playlists.ts
@@ -4,9 +4,9 @@ import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { 5import {
6 cleanupTests, 6 cleanupTests,
7 flushAndRunMultipleServers, 7 createMultipleServers,
8 SearchCommand, 8 SearchCommand,
9 ServerInfo, 9 PeerTubeServer,
10 setAccessTokensToServers, 10 setAccessTokensToServers,
11 setDefaultVideoChannel, 11 setDefaultVideoChannel,
12 wait, 12 wait,
@@ -17,7 +17,7 @@ import { VideoPlaylistPrivacy } from '@shared/models'
17const expect = chai.expect 17const expect = chai.expect
18 18
19describe('Test ActivityPub playlists search', function () { 19describe('Test ActivityPub playlists search', function () {
20 let servers: ServerInfo[] 20 let servers: PeerTubeServer[]
21 let playlistServer1UUID: string 21 let playlistServer1UUID: string
22 let playlistServer2UUID: string 22 let playlistServer2UUID: string
23 let video2Server2: string 23 let video2Server2: string
@@ -27,7 +27,7 @@ describe('Test ActivityPub playlists search', function () {
27 before(async function () { 27 before(async function () {
28 this.timeout(120000) 28 this.timeout(120000)
29 29
30 servers = await flushAndRunMultipleServers(2) 30 servers = await createMultipleServers(2)
31 31
32 await setAccessTokensToServers(servers) 32 await setAccessTokensToServers(servers)
33 await setDefaultVideoChannel(servers) 33 await setDefaultVideoChannel(servers)
diff --git a/server/tests/api/search/search-activitypub-videos.ts b/server/tests/api/search/search-activitypub-videos.ts
index 0dfc63446..a015b72a7 100644
--- a/server/tests/api/search/search-activitypub-videos.ts
+++ b/server/tests/api/search/search-activitypub-videos.ts
@@ -4,9 +4,9 @@ import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { 5import {
6 cleanupTests, 6 cleanupTests,
7 flushAndRunMultipleServers, 7 createMultipleServers,
8 SearchCommand, 8 SearchCommand,
9 ServerInfo, 9 PeerTubeServer,
10 setAccessTokensToServers, 10 setAccessTokensToServers,
11 wait, 11 wait,
12 waitJobs 12 waitJobs
@@ -16,7 +16,7 @@ import { VideoPrivacy } from '@shared/models'
16const expect = chai.expect 16const expect = chai.expect
17 17
18describe('Test ActivityPub videos search', function () { 18describe('Test ActivityPub videos search', function () {
19 let servers: ServerInfo[] 19 let servers: PeerTubeServer[]
20 let videoServer1UUID: string 20 let videoServer1UUID: string
21 let videoServer2UUID: string 21 let videoServer2UUID: string
22 22
@@ -25,7 +25,7 @@ describe('Test ActivityPub videos search', function () {
25 before(async function () { 25 before(async function () {
26 this.timeout(120000) 26 this.timeout(120000)
27 27
28 servers = await flushAndRunMultipleServers(2) 28 servers = await createMultipleServers(2)
29 29
30 await setAccessTokensToServers(servers) 30 await setAccessTokensToServers(servers)
31 31
diff --git a/server/tests/api/search/search-channels.ts b/server/tests/api/search/search-channels.ts
index 7035fbd62..07e00a214 100644
--- a/server/tests/api/search/search-channels.ts
+++ b/server/tests/api/search/search-channels.ts
@@ -2,19 +2,19 @@
2 2
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { cleanupTests, flushAndRunServer, SearchCommand, ServerInfo, setAccessTokensToServers } from '@shared/extra-utils' 5import { cleanupTests, createSingleServer, SearchCommand, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils'
6import { VideoChannel } from '@shared/models' 6import { VideoChannel } from '@shared/models'
7 7
8const expect = chai.expect 8const expect = chai.expect
9 9
10describe('Test channels search', function () { 10describe('Test channels search', function () {
11 let server: ServerInfo = null 11 let server: PeerTubeServer = null
12 let command: SearchCommand 12 let command: SearchCommand
13 13
14 before(async function () { 14 before(async function () {
15 this.timeout(30000) 15 this.timeout(30000)
16 16
17 server = await flushAndRunServer(1) 17 server = await createSingleServer(1)
18 18
19 await setAccessTokensToServers([ server ]) 19 await setAccessTokensToServers([ server ])
20 20
diff --git a/server/tests/api/search/search-index.ts b/server/tests/api/search/search-index.ts
index b54c0da22..38edcf7c6 100644
--- a/server/tests/api/search/search-index.ts
+++ b/server/tests/api/search/search-index.ts
@@ -2,7 +2,7 @@
2 2
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { cleanupTests, flushAndRunServer, SearchCommand, ServerInfo, setAccessTokensToServers } from '@shared/extra-utils' 5import { cleanupTests, createSingleServer, SearchCommand, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils'
6import { BooleanBothQuery, VideoPlaylistPrivacy, VideoPlaylistType, VideosSearchQuery } from '@shared/models' 6import { BooleanBothQuery, VideoPlaylistPrivacy, VideoPlaylistType, VideosSearchQuery } from '@shared/models'
7 7
8const expect = chai.expect 8const expect = chai.expect
@@ -10,13 +10,13 @@ const expect = chai.expect
10describe('Test videos search', function () { 10describe('Test videos search', function () {
11 const localVideoName = 'local video' + new Date().toISOString() 11 const localVideoName = 'local video' + new Date().toISOString()
12 12
13 let server: ServerInfo = null 13 let server: PeerTubeServer = null
14 let command: SearchCommand 14 let command: SearchCommand
15 15
16 before(async function () { 16 before(async function () {
17 this.timeout(30000) 17 this.timeout(30000)
18 18
19 server = await flushAndRunServer(1) 19 server = await createSingleServer(1)
20 20
21 await setAccessTokensToServers([ server ]) 21 await setAccessTokensToServers([ server ])
22 22
diff --git a/server/tests/api/search/search-playlists.ts b/server/tests/api/search/search-playlists.ts
index e15128c8e..b29c2d127 100644
--- a/server/tests/api/search/search-playlists.ts
+++ b/server/tests/api/search/search-playlists.ts
@@ -4,9 +4,9 @@ import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { 5import {
6 cleanupTests, 6 cleanupTests,
7 flushAndRunServer, 7 createSingleServer,
8 SearchCommand, 8 SearchCommand,
9 ServerInfo, 9 PeerTubeServer,
10 setAccessTokensToServers, 10 setAccessTokensToServers,
11 setDefaultVideoChannel 11 setDefaultVideoChannel
12} from '@shared/extra-utils' 12} from '@shared/extra-utils'
@@ -15,13 +15,13 @@ import { VideoPlaylistPrivacy } from '@shared/models'
15const expect = chai.expect 15const expect = chai.expect
16 16
17describe('Test playlists search', function () { 17describe('Test playlists search', function () {
18 let server: ServerInfo = null 18 let server: PeerTubeServer = null
19 let command: SearchCommand 19 let command: SearchCommand
20 20
21 before(async function () { 21 before(async function () {
22 this.timeout(30000) 22 this.timeout(30000)
23 23
24 server = await flushAndRunServer(1) 24 server = await createSingleServer(1)
25 25
26 await setAccessTokensToServers([ server ]) 26 await setAccessTokensToServers([ server ])
27 await setDefaultVideoChannel([ server ]) 27 await setDefaultVideoChannel([ server ])
diff --git a/server/tests/api/search/search-videos.ts b/server/tests/api/search/search-videos.ts
index 478ebafc9..a9b0a4fcd 100644
--- a/server/tests/api/search/search-videos.ts
+++ b/server/tests/api/search/search-videos.ts
@@ -4,9 +4,9 @@ import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { 5import {
6 cleanupTests, 6 cleanupTests,
7 flushAndRunServer, 7 createSingleServer,
8 SearchCommand, 8 SearchCommand,
9 ServerInfo, 9 PeerTubeServer,
10 setAccessTokensToServers, 10 setAccessTokensToServers,
11 setDefaultVideoChannel, 11 setDefaultVideoChannel,
12 stopFfmpeg, 12 stopFfmpeg,
@@ -17,7 +17,7 @@ import { VideoPrivacy } from '@shared/models'
17const expect = chai.expect 17const expect = chai.expect
18 18
19describe('Test videos search', function () { 19describe('Test videos search', function () {
20 let server: ServerInfo = null 20 let server: PeerTubeServer = null
21 let startDate: string 21 let startDate: string
22 let videoUUID: string 22 let videoUUID: string
23 23
@@ -26,7 +26,7 @@ describe('Test videos search', function () {
26 before(async function () { 26 before(async function () {
27 this.timeout(60000) 27 this.timeout(60000)
28 28
29 server = await flushAndRunServer(1) 29 server = await createSingleServer(1)
30 30
31 await setAccessTokensToServers([ server ]) 31 await setAccessTokensToServers([ server ])
32 await setDefaultVideoChannel([ server ]) 32 await setDefaultVideoChannel([ server ])
diff --git a/server/tests/api/server/auto-follows.ts b/server/tests/api/server/auto-follows.ts
index e9fb5b4b1..8dca2e5e5 100644
--- a/server/tests/api/server/auto-follows.ts
+++ b/server/tests/api/server/auto-follows.ts
@@ -4,9 +4,9 @@ import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { 5import {
6 cleanupTests, 6 cleanupTests,
7 flushAndRunMultipleServers, 7 createMultipleServers,
8 MockInstancesIndex, 8 MockInstancesIndex,
9 ServerInfo, 9 PeerTubeServer,
10 setAccessTokensToServers, 10 setAccessTokensToServers,
11 wait, 11 wait,
12 waitJobs 12 waitJobs
@@ -14,7 +14,7 @@ import {
14 14
15const expect = chai.expect 15const expect = chai.expect
16 16
17async function checkFollow (follower: ServerInfo, following: ServerInfo, exists: boolean) { 17async function checkFollow (follower: PeerTubeServer, following: PeerTubeServer, exists: boolean) {
18 { 18 {
19 const body = await following.follows.getFollowers({ start: 0, count: 5, sort: '-createdAt' }) 19 const body = await following.follows.getFollowers({ start: 0, count: 5, sort: '-createdAt' })
20 const follow = body.data.find(f => f.follower.host === follower.host && f.state === 'accepted') 20 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:
32 } 32 }
33} 33}
34 34
35async function server1Follows2 (servers: ServerInfo[]) { 35async function server1Follows2 (servers: PeerTubeServer[]) {
36 await servers[0].follows.follow({ targets: [ servers[1].host ] }) 36 await servers[0].follows.follow({ targets: [ servers[1].host ] })
37 37
38 await waitJobs(servers) 38 await waitJobs(servers)
39} 39}
40 40
41async function resetFollows (servers: ServerInfo[]) { 41async function resetFollows (servers: PeerTubeServer[]) {
42 try { 42 try {
43 await servers[0].follows.unfollow({ target: servers[1] }) 43 await servers[0].follows.unfollow({ target: servers[1] })
44 await servers[1].follows.unfollow({ target: servers[0] }) 44 await servers[1].follows.unfollow({ target: servers[0] })
@@ -52,12 +52,12 @@ async function resetFollows (servers: ServerInfo[]) {
52} 52}
53 53
54describe('Test auto follows', function () { 54describe('Test auto follows', function () {
55 let servers: ServerInfo[] = [] 55 let servers: PeerTubeServer[] = []
56 56
57 before(async function () { 57 before(async function () {
58 this.timeout(30000) 58 this.timeout(30000)
59 59
60 servers = await flushAndRunMultipleServers(3) 60 servers = await createMultipleServers(3)
61 61
62 // Get the access tokens 62 // Get the access tokens
63 await setAccessTokensToServers(servers) 63 await setAccessTokensToServers(servers)
diff --git a/server/tests/api/server/bulk.ts b/server/tests/api/server/bulk.ts
index acc17092d..5d8c87983 100644
--- a/server/tests/api/server/bulk.ts
+++ b/server/tests/api/server/bulk.ts
@@ -6,8 +6,8 @@ import {
6 BulkCommand, 6 BulkCommand,
7 cleanupTests, 7 cleanupTests,
8 doubleFollow, 8 doubleFollow,
9 flushAndRunMultipleServers, 9 createMultipleServers,
10 ServerInfo, 10 PeerTubeServer,
11 setAccessTokensToServers, 11 setAccessTokensToServers,
12 waitJobs 12 waitJobs
13} from '@shared/extra-utils' 13} from '@shared/extra-utils'
@@ -17,7 +17,7 @@ const expect = chai.expect
17describe('Test bulk actions', function () { 17describe('Test bulk actions', function () {
18 const commentsUser3: { videoId: number, commentId: number }[] = [] 18 const commentsUser3: { videoId: number, commentId: number }[] = []
19 19
20 let servers: ServerInfo[] = [] 20 let servers: PeerTubeServer[] = []
21 let user1Token: string 21 let user1Token: string
22 let user2Token: string 22 let user2Token: string
23 let user3Token: string 23 let user3Token: string
@@ -27,7 +27,7 @@ describe('Test bulk actions', function () {
27 before(async function () { 27 before(async function () {
28 this.timeout(30000) 28 this.timeout(30000)
29 29
30 servers = await flushAndRunMultipleServers(2) 30 servers = await createMultipleServers(2)
31 31
32 // Get the access tokens 32 // Get the access tokens
33 await setAccessTokensToServers(servers) 33 await setAccessTokensToServers(servers)
diff --git a/server/tests/api/server/config.ts b/server/tests/api/server/config.ts
index 479e177a8..a7191c5ef 100644
--- a/server/tests/api/server/config.ts
+++ b/server/tests/api/server/config.ts
@@ -5,19 +5,18 @@ import * as chai from 'chai'
5import { HttpStatusCode } from '@shared/core-utils' 5import { HttpStatusCode } from '@shared/core-utils'
6import { 6import {
7 cleanupTests, 7 cleanupTests,
8 flushAndRunServer, 8 createSingleServer,
9 killallServers, 9 killallServers,
10 makeGetRequest, 10 makeGetRequest,
11 parallelTests, 11 parallelTests,
12 reRunServer, 12 PeerTubeServer,
13 ServerInfo,
14 setAccessTokensToServers 13 setAccessTokensToServers
15} from '@shared/extra-utils' 14} from '@shared/extra-utils'
16import { CustomConfig } from '@shared/models' 15import { CustomConfig } from '@shared/models'
17 16
18const expect = chai.expect 17const expect = chai.expect
19 18
20function checkInitialConfig (server: ServerInfo, data: CustomConfig) { 19function checkInitialConfig (server: PeerTubeServer, data: CustomConfig) {
21 expect(data.instance.name).to.equal('PeerTube') 20 expect(data.instance.name).to.equal('PeerTube')
22 expect(data.instance.shortDescription).to.equal( 21 expect(data.instance.shortDescription).to.equal(
23 'PeerTube, an ActivityPub-federated video streaming platform using P2P directly in your web browser.' 22 'PeerTube, an ActivityPub-federated video streaming platform using P2P directly in your web browser.'
@@ -204,12 +203,12 @@ function checkUpdatedConfig (data: CustomConfig) {
204} 203}
205 204
206describe('Test config', function () { 205describe('Test config', function () {
207 let server: ServerInfo = null 206 let server: PeerTubeServer = null
208 207
209 before(async function () { 208 before(async function () {
210 this.timeout(30000) 209 this.timeout(30000)
211 210
212 server = await flushAndRunServer(1) 211 server = await createSingleServer(1)
213 await setAccessTokensToServers([ server ]) 212 await setAccessTokensToServers([ server ])
214 }) 213 })
215 214
@@ -456,7 +455,7 @@ describe('Test config', function () {
456 455
457 await killallServers([ server ]) 456 await killallServers([ server ])
458 457
459 await reRunServer(server) 458 await server.run()
460 459
461 const data = await server.config.getCustomConfig() 460 const data = await server.config.getCustomConfig()
462 461
@@ -512,7 +511,7 @@ describe('Test config', function () {
512 frameguard: { enabled: false } 511 frameguard: { enabled: false }
513 } 512 }
514 } 513 }
515 server = await reRunServer(server, config) 514 await server.run(config)
516 515
517 { 516 {
518 const res = await makeGetRequest({ 517 const res = await makeGetRequest({
diff --git a/server/tests/api/server/contact-form.ts b/server/tests/api/server/contact-form.ts
index 353fed80a..f0905bb3b 100644
--- a/server/tests/api/server/contact-form.ts
+++ b/server/tests/api/server/contact-form.ts
@@ -3,13 +3,21 @@
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { HttpStatusCode } from '@shared/core-utils' 5import { HttpStatusCode } from '@shared/core-utils'
6import { cleanupTests, flushAndRunServer, MockSmtpServer, ServerInfo, setAccessTokensToServers, wait, waitJobs } from '@shared/extra-utils' 6import {
7import { ContactFormCommand } from '@shared/extra-utils/server' 7 cleanupTests,
8 ContactFormCommand,
9 createSingleServer,
10 MockSmtpServer,
11 PeerTubeServer,
12 setAccessTokensToServers,
13 wait,
14 waitJobs
15} from '@shared/extra-utils'
8 16
9const expect = chai.expect 17const expect = chai.expect
10 18
11describe('Test contact form', function () { 19describe('Test contact form', function () {
12 let server: ServerInfo 20 let server: PeerTubeServer
13 const emails: object[] = [] 21 const emails: object[] = []
14 let command: ContactFormCommand 22 let command: ContactFormCommand
15 23
@@ -24,7 +32,7 @@ describe('Test contact form', function () {
24 port 32 port
25 } 33 }
26 } 34 }
27 server = await flushAndRunServer(1, overrideConfig) 35 server = await createSingleServer(1, overrideConfig)
28 await setAccessTokensToServers([ server ]) 36 await setAccessTokensToServers([ server ])
29 37
30 command = server.contactForm 38 command = server.contactForm
diff --git a/server/tests/api/server/email.ts b/server/tests/api/server/email.ts
index 258e835e7..b202cf8a7 100644
--- a/server/tests/api/server/email.ts
+++ b/server/tests/api/server/email.ts
@@ -3,12 +3,12 @@
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { HttpStatusCode } from '@shared/core-utils' 5import { HttpStatusCode } from '@shared/core-utils'
6import { cleanupTests, flushAndRunServer, MockSmtpServer, ServerInfo, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' 6import { cleanupTests, createSingleServer, MockSmtpServer, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
7 7
8const expect = chai.expect 8const expect = chai.expect
9 9
10describe('Test emails', function () { 10describe('Test emails', function () {
11 let server: ServerInfo 11 let server: PeerTubeServer
12 let userId: number 12 let userId: number
13 let userId2: number 13 let userId2: number
14 let userAccessToken: string 14 let userAccessToken: string
@@ -39,7 +39,7 @@ describe('Test emails', function () {
39 port: emailPort 39 port: emailPort
40 } 40 }
41 } 41 }
42 server = await flushAndRunServer(1, overrideConfig) 42 server = await createSingleServer(1, overrideConfig)
43 await setAccessTokensToServers([ server ]) 43 await setAccessTokensToServers([ server ])
44 44
45 { 45 {
diff --git a/server/tests/api/server/follow-constraints.ts b/server/tests/api/server/follow-constraints.ts
index 887e400e9..4ed593b76 100644
--- a/server/tests/api/server/follow-constraints.ts
+++ b/server/tests/api/server/follow-constraints.ts
@@ -3,13 +3,13 @@
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { HttpStatusCode } from '@shared/core-utils' 5import { HttpStatusCode } from '@shared/core-utils'
6import { cleanupTests, doubleFollow, flushAndRunMultipleServers, ServerInfo, setAccessTokensToServers } from '@shared/extra-utils' 6import { cleanupTests, doubleFollow, createMultipleServers, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils'
7import { PeerTubeProblemDocument, ServerErrorCode } from '@shared/models' 7import { PeerTubeProblemDocument, ServerErrorCode } from '@shared/models'
8 8
9const expect = chai.expect 9const expect = chai.expect
10 10
11describe('Test follow constraints', function () { 11describe('Test follow constraints', function () {
12 let servers: ServerInfo[] = [] 12 let servers: PeerTubeServer[] = []
13 let video1UUID: string 13 let video1UUID: string
14 let video2UUID: string 14 let video2UUID: string
15 let userToken: string 15 let userToken: string
@@ -17,7 +17,7 @@ describe('Test follow constraints', function () {
17 before(async function () { 17 before(async function () {
18 this.timeout(90000) 18 this.timeout(90000)
19 19
20 servers = await flushAndRunMultipleServers(2) 20 servers = await createMultipleServers(2)
21 21
22 // Get the access tokens 22 // Get the access tokens
23 await setAccessTokensToServers(servers) 23 await setAccessTokensToServers(servers)
diff --git a/server/tests/api/server/follows-moderation.ts b/server/tests/api/server/follows-moderation.ts
index 045024544..0aa328c5a 100644
--- a/server/tests/api/server/follows-moderation.ts
+++ b/server/tests/api/server/follows-moderation.ts
@@ -4,16 +4,16 @@ import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { 5import {
6 cleanupTests, 6 cleanupTests,
7 flushAndRunMultipleServers, 7 createMultipleServers,
8 FollowsCommand, 8 FollowsCommand,
9 ServerInfo, 9 PeerTubeServer,
10 setAccessTokensToServers, 10 setAccessTokensToServers,
11 waitJobs 11 waitJobs
12} from '@shared/extra-utils' 12} from '@shared/extra-utils'
13 13
14const expect = chai.expect 14const expect = chai.expect
15 15
16async function checkServer1And2HasFollowers (servers: ServerInfo[], state = 'accepted') { 16async function checkServer1And2HasFollowers (servers: PeerTubeServer[], state = 'accepted') {
17 const fns = [ 17 const fns = [
18 servers[0].follows.getFollowings.bind(servers[0].follows), 18 servers[0].follows.getFollowings.bind(servers[0].follows),
19 servers[1].follows.getFollowers.bind(servers[1].follows) 19 servers[1].follows.getFollowers.bind(servers[1].follows)
@@ -30,7 +30,7 @@ async function checkServer1And2HasFollowers (servers: ServerInfo[], state = 'acc
30 } 30 }
31} 31}
32 32
33async function checkNoFollowers (servers: ServerInfo[]) { 33async function checkNoFollowers (servers: PeerTubeServer[]) {
34 const fns = [ 34 const fns = [
35 servers[0].follows.getFollowings.bind(servers[0].follows), 35 servers[0].follows.getFollowings.bind(servers[0].follows),
36 servers[1].follows.getFollowers.bind(servers[1].follows) 36 servers[1].follows.getFollowers.bind(servers[1].follows)
@@ -43,13 +43,13 @@ async function checkNoFollowers (servers: ServerInfo[]) {
43} 43}
44 44
45describe('Test follows moderation', function () { 45describe('Test follows moderation', function () {
46 let servers: ServerInfo[] = [] 46 let servers: PeerTubeServer[] = []
47 let commands: FollowsCommand[] 47 let commands: FollowsCommand[]
48 48
49 before(async function () { 49 before(async function () {
50 this.timeout(30000) 50 this.timeout(30000)
51 51
52 servers = await flushAndRunMultipleServers(3) 52 servers = await createMultipleServers(3)
53 53
54 // Get the access tokens 54 // Get the access tokens
55 await setAccessTokensToServers(servers) 55 await setAccessTokensToServers(servers)
diff --git a/server/tests/api/server/follows.ts b/server/tests/api/server/follows.ts
index d43064689..8856177b8 100644
--- a/server/tests/api/server/follows.ts
+++ b/server/tests/api/server/follows.ts
@@ -7,9 +7,9 @@ import {
7 completeVideoCheck, 7 completeVideoCheck,
8 dateIsValid, 8 dateIsValid,
9 expectAccountFollows, 9 expectAccountFollows,
10 flushAndRunMultipleServers, 10 createMultipleServers,
11 FollowsCommand, 11 FollowsCommand,
12 ServerInfo, 12 PeerTubeServer,
13 setAccessTokensToServers, 13 setAccessTokensToServers,
14 testCaptionFile, 14 testCaptionFile,
15 waitJobs 15 waitJobs
@@ -19,13 +19,13 @@ import { Video, VideoPrivacy } from '@shared/models'
19const expect = chai.expect 19const expect = chai.expect
20 20
21describe('Test follows', function () { 21describe('Test follows', function () {
22 let servers: ServerInfo[] = [] 22 let servers: PeerTubeServer[] = []
23 let followsCommands: FollowsCommand[] 23 let followsCommands: FollowsCommand[]
24 24
25 before(async function () { 25 before(async function () {
26 this.timeout(30000) 26 this.timeout(30000)
27 27
28 servers = await flushAndRunMultipleServers(3) 28 servers = await createMultipleServers(3)
29 followsCommands = servers.map(s => s.follows) 29 followsCommands = servers.map(s => s.follows)
30 30
31 // Get the access tokens 31 // Get the access tokens
diff --git a/server/tests/api/server/handle-down.ts b/server/tests/api/server/handle-down.ts
index de3dee826..5f20b0093 100644
--- a/server/tests/api/server/handle-down.ts
+++ b/server/tests/api/server/handle-down.ts
@@ -7,10 +7,9 @@ import {
7 cleanupTests, 7 cleanupTests,
8 CommentsCommand, 8 CommentsCommand,
9 completeVideoCheck, 9 completeVideoCheck,
10 flushAndRunMultipleServers, 10 createMultipleServers,
11 killallServers, 11 killallServers,
12 reRunServer, 12 PeerTubeServer,
13 ServerInfo,
14 setAccessTokensToServers, 13 setAccessTokensToServers,
15 wait, 14 wait,
16 waitJobs 15 waitJobs
@@ -20,7 +19,7 @@ import { JobState, VideoCreateResult, VideoPrivacy } from '@shared/models'
20const expect = chai.expect 19const expect = chai.expect
21 20
22describe('Test handle downs', function () { 21describe('Test handle downs', function () {
23 let servers: ServerInfo[] = [] 22 let servers: PeerTubeServer[] = []
24 let threadIdServer1: number 23 let threadIdServer1: number
25 let threadIdServer2: number 24 let threadIdServer2: number
26 let commentIdServer1: number 25 let commentIdServer1: number
@@ -54,7 +53,7 @@ describe('Test handle downs', function () {
54 before(async function () { 53 before(async function () {
55 this.timeout(30000) 54 this.timeout(30000)
56 55
57 servers = await flushAndRunMultipleServers(3) 56 servers = await createMultipleServers(3)
58 commentCommands = servers.map(s => s.comments) 57 commentCommands = servers.map(s => s.comments)
59 58
60 checkAttributes = { 59 checkAttributes = {
@@ -176,8 +175,8 @@ describe('Test handle downs', function () {
176 it('Should re-follow server 1', async function () { 175 it('Should re-follow server 1', async function () {
177 this.timeout(35000) 176 this.timeout(35000)
178 177
179 await reRunServer(servers[1]) 178 await servers[1].run()
180 await reRunServer(servers[2]) 179 await servers[2].run()
181 180
182 await servers[1].follows.unfollow({ target: servers[0] }) 181 await servers[1].follows.unfollow({ target: servers[0] })
183 await waitJobs(servers) 182 await waitJobs(servers)
diff --git a/server/tests/api/server/homepage.ts b/server/tests/api/server/homepage.ts
index aac075321..c291037f2 100644
--- a/server/tests/api/server/homepage.ts
+++ b/server/tests/api/server/homepage.ts
@@ -6,29 +6,28 @@ import { HttpStatusCode } from '@shared/core-utils'
6import { 6import {
7 cleanupTests, 7 cleanupTests,
8 CustomPagesCommand, 8 CustomPagesCommand,
9 flushAndRunServer, 9 createSingleServer,
10 killallServers, 10 killallServers,
11 reRunServer, 11 PeerTubeServer,
12 ServerInfo,
13 setAccessTokensToServers 12 setAccessTokensToServers
14} from '../../../../shared/extra-utils/index' 13} from '../../../../shared/extra-utils/index'
15 14
16const expect = chai.expect 15const expect = chai.expect
17 16
18async function getHomepageState (server: ServerInfo) { 17async function getHomepageState (server: PeerTubeServer) {
19 const config = await server.config.getConfig() 18 const config = await server.config.getConfig()
20 19
21 return config.homepage.enabled 20 return config.homepage.enabled
22} 21}
23 22
24describe('Test instance homepage actions', function () { 23describe('Test instance homepage actions', function () {
25 let server: ServerInfo 24 let server: PeerTubeServer
26 let command: CustomPagesCommand 25 let command: CustomPagesCommand
27 26
28 before(async function () { 27 before(async function () {
29 this.timeout(30000) 28 this.timeout(30000)
30 29
31 server = await flushAndRunServer(1) 30 server = await createSingleServer(1)
32 await setAccessTokensToServers([ server ]) 31 await setAccessTokensToServers([ server ])
33 32
34 command = server.customPage 33 command = server.customPage
@@ -56,7 +55,7 @@ describe('Test instance homepage actions', function () {
56 55
57 await killallServers([ server ]) 56 await killallServers([ server ])
58 57
59 await reRunServer(server) 58 await server.run()
60 59
61 const page = await command.getInstanceHomepage() 60 const page = await command.getInstanceHomepage()
62 expect(page.content).to.equal('<picsou-magazine></picsou-magazine>') 61 expect(page.content).to.equal('<picsou-magazine></picsou-magazine>')
diff --git a/server/tests/api/server/jobs.ts b/server/tests/api/server/jobs.ts
index 0c44e4dad..376cd10d0 100644
--- a/server/tests/api/server/jobs.ts
+++ b/server/tests/api/server/jobs.ts
@@ -6,8 +6,8 @@ import {
6 cleanupTests, 6 cleanupTests,
7 dateIsValid, 7 dateIsValid,
8 doubleFollow, 8 doubleFollow,
9 flushAndRunMultipleServers, 9 createMultipleServers,
10 ServerInfo, 10 PeerTubeServer,
11 setAccessTokensToServers, 11 setAccessTokensToServers,
12 waitJobs 12 waitJobs
13} from '@shared/extra-utils' 13} from '@shared/extra-utils'
@@ -15,12 +15,12 @@ import {
15const expect = chai.expect 15const expect = chai.expect
16 16
17describe('Test jobs', function () { 17describe('Test jobs', function () {
18 let servers: ServerInfo[] 18 let servers: PeerTubeServer[]
19 19
20 before(async function () { 20 before(async function () {
21 this.timeout(30000) 21 this.timeout(30000)
22 22
23 servers = await flushAndRunMultipleServers(2) 23 servers = await createMultipleServers(2)
24 24
25 await setAccessTokensToServers(servers) 25 await setAccessTokensToServers(servers)
26 26
diff --git a/server/tests/api/server/logs.ts b/server/tests/api/server/logs.ts
index 2d141fd8c..bcd94dda3 100644
--- a/server/tests/api/server/logs.ts
+++ b/server/tests/api/server/logs.ts
@@ -4,11 +4,10 @@ import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { 5import {
6 cleanupTests, 6 cleanupTests,
7 flushAndRunServer, 7 createSingleServer,
8 killallServers, 8 killallServers,
9 LogsCommand, 9 LogsCommand,
10 reRunServer, 10 PeerTubeServer,
11 ServerInfo,
12 setAccessTokensToServers, 11 setAccessTokensToServers,
13 waitJobs 12 waitJobs
14} from '@shared/extra-utils' 13} from '@shared/extra-utils'
@@ -16,13 +15,13 @@ import {
16const expect = chai.expect 15const expect = chai.expect
17 16
18describe('Test logs', function () { 17describe('Test logs', function () {
19 let server: ServerInfo 18 let server: PeerTubeServer
20 let logsCommand: LogsCommand 19 let logsCommand: LogsCommand
21 20
22 before(async function () { 21 before(async function () {
23 this.timeout(30000) 22 this.timeout(30000)
24 23
25 server = await flushAndRunServer(1) 24 server = await createSingleServer(1)
26 await setAccessTokensToServers([ server ]) 25 await setAccessTokensToServers([ server ])
27 26
28 logsCommand = server.logs 27 logsCommand = server.logs
@@ -113,7 +112,7 @@ describe('Test logs', function () {
113 112
114 await killallServers([ server ]) 113 await killallServers([ server ])
115 114
116 await reRunServer(server, { log: { log_ping_requests: false } }) 115 await server.run({ log: { log_ping_requests: false } })
117 116
118 const now = new Date() 117 const now = new Date()
119 118
diff --git a/server/tests/api/server/no-client.ts b/server/tests/api/server/no-client.ts
index d589f51f3..f45222f2f 100644
--- a/server/tests/api/server/no-client.ts
+++ b/server/tests/api/server/no-client.ts
@@ -1,16 +1,16 @@
1import 'mocha' 1import 'mocha'
2import * as request from 'supertest' 2import * as request from 'supertest'
3import { ServerInfo } from '../../../../shared/extra-utils' 3import { PeerTubeServer } from '../../../../shared/extra-utils'
4import { cleanupTests, flushAndRunServer } from '../../../../shared/extra-utils/server/servers' 4import { cleanupTests, createSingleServer } from '../../../../shared/extra-utils/server/servers'
5import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' 5import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
6 6
7describe('Start and stop server without web client routes', function () { 7describe('Start and stop server without web client routes', function () {
8 let server: ServerInfo 8 let server: PeerTubeServer
9 9
10 before(async function () { 10 before(async function () {
11 this.timeout(30000) 11 this.timeout(30000)
12 12
13 server = await flushAndRunServer(1, {}, [ '--no-client' ]) 13 server = await createSingleServer(1, {}, [ '--no-client' ])
14 }) 14 })
15 15
16 it('Should fail getting the client', function () { 16 it('Should fail getting the client', function () {
diff --git a/server/tests/api/server/plugins.ts b/server/tests/api/server/plugins.ts
index 45a22e48d..db03d026a 100644
--- a/server/tests/api/server/plugins.ts
+++ b/server/tests/api/server/plugins.ts
@@ -5,11 +5,10 @@ import * as chai from 'chai'
5import { HttpStatusCode } from '@shared/core-utils' 5import { HttpStatusCode } from '@shared/core-utils'
6import { 6import {
7 cleanupTests, 7 cleanupTests,
8 flushAndRunServer, 8 createSingleServer,
9 killallServers, 9 killallServers,
10 PluginsCommand, 10 PluginsCommand,
11 reRunServer, 11 PeerTubeServer,
12 ServerInfo,
13 setAccessTokensToServers, 12 setAccessTokensToServers,
14 testHelloWorldRegisteredSettings, 13 testHelloWorldRegisteredSettings,
15 wait 14 wait
@@ -19,7 +18,7 @@ import { PluginType } from '@shared/models'
19const expect = chai.expect 18const expect = chai.expect
20 19
21describe('Test plugins', function () { 20describe('Test plugins', function () {
22 let server: ServerInfo = null 21 let server: PeerTubeServer = null
23 let command: PluginsCommand 22 let command: PluginsCommand
24 23
25 before(async function () { 24 before(async function () {
@@ -30,7 +29,7 @@ describe('Test plugins', function () {
30 index: { check_latest_versions_interval: '5 seconds' } 29 index: { check_latest_versions_interval: '5 seconds' }
31 } 30 }
32 } 31 }
33 server = await flushAndRunServer(1, configOverride) 32 server = await createSingleServer(1, configOverride)
34 await setAccessTokensToServers([ server ]) 33 await setAccessTokensToServers([ server ])
35 34
36 command = server.plugins 35 command = server.plugins
@@ -245,7 +244,7 @@ describe('Test plugins', function () {
245 244
246 // Restart the server to take into account this change 245 // Restart the server to take into account this change
247 await killallServers([ server ]) 246 await killallServers([ server ])
248 await reRunServer(server) 247 await server.run()
249 248
250 { 249 {
251 const body = await command.list({ pluginType: PluginType.PLUGIN }) 250 const body = await command.list({ pluginType: PluginType.PLUGIN })
@@ -326,7 +325,7 @@ describe('Test plugins', function () {
326 await check() 325 await check()
327 326
328 await killallServers([ server ]) 327 await killallServers([ server ])
329 await reRunServer(server) 328 await server.run()
330 329
331 await check() 330 await check()
332 }) 331 })
diff --git a/server/tests/api/server/reverse-proxy.ts b/server/tests/api/server/reverse-proxy.ts
index de3cf02f2..c20b7a5f0 100644
--- a/server/tests/api/server/reverse-proxy.ts
+++ b/server/tests/api/server/reverse-proxy.ts
@@ -2,10 +2,10 @@
2 2
3import { expect } from 'chai' 3import { expect } from 'chai'
4import { HttpStatusCode } from '@shared/core-utils' 4import { HttpStatusCode } from '@shared/core-utils'
5import { cleanupTests, flushAndRunServer, ServerInfo, setAccessTokensToServers, wait } from '@shared/extra-utils' 5import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers, wait } from '@shared/extra-utils'
6 6
7describe('Test application behind a reverse proxy', function () { 7describe('Test application behind a reverse proxy', function () {
8 let server: ServerInfo 8 let server: PeerTubeServer
9 let videoId: string 9 let videoId: string
10 10
11 before(async function () { 11 before(async function () {
@@ -30,7 +30,7 @@ describe('Test application behind a reverse proxy', function () {
30 } 30 }
31 } 31 }
32 32
33 server = await flushAndRunServer(1, config) 33 server = await createSingleServer(1, config)
34 await setAccessTokensToServers([ server ]) 34 await setAccessTokensToServers([ server ])
35 35
36 const { uuid } = await server.videos.upload() 36 const { uuid } = await server.videos.upload()
diff --git a/server/tests/api/server/services.ts b/server/tests/api/server/services.ts
index 28f9ae3b6..69d030dbb 100644
--- a/server/tests/api/server/services.ts
+++ b/server/tests/api/server/services.ts
@@ -2,13 +2,13 @@
2 2
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { cleanupTests, flushAndRunServer, ServerInfo, setAccessTokensToServers, setDefaultVideoChannel } from '@shared/extra-utils' 5import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers, setDefaultVideoChannel } from '@shared/extra-utils'
6import { Video, VideoPlaylistPrivacy } from '@shared/models' 6import { Video, VideoPlaylistPrivacy } from '@shared/models'
7 7
8const expect = chai.expect 8const expect = chai.expect
9 9
10describe('Test services', function () { 10describe('Test services', function () {
11 let server: ServerInfo = null 11 let server: PeerTubeServer = null
12 let playlistUUID: string 12 let playlistUUID: string
13 let playlistDisplayName: string 13 let playlistDisplayName: string
14 let video: Video 14 let video: Video
@@ -16,7 +16,7 @@ describe('Test services', function () {
16 before(async function () { 16 before(async function () {
17 this.timeout(30000) 17 this.timeout(30000)
18 18
19 server = await flushAndRunServer(1) 19 server = await createSingleServer(1)
20 20
21 await setAccessTokensToServers([ server ]) 21 await setAccessTokensToServers([ server ])
22 await setDefaultVideoChannel([ server ]) 22 await setDefaultVideoChannel([ server ])
diff --git a/server/tests/api/server/stats.ts b/server/tests/api/server/stats.ts
index be5abad52..f07d0fd39 100644
--- a/server/tests/api/server/stats.ts
+++ b/server/tests/api/server/stats.ts
@@ -5,8 +5,8 @@ import * as chai from 'chai'
5import { 5import {
6 cleanupTests, 6 cleanupTests,
7 doubleFollow, 7 doubleFollow,
8 flushAndRunMultipleServers, 8 createMultipleServers,
9 ServerInfo, 9 PeerTubeServer,
10 setAccessTokensToServers, 10 setAccessTokensToServers,
11 wait, 11 wait,
12 waitJobs 12 waitJobs
@@ -16,7 +16,7 @@ import { ActivityType, VideoPlaylistPrivacy } from '@shared/models'
16const expect = chai.expect 16const expect = chai.expect
17 17
18describe('Test stats (excluding redundancy)', function () { 18describe('Test stats (excluding redundancy)', function () {
19 let servers: ServerInfo[] = [] 19 let servers: PeerTubeServer[] = []
20 let channelId 20 let channelId
21 const user = { 21 const user = {
22 username: 'user1', 22 username: 'user1',
@@ -26,7 +26,7 @@ describe('Test stats (excluding redundancy)', function () {
26 before(async function () { 26 before(async function () {
27 this.timeout(60000) 27 this.timeout(60000)
28 28
29 servers = await flushAndRunMultipleServers(3) 29 servers = await createMultipleServers(3)
30 30
31 await setAccessTokensToServers(servers) 31 await setAccessTokensToServers(servers)
32 32
diff --git a/server/tests/api/server/tracker.ts b/server/tests/api/server/tracker.ts
index d80362fee..f597ac60c 100644
--- a/server/tests/api/server/tracker.ts
+++ b/server/tests/api/server/tracker.ts
@@ -3,16 +3,16 @@
3import 'mocha' 3import 'mocha'
4import * as magnetUtil from 'magnet-uri' 4import * as magnetUtil from 'magnet-uri'
5import * as WebTorrent from 'webtorrent' 5import * as WebTorrent from 'webtorrent'
6import { cleanupTests, flushAndRunServer, killallServers, reRunServer, ServerInfo, setAccessTokensToServers } from '@shared/extra-utils' 6import { cleanupTests, createSingleServer, killallServers, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils'
7 7
8describe('Test tracker', function () { 8describe('Test tracker', function () {
9 let server: ServerInfo 9 let server: PeerTubeServer
10 let badMagnet: string 10 let badMagnet: string
11 let goodMagnet: string 11 let goodMagnet: string
12 12
13 before(async function () { 13 before(async function () {
14 this.timeout(60000) 14 this.timeout(60000)
15 server = await flushAndRunServer(1) 15 server = await createSingleServer(1)
16 await setAccessTokensToServers([ server ]) 16 await setAccessTokensToServers([ server ])
17 17
18 { 18 {
@@ -48,7 +48,7 @@ describe('Test tracker', function () {
48 const errCb = () => done(new Error('Tracker is enabled')) 48 const errCb = () => done(new Error('Tracker is enabled'))
49 49
50 killallServers([ server ]) 50 killallServers([ server ])
51 .then(() => reRunServer(server, { tracker: { enabled: false } })) 51 .then(() => server.run({ tracker: { enabled: false } }))
52 .then(() => { 52 .then(() => {
53 const webtorrent = new WebTorrent() 53 const webtorrent = new WebTorrent()
54 54
@@ -72,7 +72,7 @@ describe('Test tracker', function () {
72 this.timeout(20000) 72 this.timeout(20000)
73 73
74 killallServers([ server ]) 74 killallServers([ server ])
75 .then(() => reRunServer(server)) 75 .then(() => server.run())
76 .then(() => { 76 .then(() => {
77 const webtorrent = new WebTorrent() 77 const webtorrent = new WebTorrent()
78 78
diff --git a/server/tests/api/users/user-subscriptions.ts b/server/tests/api/users/user-subscriptions.ts
index 1b15a98dc..d2bb9c387 100644
--- a/server/tests/api/users/user-subscriptions.ts
+++ b/server/tests/api/users/user-subscriptions.ts
@@ -5,8 +5,8 @@ import * as chai from 'chai'
5import { 5import {
6 cleanupTests, 6 cleanupTests,
7 doubleFollow, 7 doubleFollow,
8 flushAndRunMultipleServers, 8 createMultipleServers,
9 ServerInfo, 9 PeerTubeServer,
10 setAccessTokensToServers, 10 setAccessTokensToServers,
11 SubscriptionsCommand, 11 SubscriptionsCommand,
12 waitJobs 12 waitJobs
@@ -15,7 +15,7 @@ import {
15const expect = chai.expect 15const expect = chai.expect
16 16
17describe('Test users subscriptions', function () { 17describe('Test users subscriptions', function () {
18 let servers: ServerInfo[] = [] 18 let servers: PeerTubeServer[] = []
19 const users: { accessToken: string }[] = [] 19 const users: { accessToken: string }[] = []
20 let video3UUID: string 20 let video3UUID: string
21 21
@@ -24,7 +24,7 @@ describe('Test users subscriptions', function () {
24 before(async function () { 24 before(async function () {
25 this.timeout(120000) 25 this.timeout(120000)
26 26
27 servers = await flushAndRunMultipleServers(3) 27 servers = await createMultipleServers(3)
28 28
29 // Get the access tokens 29 // Get the access tokens
30 await setAccessTokensToServers(servers) 30 await setAccessTokensToServers(servers)
diff --git a/server/tests/api/users/users-multiple-servers.ts b/server/tests/api/users/users-multiple-servers.ts
index f8d7ae88e..e629966bb 100644
--- a/server/tests/api/users/users-multiple-servers.ts
+++ b/server/tests/api/users/users-multiple-servers.ts
@@ -8,8 +8,8 @@ import {
8 checkVideoFilesWereRemoved, 8 checkVideoFilesWereRemoved,
9 cleanupTests, 9 cleanupTests,
10 doubleFollow, 10 doubleFollow,
11 flushAndRunMultipleServers, 11 createMultipleServers,
12 ServerInfo, 12 PeerTubeServer,
13 setAccessTokensToServers, 13 setAccessTokensToServers,
14 testImage, 14 testImage,
15 waitJobs 15 waitJobs
@@ -19,7 +19,7 @@ import { User } from '@shared/models'
19const expect = chai.expect 19const expect = chai.expect
20 20
21describe('Test users with multiple servers', function () { 21describe('Test users with multiple servers', function () {
22 let servers: ServerInfo[] = [] 22 let servers: PeerTubeServer[] = []
23 let user: User 23 let user: User
24 let userId: number 24 let userId: number
25 let videoUUID: string 25 let videoUUID: string
@@ -29,7 +29,7 @@ describe('Test users with multiple servers', function () {
29 before(async function () { 29 before(async function () {
30 this.timeout(120_000) 30 this.timeout(120_000)
31 31
32 servers = await flushAndRunMultipleServers(3) 32 servers = await createMultipleServers(3)
33 33
34 // Get the access tokens 34 // Get the access tokens
35 await setAccessTokensToServers(servers) 35 await setAccessTokensToServers(servers)
diff --git a/server/tests/api/users/users-verification.ts b/server/tests/api/users/users-verification.ts
index c8c226fa8..5dbe2af59 100644
--- a/server/tests/api/users/users-verification.ts
+++ b/server/tests/api/users/users-verification.ts
@@ -3,12 +3,12 @@
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { HttpStatusCode } from '@shared/core-utils' 5import { HttpStatusCode } from '@shared/core-utils'
6import { cleanupTests, flushAndRunServer, MockSmtpServer, ServerInfo, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' 6import { cleanupTests, createSingleServer, MockSmtpServer, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
7 7
8const expect = chai.expect 8const expect = chai.expect
9 9
10describe('Test users account verification', function () { 10describe('Test users account verification', function () {
11 let server: ServerInfo 11 let server: PeerTubeServer
12 let userId: number 12 let userId: number
13 let userAccessToken: string 13 let userAccessToken: string
14 let verificationString: string 14 let verificationString: string
@@ -34,7 +34,7 @@ describe('Test users account verification', function () {
34 port 34 port
35 } 35 }
36 } 36 }
37 server = await flushAndRunServer(1, overrideConfig) 37 server = await createSingleServer(1, overrideConfig)
38 38
39 await setAccessTokensToServers([ server ]) 39 await setAccessTokensToServers([ server ])
40 }) 40 })
diff --git a/server/tests/api/users/users.ts b/server/tests/api/users/users.ts
index 310136a37..6ae5410b3 100644
--- a/server/tests/api/users/users.ts
+++ b/server/tests/api/users/users.ts
@@ -5,11 +5,10 @@ import * as chai from 'chai'
5import { HttpStatusCode } from '@shared/core-utils' 5import { HttpStatusCode } from '@shared/core-utils'
6import { 6import {
7 cleanupTests, 7 cleanupTests,
8 flushAndRunServer, 8 createSingleServer,
9 killallServers, 9 killallServers,
10 makePutBodyRequest, 10 makePutBodyRequest,
11 reRunServer, 11 PeerTubeServer,
12 ServerInfo,
13 setAccessTokensToServers, 12 setAccessTokensToServers,
14 testImage, 13 testImage,
15 waitJobs 14 waitJobs
@@ -19,7 +18,7 @@ import { AbuseState, OAuth2ErrorCode, UserAdminFlag, UserRole, Video, VideoPlayl
19const expect = chai.expect 18const expect = chai.expect
20 19
21describe('Test users', function () { 20describe('Test users', function () {
22 let server: ServerInfo 21 let server: PeerTubeServer
23 let token: string 22 let token: string
24 let userToken: string 23 let userToken: string
25 let videoId: number 24 let videoId: number
@@ -32,7 +31,7 @@ describe('Test users', function () {
32 before(async function () { 31 before(async function () {
33 this.timeout(30000) 32 this.timeout(30000)
34 33
35 server = await flushAndRunServer(1, { 34 server = await createSingleServer(1, {
36 rates_limit: { 35 rates_limit: {
37 login: { 36 login: {
38 max: 30 37 max: 30
@@ -238,7 +237,7 @@ describe('Test users', function () {
238 await server.sql.setTokenField(server.accessToken, 'refreshTokenExpiresAt', new Date().toISOString()) 237 await server.sql.setTokenField(server.accessToken, 'refreshTokenExpiresAt', new Date().toISOString())
239 238
240 await killallServers([ server ]) 239 await killallServers([ server ])
241 await reRunServer(server) 240 await server.run()
242 241
243 await server.users.getMyInfo({ expectedStatus: HttpStatusCode.UNAUTHORIZED_401 }) 242 await server.users.getMyInfo({ expectedStatus: HttpStatusCode.UNAUTHORIZED_401 })
244 }) 243 })
@@ -254,7 +253,7 @@ describe('Test users', function () {
254 await server.sql.setTokenField(server.accessToken, 'refreshTokenExpiresAt', futureDate) 253 await server.sql.setTokenField(server.accessToken, 'refreshTokenExpiresAt', futureDate)
255 254
256 await killallServers([ server ]) 255 await killallServers([ server ])
257 await reRunServer(server) 256 await server.run()
258 257
259 const res = await server.login.refreshToken({ refreshToken: server.refreshToken }) 258 const res = await server.login.refreshToken({ refreshToken: server.refreshToken })
260 server.accessToken = res.body.access_token 259 server.accessToken = res.body.access_token
diff --git a/server/tests/api/videos/audio-only.ts b/server/tests/api/videos/audio-only.ts
index b2952e38b..b9bf96650 100644
--- a/server/tests/api/videos/audio-only.ts
+++ b/server/tests/api/videos/audio-only.ts
@@ -4,12 +4,12 @@ import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { join } from 'path' 5import { join } from 'path'
6import { getAudioStream, getVideoStreamSize } from '@server/helpers/ffprobe-utils' 6import { getAudioStream, getVideoStreamSize } from '@server/helpers/ffprobe-utils'
7import { cleanupTests, doubleFollow, flushAndRunMultipleServers, ServerInfo, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' 7import { cleanupTests, doubleFollow, createMultipleServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
8 8
9const expect = chai.expect 9const expect = chai.expect
10 10
11describe('Test audio only video transcoding', function () { 11describe('Test audio only video transcoding', function () {
12 let servers: ServerInfo[] = [] 12 let servers: PeerTubeServer[] = []
13 let videoUUID: string 13 let videoUUID: string
14 14
15 before(async function () { 15 before(async function () {
@@ -36,7 +36,7 @@ describe('Test audio only video transcoding', function () {
36 } 36 }
37 } 37 }
38 } 38 }
39 servers = await flushAndRunMultipleServers(2, configOverride) 39 servers = await createMultipleServers(2, configOverride)
40 40
41 // Get the access tokens 41 // Get the access tokens
42 await setAccessTokensToServers(servers) 42 await setAccessTokensToServers(servers)
diff --git a/server/tests/api/videos/multiple-servers.ts b/server/tests/api/videos/multiple-servers.ts
index 89d842307..562079a15 100644
--- a/server/tests/api/videos/multiple-servers.ts
+++ b/server/tests/api/videos/multiple-servers.ts
@@ -12,8 +12,8 @@ import {
12 completeVideoCheck, 12 completeVideoCheck,
13 dateIsValid, 13 dateIsValid,
14 doubleFollow, 14 doubleFollow,
15 flushAndRunMultipleServers, 15 createMultipleServers,
16 ServerInfo, 16 PeerTubeServer,
17 setAccessTokensToServers, 17 setAccessTokensToServers,
18 testImage, 18 testImage,
19 wait, 19 wait,
@@ -25,7 +25,7 @@ import { VideoCommentThreadTree, VideoPrivacy } from '@shared/models'
25const expect = chai.expect 25const expect = chai.expect
26 26
27describe('Test multiple servers', function () { 27describe('Test multiple servers', function () {
28 let servers: ServerInfo[] = [] 28 let servers: PeerTubeServer[] = []
29 const toRemove = [] 29 const toRemove = []
30 let videoUUID = '' 30 let videoUUID = ''
31 let videoChannelId: number 31 let videoChannelId: number
@@ -33,7 +33,7 @@ describe('Test multiple servers', function () {
33 before(async function () { 33 before(async function () {
34 this.timeout(120000) 34 this.timeout(120000)
35 35
36 servers = await flushAndRunMultipleServers(3) 36 servers = await createMultipleServers(3)
37 37
38 // Get the access tokens 38 // Get the access tokens
39 await setAccessTokensToServers(servers) 39 await setAccessTokensToServers(servers)
diff --git a/server/tests/api/videos/resumable-upload.ts b/server/tests/api/videos/resumable-upload.ts
index 2f1cf8a55..b4fc5ee09 100644
--- a/server/tests/api/videos/resumable-upload.ts
+++ b/server/tests/api/videos/resumable-upload.ts
@@ -8,8 +8,8 @@ import { HttpStatusCode } from '@shared/core-utils'
8import { 8import {
9 buildAbsoluteFixturePath, 9 buildAbsoluteFixturePath,
10 cleanupTests, 10 cleanupTests,
11 flushAndRunServer, 11 createSingleServer,
12 ServerInfo, 12 PeerTubeServer,
13 setAccessTokensToServers, 13 setAccessTokensToServers,
14 setDefaultVideoChannel 14 setDefaultVideoChannel
15} from '@shared/extra-utils' 15} from '@shared/extra-utils'
@@ -21,7 +21,7 @@ const expect = chai.expect
21 21
22describe('Test resumable upload', function () { 22describe('Test resumable upload', function () {
23 const defaultFixture = 'video_short.mp4' 23 const defaultFixture = 'video_short.mp4'
24 let server: ServerInfo 24 let server: PeerTubeServer
25 let rootId: number 25 let rootId: number
26 26
27 async function buildSize (fixture: string, size?: number) { 27 async function buildSize (fixture: string, size?: number) {
@@ -99,7 +99,7 @@ describe('Test resumable upload', function () {
99 before(async function () { 99 before(async function () {
100 this.timeout(30000) 100 this.timeout(30000)
101 101
102 server = await flushAndRunServer(1) 102 server = await createSingleServer(1)
103 await setAccessTokensToServers([ server ]) 103 await setAccessTokensToServers([ server ])
104 await setDefaultVideoChannel([ server ]) 104 await setDefaultVideoChannel([ server ])
105 105
diff --git a/server/tests/api/videos/single-server.ts b/server/tests/api/videos/single-server.ts
index 12c1f7b2f..c0535be09 100644
--- a/server/tests/api/videos/single-server.ts
+++ b/server/tests/api/videos/single-server.ts
@@ -6,8 +6,8 @@ import {
6 checkVideoFilesWereRemoved, 6 checkVideoFilesWereRemoved,
7 cleanupTests, 7 cleanupTests,
8 completeVideoCheck, 8 completeVideoCheck,
9 flushAndRunServer, 9 createSingleServer,
10 ServerInfo, 10 PeerTubeServer,
11 setAccessTokensToServers, 11 setAccessTokensToServers,
12 testImage, 12 testImage,
13 wait 13 wait
@@ -19,7 +19,7 @@ const expect = chai.expect
19describe('Test a single server', function () { 19describe('Test a single server', function () {
20 20
21 function runSuite (mode: 'legacy' | 'resumable') { 21 function runSuite (mode: 'legacy' | 'resumable') {
22 let server: ServerInfo = null 22 let server: PeerTubeServer = null
23 let videoId: number | string 23 let videoId: number | string
24 let videoId2: string 24 let videoId2: string
25 let videoUUID = '' 25 let videoUUID = ''
@@ -94,7 +94,7 @@ describe('Test a single server', function () {
94 before(async function () { 94 before(async function () {
95 this.timeout(30000) 95 this.timeout(30000)
96 96
97 server = await flushAndRunServer(1) 97 server = await createSingleServer(1)
98 98
99 await setAccessTokensToServers([ server ]) 99 await setAccessTokensToServers([ server ])
100 }) 100 })
diff --git a/server/tests/api/videos/video-captions.ts b/server/tests/api/videos/video-captions.ts
index abc07194d..6caba6aa6 100644
--- a/server/tests/api/videos/video-captions.ts
+++ b/server/tests/api/videos/video-captions.ts
@@ -6,8 +6,8 @@ import {
6 checkVideoFilesWereRemoved, 6 checkVideoFilesWereRemoved,
7 cleanupTests, 7 cleanupTests,
8 doubleFollow, 8 doubleFollow,
9 flushAndRunMultipleServers, 9 createMultipleServers,
10 ServerInfo, 10 PeerTubeServer,
11 setAccessTokensToServers, 11 setAccessTokensToServers,
12 testCaptionFile, 12 testCaptionFile,
13 wait, 13 wait,
@@ -19,13 +19,13 @@ const expect = chai.expect
19describe('Test video captions', function () { 19describe('Test video captions', function () {
20 const uuidRegex = '[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}' 20 const uuidRegex = '[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}'
21 21
22 let servers: ServerInfo[] 22 let servers: PeerTubeServer[]
23 let videoUUID: string 23 let videoUUID: string
24 24
25 before(async function () { 25 before(async function () {
26 this.timeout(60000) 26 this.timeout(60000)
27 27
28 servers = await flushAndRunMultipleServers(2) 28 servers = await createMultipleServers(2)
29 29
30 await setAccessTokensToServers(servers) 30 await setAccessTokensToServers(servers)
31 await doubleFollow(servers[0], servers[1]) 31 await doubleFollow(servers[0], servers[1])
diff --git a/server/tests/api/videos/video-change-ownership.ts b/server/tests/api/videos/video-change-ownership.ts
index 352eb5ea3..cefddb68e 100644
--- a/server/tests/api/videos/video-change-ownership.ts
+++ b/server/tests/api/videos/video-change-ownership.ts
@@ -7,9 +7,9 @@ import {
7 ChangeOwnershipCommand, 7 ChangeOwnershipCommand,
8 cleanupTests, 8 cleanupTests,
9 doubleFollow, 9 doubleFollow,
10 flushAndRunMultipleServers, 10 createMultipleServers,
11 flushAndRunServer, 11 createSingleServer,
12 ServerInfo, 12 PeerTubeServer,
13 setAccessTokensToServers, 13 setAccessTokensToServers,
14 setDefaultVideoChannel, 14 setDefaultVideoChannel,
15 waitJobs 15 waitJobs
@@ -19,7 +19,7 @@ import { VideoPrivacy } from '@shared/models'
19const expect = chai.expect 19const expect = chai.expect
20 20
21describe('Test video change ownership - nominal', function () { 21describe('Test video change ownership - nominal', function () {
22 let servers: ServerInfo[] = [] 22 let servers: PeerTubeServer[] = []
23 23
24 const firstUser = 'first' 24 const firstUser = 'first'
25 const secondUser = 'second' 25 const secondUser = 'second'
@@ -39,7 +39,7 @@ describe('Test video change ownership - nominal', function () {
39 before(async function () { 39 before(async function () {
40 this.timeout(50000) 40 this.timeout(50000)
41 41
42 servers = await flushAndRunMultipleServers(2) 42 servers = await createMultipleServers(2)
43 await setAccessTokensToServers(servers) 43 await setAccessTokensToServers(servers)
44 await setDefaultVideoChannel(servers) 44 await setDefaultVideoChannel(servers)
45 45
@@ -251,7 +251,7 @@ describe('Test video change ownership - nominal', function () {
251}) 251})
252 252
253describe('Test video change ownership - quota too small', function () { 253describe('Test video change ownership - quota too small', function () {
254 let server: ServerInfo 254 let server: PeerTubeServer
255 const firstUser = 'first' 255 const firstUser = 'first'
256 const secondUser = 'second' 256 const secondUser = 'second'
257 257
@@ -263,7 +263,7 @@ describe('Test video change ownership - quota too small', function () {
263 this.timeout(50000) 263 this.timeout(50000)
264 264
265 // Run one server 265 // Run one server
266 server = await flushAndRunServer(1) 266 server = await createSingleServer(1)
267 await setAccessTokensToServers([ server ]) 267 await setAccessTokensToServers([ server ])
268 268
269 await server.users.create({ username: secondUser, videoQuota: 10 }) 269 await server.users.create({ username: secondUser, videoQuota: 10 })
diff --git a/server/tests/api/videos/video-channels.ts b/server/tests/api/videos/video-channels.ts
index 1efef932c..140fee7fe 100644
--- a/server/tests/api/videos/video-channels.ts
+++ b/server/tests/api/videos/video-channels.ts
@@ -7,8 +7,8 @@ import { ACTOR_IMAGES_SIZE } from '@server/initializers/constants'
7import { 7import {
8 cleanupTests, 8 cleanupTests,
9 doubleFollow, 9 doubleFollow,
10 flushAndRunMultipleServers, 10 createMultipleServers,
11 ServerInfo, 11 PeerTubeServer,
12 setAccessTokensToServers, 12 setAccessTokensToServers,
13 setDefaultVideoChannel, 13 setDefaultVideoChannel,
14 testFileExistsOrNot, 14 testFileExistsOrNot,
@@ -20,14 +20,14 @@ import { User, VideoChannel } from '@shared/models'
20 20
21const expect = chai.expect 21const expect = chai.expect
22 22
23async function findChannel (server: ServerInfo, channelId: number) { 23async function findChannel (server: PeerTubeServer, channelId: number) {
24 const body = await server.channels.list({ sort: '-name' }) 24 const body = await server.channels.list({ sort: '-name' })
25 25
26 return body.data.find(c => c.id === channelId) 26 return body.data.find(c => c.id === channelId)
27} 27}
28 28
29describe('Test video channels', function () { 29describe('Test video channels', function () {
30 let servers: ServerInfo[] 30 let servers: PeerTubeServer[]
31 let userInfo: User 31 let userInfo: User
32 let secondVideoChannelId: number 32 let secondVideoChannelId: number
33 let totoChannel: number 33 let totoChannel: number
@@ -40,7 +40,7 @@ describe('Test video channels', function () {
40 before(async function () { 40 before(async function () {
41 this.timeout(60000) 41 this.timeout(60000)
42 42
43 servers = await flushAndRunMultipleServers(2) 43 servers = await createMultipleServers(2)
44 44
45 await setAccessTokensToServers(servers) 45 await setAccessTokensToServers(servers)
46 await setDefaultVideoChannel(servers) 46 await setDefaultVideoChannel(servers)
diff --git a/server/tests/api/videos/video-comments.ts b/server/tests/api/videos/video-comments.ts
index adb59bd74..9709e0628 100644
--- a/server/tests/api/videos/video-comments.ts
+++ b/server/tests/api/videos/video-comments.ts
@@ -6,8 +6,8 @@ import {
6 cleanupTests, 6 cleanupTests,
7 CommentsCommand, 7 CommentsCommand,
8 dateIsValid, 8 dateIsValid,
9 flushAndRunServer, 9 createSingleServer,
10 ServerInfo, 10 PeerTubeServer,
11 setAccessTokensToServers, 11 setAccessTokensToServers,
12 testImage 12 testImage
13} from '@shared/extra-utils' 13} from '@shared/extra-utils'
@@ -15,7 +15,7 @@ import {
15const expect = chai.expect 15const expect = chai.expect
16 16
17describe('Test video comments', function () { 17describe('Test video comments', function () {
18 let server: ServerInfo 18 let server: PeerTubeServer
19 let videoId: number 19 let videoId: number
20 let videoUUID: string 20 let videoUUID: string
21 let threadId: number 21 let threadId: number
@@ -28,7 +28,7 @@ describe('Test video comments', function () {
28 before(async function () { 28 before(async function () {
29 this.timeout(30000) 29 this.timeout(30000)
30 30
31 server = await flushAndRunServer(1) 31 server = await createSingleServer(1)
32 32
33 await setAccessTokensToServers([ server ]) 33 await setAccessTokensToServers([ server ])
34 34
diff --git a/server/tests/api/videos/video-description.ts b/server/tests/api/videos/video-description.ts
index b89247288..ce45eac80 100644
--- a/server/tests/api/videos/video-description.ts
+++ b/server/tests/api/videos/video-description.ts
@@ -2,12 +2,12 @@
2 2
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { cleanupTests, doubleFollow, flushAndRunMultipleServers, ServerInfo, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' 5import { cleanupTests, doubleFollow, createMultipleServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
6 6
7const expect = chai.expect 7const expect = chai.expect
8 8
9describe('Test video description', function () { 9describe('Test video description', function () {
10 let servers: ServerInfo[] = [] 10 let servers: PeerTubeServer[] = []
11 let videoUUID = '' 11 let videoUUID = ''
12 let videoId: number 12 let videoId: number
13 const longDescription = 'my super description for server 1'.repeat(50) 13 const longDescription = 'my super description for server 1'.repeat(50)
@@ -16,7 +16,7 @@ describe('Test video description', function () {
16 this.timeout(40000) 16 this.timeout(40000)
17 17
18 // Run servers 18 // Run servers
19 servers = await flushAndRunMultipleServers(2) 19 servers = await createMultipleServers(2)
20 20
21 // Get the access tokens 21 // Get the access tokens
22 await setAccessTokensToServers(servers) 22 await setAccessTokensToServers(servers)
diff --git a/server/tests/api/videos/video-hls.ts b/server/tests/api/videos/video-hls.ts
index 9d79f2683..4c4b18887 100644
--- a/server/tests/api/videos/video-hls.ts
+++ b/server/tests/api/videos/video-hls.ts
@@ -11,9 +11,9 @@ import {
11 checkTmpIsEmpty, 11 checkTmpIsEmpty,
12 cleanupTests, 12 cleanupTests,
13 doubleFollow, 13 doubleFollow,
14 flushAndRunMultipleServers, 14 createMultipleServers,
15 makeRawRequest, 15 makeRawRequest,
16 ServerInfo, 16 PeerTubeServer,
17 setAccessTokensToServers, 17 setAccessTokensToServers,
18 waitJobs, 18 waitJobs,
19 webtorrentAdd 19 webtorrentAdd
@@ -23,7 +23,7 @@ import { DEFAULT_AUDIO_RESOLUTION } from '../../../initializers/constants'
23 23
24const expect = chai.expect 24const expect = chai.expect
25 25
26async function checkHlsPlaylist (servers: ServerInfo[], videoUUID: string, hlsOnly: boolean, resolutions = [ 240, 360, 480, 720 ]) { 26async function checkHlsPlaylist (servers: PeerTubeServer[], videoUUID: string, hlsOnly: boolean, resolutions = [ 240, 360, 480, 720 ]) {
27 for (const server of servers) { 27 for (const server of servers) {
28 const videoDetails = await server.videos.get({ id: videoUUID }) 28 const videoDetails = await server.videos.get({ id: videoUUID })
29 const baseUrl = `http://${videoDetails.account.host}` 29 const baseUrl = `http://${videoDetails.account.host}`
@@ -98,7 +98,7 @@ async function checkHlsPlaylist (servers: ServerInfo[], videoUUID: string, hlsOn
98} 98}
99 99
100describe('Test HLS videos', function () { 100describe('Test HLS videos', function () {
101 let servers: ServerInfo[] = [] 101 let servers: PeerTubeServer[] = []
102 let videoUUID = '' 102 let videoUUID = ''
103 let videoAudioUUID = '' 103 let videoAudioUUID = ''
104 104
@@ -176,7 +176,7 @@ describe('Test HLS videos', function () {
176 } 176 }
177 } 177 }
178 } 178 }
179 servers = await flushAndRunMultipleServers(2, configOverride) 179 servers = await createMultipleServers(2, configOverride)
180 180
181 // Get the access tokens 181 // Get the access tokens
182 await setAccessTokensToServers(servers) 182 await setAccessTokensToServers(servers)
diff --git a/server/tests/api/videos/video-imports.ts b/server/tests/api/videos/video-imports.ts
index 8b6542aa4..4ef55c3af 100644
--- a/server/tests/api/videos/video-imports.ts
+++ b/server/tests/api/videos/video-imports.ts
@@ -6,9 +6,9 @@ import {
6 areHttpImportTestsDisabled, 6 areHttpImportTestsDisabled,
7 cleanupTests, 7 cleanupTests,
8 doubleFollow, 8 doubleFollow,
9 flushAndRunMultipleServers, 9 createMultipleServers,
10 ImportsCommand, 10 ImportsCommand,
11 ServerInfo, 11 PeerTubeServer,
12 setAccessTokensToServers, 12 setAccessTokensToServers,
13 testCaptionFile, 13 testCaptionFile,
14 testImage, 14 testImage,
@@ -19,13 +19,13 @@ import { VideoPrivacy, VideoResolution } from '@shared/models'
19const expect = chai.expect 19const expect = chai.expect
20 20
21describe('Test video imports', function () { 21describe('Test video imports', function () {
22 let servers: ServerInfo[] = [] 22 let servers: PeerTubeServer[] = []
23 let channelIdServer1: number 23 let channelIdServer1: number
24 let channelIdServer2: number 24 let channelIdServer2: number
25 25
26 if (areHttpImportTestsDisabled()) return 26 if (areHttpImportTestsDisabled()) return
27 27
28 async function checkVideosServer1 (server: ServerInfo, idHttp: string, idMagnet: string, idTorrent: string) { 28 async function checkVideosServer1 (server: PeerTubeServer, idHttp: string, idMagnet: string, idTorrent: string) {
29 const videoHttp = await server.videos.get({ id: idHttp }) 29 const videoHttp = await server.videos.get({ id: idHttp })
30 30
31 expect(videoHttp.name).to.equal('small video - youtube') 31 expect(videoHttp.name).to.equal('small video - youtube')
@@ -63,7 +63,7 @@ describe('Test video imports', function () {
63 expect(bodyCaptions.total).to.equal(2) 63 expect(bodyCaptions.total).to.equal(2)
64 } 64 }
65 65
66 async function checkVideoServer2 (server: ServerInfo, id: number | string) { 66 async function checkVideoServer2 (server: PeerTubeServer, id: number | string) {
67 const video = await server.videos.get({ id }) 67 const video = await server.videos.get({ id })
68 68
69 expect(video.name).to.equal('my super name') 69 expect(video.name).to.equal('my super name')
@@ -84,7 +84,7 @@ describe('Test video imports', function () {
84 this.timeout(30_000) 84 this.timeout(30_000)
85 85
86 // Run servers 86 // Run servers
87 servers = await flushAndRunMultipleServers(2) 87 servers = await createMultipleServers(2)
88 88
89 await setAccessTokensToServers(servers) 89 await setAccessTokensToServers(servers)
90 90
diff --git a/server/tests/api/videos/video-nsfw.ts b/server/tests/api/videos/video-nsfw.ts
index 95395a582..b25dcda20 100644
--- a/server/tests/api/videos/video-nsfw.ts
+++ b/server/tests/api/videos/video-nsfw.ts
@@ -2,7 +2,7 @@
2 2
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { cleanupTests, flushAndRunServer, ServerInfo, setAccessTokensToServers } from '@shared/extra-utils' 5import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils'
6import { BooleanBothQuery, CustomConfig, ResultList, Video, VideosOverview } from '@shared/models' 6import { BooleanBothQuery, CustomConfig, ResultList, Video, VideosOverview } from '@shared/models'
7 7
8const expect = chai.expect 8const expect = chai.expect
@@ -13,7 +13,7 @@ function createOverviewRes (overview: VideosOverview) {
13} 13}
14 14
15describe('Test video NSFW policy', function () { 15describe('Test video NSFW policy', function () {
16 let server: ServerInfo 16 let server: PeerTubeServer
17 let userAccessToken: string 17 let userAccessToken: string
18 let customConfig: CustomConfig 18 let customConfig: CustomConfig
19 19
@@ -61,7 +61,7 @@ describe('Test video NSFW policy', function () {
61 61
62 before(async function () { 62 before(async function () {
63 this.timeout(50000) 63 this.timeout(50000)
64 server = await flushAndRunServer(1) 64 server = await createSingleServer(1)
65 65
66 // Get the access tokens 66 // Get the access tokens
67 await setAccessTokensToServers([ server ]) 67 await setAccessTokensToServers([ server ])
diff --git a/server/tests/api/videos/video-playlist-thumbnails.ts b/server/tests/api/videos/video-playlist-thumbnails.ts
index 709f64c4d..9a682c12b 100644
--- a/server/tests/api/videos/video-playlist-thumbnails.ts
+++ b/server/tests/api/videos/video-playlist-thumbnails.ts
@@ -5,8 +5,8 @@ import * as chai from 'chai'
5import { 5import {
6 cleanupTests, 6 cleanupTests,
7 doubleFollow, 7 doubleFollow,
8 flushAndRunMultipleServers, 8 createMultipleServers,
9 ServerInfo, 9 PeerTubeServer,
10 setAccessTokensToServers, 10 setAccessTokensToServers,
11 setDefaultVideoChannel, 11 setDefaultVideoChannel,
12 testImage, 12 testImage,
@@ -17,7 +17,7 @@ import { VideoPlaylistPrivacy } from '../../../../shared/models/videos/playlist/
17const expect = chai.expect 17const expect = chai.expect
18 18
19describe('Playlist thumbnail', function () { 19describe('Playlist thumbnail', function () {
20 let servers: ServerInfo[] = [] 20 let servers: PeerTubeServer[] = []
21 21
22 let playlistWithoutThumbnailId: number 22 let playlistWithoutThumbnailId: number
23 let playlistWithThumbnailId: number 23 let playlistWithThumbnailId: number
@@ -30,13 +30,13 @@ describe('Playlist thumbnail', function () {
30 let video1: number 30 let video1: number
31 let video2: number 31 let video2: number
32 32
33 async function getPlaylistWithoutThumbnail (server: ServerInfo) { 33 async function getPlaylistWithoutThumbnail (server: PeerTubeServer) {
34 const body = await server.playlists.list({ start: 0, count: 10 }) 34 const body = await server.playlists.list({ start: 0, count: 10 })
35 35
36 return body.data.find(p => p.displayName === 'playlist without thumbnail') 36 return body.data.find(p => p.displayName === 'playlist without thumbnail')
37 } 37 }
38 38
39 async function getPlaylistWithThumbnail (server: ServerInfo) { 39 async function getPlaylistWithThumbnail (server: PeerTubeServer) {
40 const body = await server.playlists.list({ start: 0, count: 10 }) 40 const body = await server.playlists.list({ start: 0, count: 10 })
41 41
42 return body.data.find(p => p.displayName === 'playlist with thumbnail') 42 return body.data.find(p => p.displayName === 'playlist with thumbnail')
@@ -45,7 +45,7 @@ describe('Playlist thumbnail', function () {
45 before(async function () { 45 before(async function () {
46 this.timeout(120000) 46 this.timeout(120000)
47 47
48 servers = await flushAndRunMultipleServers(2, { transcoding: { enabled: false } }) 48 servers = await createMultipleServers(2, { transcoding: { enabled: false } })
49 49
50 // Get the access tokens 50 // Get the access tokens
51 await setAccessTokensToServers(servers) 51 await setAccessTokensToServers(servers)
diff --git a/server/tests/api/videos/video-playlists.ts b/server/tests/api/videos/video-playlists.ts
index 0dc53d4c0..71ca3e63a 100644
--- a/server/tests/api/videos/video-playlists.ts
+++ b/server/tests/api/videos/video-playlists.ts
@@ -7,9 +7,9 @@ import {
7 checkPlaylistFilesWereRemoved, 7 checkPlaylistFilesWereRemoved,
8 cleanupTests, 8 cleanupTests,
9 doubleFollow, 9 doubleFollow,
10 flushAndRunMultipleServers, 10 createMultipleServers,
11 PlaylistsCommand, 11 PlaylistsCommand,
12 ServerInfo, 12 PeerTubeServer,
13 setAccessTokensToServers, 13 setAccessTokensToServers,
14 setDefaultVideoChannel, 14 setDefaultVideoChannel,
15 testImage, 15 testImage,
@@ -28,7 +28,7 @@ import {
28const expect = chai.expect 28const expect = chai.expect
29 29
30async function checkPlaylistElementType ( 30async function checkPlaylistElementType (
31 servers: ServerInfo[], 31 servers: PeerTubeServer[],
32 playlistId: string, 32 playlistId: string,
33 type: VideoPlaylistElementType, 33 type: VideoPlaylistElementType,
34 position: number, 34 position: number,
@@ -52,7 +52,7 @@ async function checkPlaylistElementType (
52} 52}
53 53
54describe('Test video playlists', function () { 54describe('Test video playlists', function () {
55 let servers: ServerInfo[] = [] 55 let servers: PeerTubeServer[] = []
56 56
57 let playlistServer2Id1: number 57 let playlistServer2Id1: number
58 let playlistServer2Id2: number 58 let playlistServer2Id2: number
@@ -75,7 +75,7 @@ describe('Test video playlists', function () {
75 before(async function () { 75 before(async function () {
76 this.timeout(120000) 76 this.timeout(120000)
77 77
78 servers = await flushAndRunMultipleServers(3, { transcoding: { enabled: false } }) 78 servers = await createMultipleServers(3, { transcoding: { enabled: false } })
79 79
80 // Get the access tokens 80 // Get the access tokens
81 await setAccessTokensToServers(servers) 81 await setAccessTokensToServers(servers)
@@ -584,10 +584,10 @@ describe('Test video playlists', function () {
584 }) 584 })
585 585
586 describe('Element type', function () { 586 describe('Element type', function () {
587 let groupUser1: ServerInfo[] 587 let groupUser1: PeerTubeServer[]
588 let groupWithoutToken1: ServerInfo[] 588 let groupWithoutToken1: PeerTubeServer[]
589 let group1: ServerInfo[] 589 let group1: PeerTubeServer[]
590 let group2: ServerInfo[] 590 let group2: PeerTubeServer[]
591 591
592 let video1: string 592 let video1: string
593 let video2: string 593 let video2: string
diff --git a/server/tests/api/videos/video-privacy.ts b/server/tests/api/videos/video-privacy.ts
index de08a9e7b..5ec626155 100644
--- a/server/tests/api/videos/video-privacy.ts
+++ b/server/tests/api/videos/video-privacy.ts
@@ -3,13 +3,13 @@
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { HttpStatusCode } from '@shared/core-utils' 5import { HttpStatusCode } from '@shared/core-utils'
6import { cleanupTests, doubleFollow, flushAndRunServer, ServerInfo, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' 6import { cleanupTests, doubleFollow, createSingleServer, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
7import { VideoCreateResult, VideoPrivacy } from '@shared/models' 7import { VideoCreateResult, VideoPrivacy } from '@shared/models'
8 8
9const expect = chai.expect 9const expect = chai.expect
10 10
11describe('Test video privacy', function () { 11describe('Test video privacy', function () {
12 const servers: ServerInfo[] = [] 12 const servers: PeerTubeServer[] = []
13 let anotherUserToken: string 13 let anotherUserToken: string
14 14
15 let privateVideoId: number 15 let privateVideoId: number
@@ -35,8 +35,8 @@ describe('Test video privacy', function () {
35 this.timeout(50000) 35 this.timeout(50000)
36 36
37 // Run servers 37 // Run servers
38 servers.push(await flushAndRunServer(1, dontFederateUnlistedConfig)) 38 servers.push(await createSingleServer(1, dontFederateUnlistedConfig))
39 servers.push(await flushAndRunServer(2)) 39 servers.push(await createSingleServer(2))
40 40
41 // Get the access tokens 41 // Get the access tokens
42 await setAccessTokensToServers(servers) 42 await setAccessTokensToServers(servers)
diff --git a/server/tests/api/videos/video-schedule-update.ts b/server/tests/api/videos/video-schedule-update.ts
index 3938b47c8..22b5cf1c2 100644
--- a/server/tests/api/videos/video-schedule-update.ts
+++ b/server/tests/api/videos/video-schedule-update.ts
@@ -5,8 +5,8 @@ import * as chai from 'chai'
5import { 5import {
6 cleanupTests, 6 cleanupTests,
7 doubleFollow, 7 doubleFollow,
8 flushAndRunMultipleServers, 8 createMultipleServers,
9 ServerInfo, 9 PeerTubeServer,
10 setAccessTokensToServers, 10 setAccessTokensToServers,
11 wait, 11 wait,
12 waitJobs 12 waitJobs
@@ -23,14 +23,14 @@ function in10Seconds () {
23} 23}
24 24
25describe('Test video update scheduler', function () { 25describe('Test video update scheduler', function () {
26 let servers: ServerInfo[] = [] 26 let servers: PeerTubeServer[] = []
27 let video2UUID: string 27 let video2UUID: string
28 28
29 before(async function () { 29 before(async function () {
30 this.timeout(30000) 30 this.timeout(30000)
31 31
32 // Run servers 32 // Run servers
33 servers = await flushAndRunMultipleServers(2) 33 servers = await createMultipleServers(2)
34 34
35 await setAccessTokensToServers(servers) 35 await setAccessTokensToServers(servers)
36 36
diff --git a/server/tests/api/videos/video-transcoder.ts b/server/tests/api/videos/video-transcoder.ts
index 37450eeeb..2465d2d89 100644
--- a/server/tests/api/videos/video-transcoder.ts
+++ b/server/tests/api/videos/video-transcoder.ts
@@ -9,11 +9,11 @@ import {
9 buildAbsoluteFixturePath, 9 buildAbsoluteFixturePath,
10 cleanupTests, 10 cleanupTests,
11 doubleFollow, 11 doubleFollow,
12 flushAndRunMultipleServers, 12 createMultipleServers,
13 generateHighBitrateVideo, 13 generateHighBitrateVideo,
14 generateVideoWithFramerate, 14 generateVideoWithFramerate,
15 makeGetRequest, 15 makeGetRequest,
16 ServerInfo, 16 PeerTubeServer,
17 setAccessTokensToServers, 17 setAccessTokensToServers,
18 waitJobs, 18 waitJobs,
19 webtorrentAdd 19 webtorrentAdd
@@ -31,7 +31,7 @@ import {
31 31
32const expect = chai.expect 32const expect = chai.expect
33 33
34function updateConfigForTranscoding (server: ServerInfo) { 34function updateConfigForTranscoding (server: PeerTubeServer) {
35 return server.config.updateCustomSubConfig({ 35 return server.config.updateCustomSubConfig({
36 newConfig: { 36 newConfig: {
37 transcoding: { 37 transcoding: {
@@ -56,14 +56,14 @@ function updateConfigForTranscoding (server: ServerInfo) {
56} 56}
57 57
58describe('Test video transcoding', function () { 58describe('Test video transcoding', function () {
59 let servers: ServerInfo[] = [] 59 let servers: PeerTubeServer[] = []
60 let video4k: string 60 let video4k: string
61 61
62 before(async function () { 62 before(async function () {
63 this.timeout(30_000) 63 this.timeout(30_000)
64 64
65 // Run servers 65 // Run servers
66 servers = await flushAndRunMultipleServers(2) 66 servers = await createMultipleServers(2)
67 67
68 await setAccessTokensToServers(servers) 68 await setAccessTokensToServers(servers)
69 69
diff --git a/server/tests/api/videos/videos-filter.ts b/server/tests/api/videos/videos-filter.ts
index af1541dbd..db9150655 100644
--- a/server/tests/api/videos/videos-filter.ts
+++ b/server/tests/api/videos/videos-filter.ts
@@ -6,14 +6,14 @@ import { HttpStatusCode } from '@shared/core-utils'
6import { 6import {
7 cleanupTests, 7 cleanupTests,
8 doubleFollow, 8 doubleFollow,
9 flushAndRunMultipleServers, 9 createMultipleServers,
10 makeGetRequest, 10 makeGetRequest,
11 ServerInfo, 11 PeerTubeServer,
12 setAccessTokensToServers 12 setAccessTokensToServers
13} from '@shared/extra-utils' 13} from '@shared/extra-utils'
14import { UserRole, Video, VideoPrivacy } from '@shared/models' 14import { UserRole, Video, VideoPrivacy } from '@shared/models'
15 15
16async function getVideosNames (server: ServerInfo, token: string, filter: string, statusCodeExpected = HttpStatusCode.OK_200) { 16async function getVideosNames (server: PeerTubeServer, token: string, filter: string, statusCodeExpected = HttpStatusCode.OK_200) {
17 const paths = [ 17 const paths = [
18 '/api/v1/video-channels/root_channel/videos', 18 '/api/v1/video-channels/root_channel/videos',
19 '/api/v1/accounts/root/videos', 19 '/api/v1/accounts/root/videos',
@@ -42,14 +42,14 @@ async function getVideosNames (server: ServerInfo, token: string, filter: string
42} 42}
43 43
44describe('Test videos filter', function () { 44describe('Test videos filter', function () {
45 let servers: ServerInfo[] 45 let servers: PeerTubeServer[]
46 46
47 // --------------------------------------------------------------- 47 // ---------------------------------------------------------------
48 48
49 before(async function () { 49 before(async function () {
50 this.timeout(160000) 50 this.timeout(160000)
51 51
52 servers = await flushAndRunMultipleServers(2) 52 servers = await createMultipleServers(2)
53 53
54 await setAccessTokensToServers(servers) 54 await setAccessTokensToServers(servers)
55 55
diff --git a/server/tests/api/videos/videos-history.ts b/server/tests/api/videos/videos-history.ts
index 4b5e581d1..55e53cb94 100644
--- a/server/tests/api/videos/videos-history.ts
+++ b/server/tests/api/videos/videos-history.ts
@@ -5,11 +5,10 @@ import * as chai from 'chai'
5import { HttpStatusCode } from '@shared/core-utils' 5import { HttpStatusCode } from '@shared/core-utils'
6import { 6import {
7 cleanupTests, 7 cleanupTests,
8 flushAndRunServer, 8 createSingleServer,
9 HistoryCommand, 9 HistoryCommand,
10 killallServers, 10 killallServers,
11 reRunServer, 11 PeerTubeServer,
12 ServerInfo,
13 setAccessTokensToServers, 12 setAccessTokensToServers,
14 wait 13 wait
15} from '@shared/extra-utils' 14} from '@shared/extra-utils'
@@ -18,7 +17,7 @@ import { Video } from '@shared/models'
18const expect = chai.expect 17const expect = chai.expect
19 18
20describe('Test videos history', function () { 19describe('Test videos history', function () {
21 let server: ServerInfo = null 20 let server: PeerTubeServer = null
22 let video1UUID: string 21 let video1UUID: string
23 let video2UUID: string 22 let video2UUID: string
24 let video3UUID: string 23 let video3UUID: string
@@ -29,7 +28,7 @@ describe('Test videos history', function () {
29 before(async function () { 28 before(async function () {
30 this.timeout(30000) 29 this.timeout(30000)
31 30
32 server = await flushAndRunServer(1) 31 server = await createSingleServer(1)
33 32
34 await setAccessTokensToServers([ server ]) 33 await setAccessTokensToServers([ server ])
35 34
@@ -191,7 +190,7 @@ describe('Test videos history', function () {
191 190
192 await killallServers([ server ]) 191 await killallServers([ server ])
193 192
194 await reRunServer(server, { history: { videos: { max_age: '10 days' } } }) 193 await server.run({ history: { videos: { max_age: '10 days' } } })
195 194
196 await wait(6000) 195 await wait(6000)
197 196
@@ -206,7 +205,7 @@ describe('Test videos history', function () {
206 205
207 await killallServers([ server ]) 206 await killallServers([ server ])
208 207
209 await reRunServer(server, { history: { videos: { max_age: '5 seconds' } } }) 208 await server.run({ history: { videos: { max_age: '5 seconds' } } })
210 209
211 await wait(6000) 210 await wait(6000)
212 211
diff --git a/server/tests/api/videos/videos-overview.ts b/server/tests/api/videos/videos-overview.ts
index f0657b334..70aa66549 100644
--- a/server/tests/api/videos/videos-overview.ts
+++ b/server/tests/api/videos/videos-overview.ts
@@ -2,13 +2,13 @@
2 2
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { cleanupTests, flushAndRunServer, ServerInfo, setAccessTokensToServers, wait } from '@shared/extra-utils' 5import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers, wait } from '@shared/extra-utils'
6import { VideosOverview } from '@shared/models' 6import { VideosOverview } from '@shared/models'
7 7
8const expect = chai.expect 8const expect = chai.expect
9 9
10describe('Test a videos overview', function () { 10describe('Test a videos overview', function () {
11 let server: ServerInfo = null 11 let server: PeerTubeServer = null
12 12
13 function testOverviewCount (overview: VideosOverview, expected: number) { 13 function testOverviewCount (overview: VideosOverview, expected: number) {
14 expect(overview.tags).to.have.lengthOf(expected) 14 expect(overview.tags).to.have.lengthOf(expected)
@@ -19,7 +19,7 @@ describe('Test a videos overview', function () {
19 before(async function () { 19 before(async function () {
20 this.timeout(30000) 20 this.timeout(30000)
21 21
22 server = await flushAndRunServer(1) 22 server = await createSingleServer(1)
23 23
24 await setAccessTokensToServers([ server ]) 24 await setAccessTokensToServers([ server ])
25 }) 25 })
diff --git a/server/tests/api/videos/videos-views-cleaner.ts b/server/tests/api/videos/videos-views-cleaner.ts
index 238662cf3..0be03ddd2 100644
--- a/server/tests/api/videos/videos-views-cleaner.ts
+++ b/server/tests/api/videos/videos-views-cleaner.ts
@@ -5,10 +5,9 @@ import * as chai from 'chai'
5import { 5import {
6 cleanupTests, 6 cleanupTests,
7 doubleFollow, 7 doubleFollow,
8 flushAndRunMultipleServers, 8 createMultipleServers,
9 killallServers, 9 killallServers,
10 reRunServer, 10 PeerTubeServer,
11 ServerInfo,
12 setAccessTokensToServers, 11 setAccessTokensToServers,
13 wait, 12 wait,
14 waitJobs 13 waitJobs
@@ -17,7 +16,7 @@ import {
17const expect = chai.expect 16const expect = chai.expect
18 17
19describe('Test video views cleaner', function () { 18describe('Test video views cleaner', function () {
20 let servers: ServerInfo[] 19 let servers: PeerTubeServer[]
21 20
22 let videoIdServer1: string 21 let videoIdServer1: string
23 let videoIdServer2: string 22 let videoIdServer2: string
@@ -25,7 +24,7 @@ describe('Test video views cleaner', function () {
25 before(async function () { 24 before(async function () {
26 this.timeout(120000) 25 this.timeout(120000)
27 26
28 servers = await flushAndRunMultipleServers(2) 27 servers = await createMultipleServers(2)
29 await setAccessTokensToServers(servers) 28 await setAccessTokensToServers(servers)
30 29
31 await doubleFollow(servers[0], servers[1]) 30 await doubleFollow(servers[0], servers[1])
@@ -48,7 +47,7 @@ describe('Test video views cleaner', function () {
48 47
49 await killallServers([ servers[0] ]) 48 await killallServers([ servers[0] ])
50 49
51 await reRunServer(servers[0], { views: { videos: { remote: { max_age: '10 days' } } } }) 50 await servers[0].run({ views: { videos: { remote: { max_age: '10 days' } } } })
52 51
53 await wait(6000) 52 await wait(6000)
54 53
@@ -74,7 +73,7 @@ describe('Test video views cleaner', function () {
74 73
75 await killallServers([ servers[0] ]) 74 await killallServers([ servers[0] ])
76 75
77 await reRunServer(servers[0], { views: { videos: { remote: { max_age: '5 seconds' } } } }) 76 await servers[0].run({ views: { videos: { remote: { max_age: '5 seconds' } } } })
78 77
79 await wait(6000) 78 await wait(6000)
80 79