diff options
154 files changed, 1066 insertions, 1054 deletions
diff --git a/scripts/benchmark.ts b/scripts/benchmark.ts index 1d980063b..071c4dea7 100644 --- a/scripts/benchmark.ts +++ b/scripts/benchmark.ts | |||
@@ -1,12 +1,12 @@ | |||
1 | import * as autocannon from 'autocannon' | 1 | import * as autocannon from 'autocannon' |
2 | import { writeJson } from 'fs-extra' | 2 | import { writeJson } from 'fs-extra' |
3 | import { flushAndRunServer, killallServers, ServerInfo, setAccessTokensToServers } from '@shared/extra-utils' | 3 | import { createSingleServer, killallServers, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils' |
4 | import { Video, VideoPrivacy } from '@shared/models' | 4 | import { Video, VideoPrivacy } from '@shared/models' |
5 | import { registerTSPaths } from '../server/helpers/register-ts-paths' | 5 | import { registerTSPaths } from '../server/helpers/register-ts-paths' |
6 | 6 | ||
7 | registerTSPaths() | 7 | registerTSPaths() |
8 | 8 | ||
9 | let server: ServerInfo | 9 | let server: PeerTubeServer |
10 | let video: Video | 10 | let video: Video |
11 | let threadId: number | 11 | let threadId: number |
12 | 12 | ||
@@ -188,7 +188,7 @@ function runBenchmark (options: { | |||
188 | } | 188 | } |
189 | 189 | ||
190 | async function prepare () { | 190 | async function prepare () { |
191 | server = await flushAndRunServer(1, { | 191 | server = await createSingleServer(1, { |
192 | rates_limit: { | 192 | rates_limit: { |
193 | api: { | 193 | api: { |
194 | max: 5_000_000 | 194 | max: 5_000_000 |
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' | |||
5 | import { | 5 | import { |
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 { | |||
15 | const expect = chai.expect | 15 | const expect = chai.expect |
16 | 16 | ||
17 | describe('Test AP cleaner', function () { | 17 | describe('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' | |||
6 | import { | 6 | import { |
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' | |||
17 | const expect = chai.expect | 17 | const expect = chai.expect |
18 | 18 | ||
19 | describe('Test activitypub', function () { | 19 | describe('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 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { cleanupTests, doubleFollow, flushAndRunMultipleServers, ServerInfo, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' | 5 | import { cleanupTests, doubleFollow, createMultipleServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' |
6 | 6 | ||
7 | const expect = chai.expect | 7 | const expect = chai.expect |
8 | 8 | ||
9 | describe('Test ActivityPub fetcher', function () { | 9 | describe('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' | |||
5 | import { | 5 | import { |
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 { | |||
17 | import { VideoPlaylistPrivacy } from '@shared/models' | 16 | import { VideoPlaylistPrivacy } from '@shared/models' |
18 | 17 | ||
19 | describe('Test AP refresher', function () { | 18 | describe('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 | |||
7 | import { | 7 | import { |
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' |
16 | import { makeFollowRequest, makePOSTAPRequest } from '../../../../shared/extra-utils/requests/activitypub' | 15 | import { makeFollowRequest, makePOSTAPRequest } from '../../../../shared/extra-utils/requests/activitypub' |
@@ -20,7 +19,7 @@ import { buildGlobalHeaders } from '../../../lib/job-queue/handlers/utils/activi | |||
20 | 19 | ||
21 | const expect = chai.expect | 20 | const expect = chai.expect |
22 | 21 | ||
23 | function setKeysOfServer (onServer: ServerInfo, ofServer: ServerInfo, publicKey: string, privateKey: string) { | 22 | function 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 | ||
32 | function setUpdatedAtOfServer (onServer: ServerInfo, ofServer: ServerInfo, updatedAt: string) { | 31 | function 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 | ||
41 | function getAnnounceWithoutContext (server: ServerInfo) { | 40 | function 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 | ||
56 | describe('Test ActivityPub security', function () { | 55 | describe('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' | |||
21 | describe('Test abuses API validators', function () { | 21 | describe('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 | ||
14 | describe('Test accounts API validators', function () { | 14 | describe('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' | |||
5 | import { | 5 | import { |
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' |
15 | import { | 15 | import { |
@@ -20,14 +20,14 @@ import { | |||
20 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | 20 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' |
21 | 21 | ||
22 | describe('Test blocklist API validators', function () { | 22 | describe('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 @@ | |||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import { | 4 | import { |
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' |
10 | import { makePostBodyRequest } from '../../../../shared/extra-utils/requests/requests' | 10 | import { makePostBodyRequest } from '../../../../shared/extra-utils/requests/requests' |
11 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | 11 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' |
12 | 12 | ||
13 | describe('Test bulk API validators', function () { | 13 | describe('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' | |||
5 | import { HttpStatusCode } from '@shared/core-utils' | 5 | import { HttpStatusCode } from '@shared/core-utils' |
6 | import { | 6 | import { |
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' |
15 | import { CustomConfig } from '@shared/models' | 15 | import { CustomConfig } from '@shared/models' |
16 | 16 | ||
17 | describe('Test config API validators', function () { | 17 | describe('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 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import { HttpStatusCode } from '@shared/core-utils' | 4 | import { HttpStatusCode } from '@shared/core-utils' |
5 | import { cleanupTests, flushAndRunServer, killallServers, MockSmtpServer, reRunServer, ServerInfo } from '@shared/extra-utils' | 5 | import { cleanupTests, createSingleServer, killallServers, MockSmtpServer, PeerTubeServer } from '@shared/extra-utils' |
6 | import { ContactFormCommand } from '@shared/extra-utils/server' | 6 | import { ContactFormCommand } from '@shared/extra-utils/server' |
7 | 7 | ||
8 | describe('Test contact form API validators', function () { | 8 | describe('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' | |||
4 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | 4 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' |
5 | import { | 5 | import { |
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' |
11 | import { makeGetRequest, makePutBodyRequest } from '../../../../shared/extra-utils/requests/requests' | 11 | import { makeGetRequest, makePutBodyRequest } from '../../../../shared/extra-utils/requests/requests' |
@@ -13,7 +13,7 @@ import { makeGetRequest, makePutBodyRequest } from '../../../../shared/extra-uti | |||
13 | describe('Test custom pages validators', function () { | 13 | describe('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 | ||
5 | import { | 5 | import { |
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' |
11 | import { makeGetRequest } from '../../../../shared/extra-utils/requests/requests' | 11 | import { makeGetRequest } from '../../../../shared/extra-utils/requests/requests' |
@@ -13,7 +13,7 @@ import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-c | |||
13 | 13 | ||
14 | describe('Test debug API validators', function () { | 14 | describe('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 | ||
5 | import { | 5 | import { |
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' |
13 | import { | 13 | import { |
@@ -18,14 +18,14 @@ import { | |||
18 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | 18 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' |
19 | 19 | ||
20 | describe('Test server follows API validators', function () { | 20 | describe('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 | ||
5 | import { | 5 | import { |
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' |
11 | import { | 11 | import { |
@@ -18,7 +18,7 @@ import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-c | |||
18 | 18 | ||
19 | describe('Test jobs API validators', function () { | 19 | describe('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' | |||
6 | import { | 6 | import { |
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 | ||
20 | describe('Test video lives API validator', function () { | 20 | describe('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 | ||
5 | import { | 5 | import { |
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' |
11 | import { makeGetRequest } from '../../../../shared/extra-utils/requests/requests' | 11 | import { makeGetRequest } from '../../../../shared/extra-utils/requests/requests' |
@@ -13,7 +13,7 @@ import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-c | |||
13 | 13 | ||
14 | describe('Test logs API validators', function () { | 14 | describe('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' |
17 | import { PeerTubePlugin, PluginType } from '@shared/models' | 17 | import { PeerTubePlugin, PluginType } from '@shared/models' |
18 | 18 | ||
19 | describe('Test server plugins API validators', function () { | 19 | describe('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 | ||
22 | describe('Test server redundancy API validators', function () { | 22 | describe('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 | ||
16 | function updateSearchIndex (server: ServerInfo, enabled: boolean, disableLocalSearch = false) { | 16 | function 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 | ||
29 | describe('Test videos API validator', function () { | 29 | describe('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' | |||
4 | import { HttpStatusCode } from '@shared/core-utils' | 4 | import { HttpStatusCode } from '@shared/core-utils' |
5 | import { | 5 | import { |
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' |
13 | import { VideoPlaylistPrivacy } from '@shared/models' | 13 | import { VideoPlaylistPrivacy } from '@shared/models' |
14 | 14 | ||
15 | describe('Test services API validators', function () { | 15 | describe('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 | ||
123 | function checkParamEmbed (server: ServerInfo, embedUrl: string, statusCodeExpected = HttpStatusCode.BAD_REQUEST_400, query = {}) { | 123 | function 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' | |||
5 | import { HttpStatusCode, randomInt } from '@shared/core-utils' | 5 | import { HttpStatusCode, randomInt } from '@shared/core-utils' |
6 | import { | 6 | import { |
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 { | |||
16 | import { VideoImportState, VideoPrivacy } from '@shared/models' | 16 | import { VideoImportState, VideoPrivacy } from '@shared/models' |
17 | 17 | ||
18 | describe('Test upload quota', function () { | 18 | describe('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' |
19 | import { UserNotificationSetting, UserNotificationSettingValue } from '@shared/models' | 19 | import { UserNotificationSetting, UserNotificationSettingValue } from '@shared/models' |
20 | 20 | ||
21 | describe('Test user notifications API validators', function () { | 21 | describe('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 | ||
5 | import { | 5 | import { |
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 | ||
23 | describe('Test user subscriptions API validators', function () { | 23 | describe('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' |
20 | import { VideoBlacklistType } from '@shared/models' | 20 | import { VideoBlacklistType } from '@shared/models' |
21 | 21 | ||
22 | describe('Test video blacklist API validators', function () { | 22 | describe('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' | |||
5 | import { | 5 | import { |
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' |
15 | import { VideoCreateResult } from '@shared/models' | 15 | import { VideoCreateResult } from '@shared/models' |
@@ -17,7 +17,7 @@ import { VideoCreateResult } from '@shared/models' | |||
17 | describe('Test video captions API validator', function () { | 17 | describe('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' |
22 | import { VideoChannelUpdate } from '@shared/models' | 22 | import { VideoChannelUpdate } from '@shared/models' |
@@ -25,7 +25,7 @@ const expect = chai.expect | |||
25 | 25 | ||
26 | describe('Test video channels API validator', function () { | 26 | describe('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' |
18 | import { VideoCreateResult } from '@shared/models' | 18 | import { VideoCreateResult } from '@shared/models' |
@@ -22,7 +22,7 @@ const expect = chai.expect | |||
22 | describe('Test video comments API validator', function () { | 22 | describe('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' |
20 | import { VideoPrivacy } from '@shared/models' | 20 | import { VideoPrivacy } from '@shared/models' |
21 | 21 | ||
22 | describe('Test video imports API validator', function () { | 22 | describe('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 | ||
27 | describe('Test video playlists API validator', function () { | 27 | describe('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 @@ | |||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import { | 4 | import { |
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' |
12 | import { UserRole } from '../../../../shared/models/users' | 12 | import { UserRole } from '../../../../shared/models/users' |
13 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | 13 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' |
14 | 14 | ||
15 | async function testEndpoints (server: ServerInfo, token: string, filter: string, statusCodeExpected: HttpStatusCode) { | 15 | async 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 | ||
36 | describe('Test video filters validators', function () { | 36 | describe('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 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import { cleanupTests, flushAndRunServer, ServerInfo } from '@shared/extra-utils' | 4 | import { cleanupTests, createSingleServer, PeerTubeServer } from '@shared/extra-utils' |
5 | 5 | ||
6 | describe('Test videos overview', function () { | 6 | describe('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' |
23 | import { PeerTubeProblemDocument, VideoCreateResult, VideoPrivacy } from '@shared/models' | 23 | import { PeerTubeProblemDocument, VideoCreateResult, VideoPrivacy } from '@shared/models' |
@@ -26,7 +26,7 @@ const expect = chai.expect | |||
26 | 26 | ||
27 | describe('Test videos API validator', function () { | 27 | describe('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 { | |||
19 | const expect = chai.expect | 19 | const expect = chai.expect |
20 | 20 | ||
21 | describe('Test live constraints', function () { | 21 | describe('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 { | |||
19 | const expect = chai.expect | 19 | const expect = chai.expect |
20 | 20 | ||
21 | describe('Permanent live', function () { | 21 | describe('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' | |||
23 | const expect = chai.expect | 23 | const expect = chai.expect |
24 | 24 | ||
25 | describe('Save replay setting', function () { | 25 | describe('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' | |||
6 | import { | 6 | import { |
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 { | |||
19 | const expect = chai.expect | 19 | const expect = chai.expect |
20 | 20 | ||
21 | describe('Test live', function () { | 21 | describe('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' | |||
7 | import { | 7 | import { |
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 { | |||
20 | const expect = chai.expect | 20 | const expect = chai.expect |
21 | 21 | ||
22 | describe('Test live', function () { | 22 | describe('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 | |||
32 | const expect = chai.expect | 31 | const expect = chai.expect |
33 | 32 | ||
34 | describe('Test live', function () { | 33 | describe('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 | |||
16 | const expect = chai.expect | 16 | const expect = chai.expect |
17 | 17 | ||
18 | describe('Test abuses', function () { | 18 | describe('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 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { cleanupTests, doubleFollow, flushAndRunMultipleServers, ServerInfo, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' | 5 | import { cleanupTests, doubleFollow, createMultipleServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' |
6 | import { UserNotificationType } from '@shared/models' | 6 | import { UserNotificationType } from '@shared/models' |
7 | 7 | ||
8 | const expect = chai.expect | 8 | const expect = chai.expect |
9 | 9 | ||
10 | async function checkNotifications (server: ServerInfo, token: string, expected: UserNotificationType[]) { | 10 | async 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 | ||
19 | describe('Test blocklist', function () { | 19 | describe('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 | ||
17 | const expect = chai.expect | 17 | const expect = chai.expect |
18 | 18 | ||
19 | async function checkAllVideos (server: ServerInfo, token: string) { | 19 | async 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 | ||
31 | async function checkAllComments (server: ServerInfo, token: string, videoUUID: string) { | 31 | async 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 | ||
43 | async function checkCommentNotification ( | 43 | async 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 | ||
65 | describe('Test blocklist', function () { | 65 | describe('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 | |||
20 | const expect = chai.expect | 19 | const expect = chai.expect |
21 | 20 | ||
22 | describe('Test video blacklist', function () { | 21 | describe('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' |
16 | import { PluginType, UserNotification, UserNotificationType } from '@shared/models' | 16 | import { PluginType, UserNotification, UserNotificationType } from '@shared/models' |
17 | 17 | ||
18 | describe('Test admin notifications', function () { | 18 | describe('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' |
15 | import { UserNotification } from '@shared/models' | 15 | import { UserNotification } from '@shared/models' |
@@ -17,7 +17,7 @@ import { UserNotification } from '@shared/models' | |||
17 | const expect = chai.expect | 17 | const expect = chai.expect |
18 | 18 | ||
19 | describe('Test comments notifications', function () { | 19 | describe('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' |
27 | import { AbuseState, CustomConfig, UserNotification, VideoPrivacy } from '@shared/models' | 27 | import { AbuseState, CustomConfig, UserNotification, VideoPrivacy } from '@shared/models' |
28 | 28 | ||
29 | describe('Test moderation notifications', function () { | 29 | describe('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' |
15 | import { UserNotification, UserNotificationSettingValue } from '@shared/models' | 15 | import { UserNotification, UserNotificationSettingValue } from '@shared/models' |
@@ -17,7 +17,7 @@ import { UserNotification, UserNotificationSettingValue } from '@shared/models' | |||
17 | const expect = chai.expect | 17 | const expect = chai.expect |
18 | 18 | ||
19 | describe('Test notifications API', function () { | 19 | describe('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 | |||
23 | const expect = chai.expect | 23 | const expect = chai.expect |
24 | 24 | ||
25 | describe('Test user notifications', function () { | 25 | describe('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' | |||
5 | import { | 5 | import { |
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 | |||
18 | describe('Test manage videos redundancy', function () { | 18 | describe('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' | |||
4 | import { expect } from 'chai' | 4 | import { expect } from 'chai' |
5 | import { | 5 | import { |
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' |
14 | import { VideoPrivacy } from '@shared/models' | 13 | import { VideoPrivacy } from '@shared/models' |
15 | 14 | ||
16 | describe('Test redundancy constraints', function () { | 15 | describe('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 | ||
26 | const expect = chai.expect | 25 | const expect = chai.expect |
27 | 26 | ||
28 | let servers: ServerInfo[] = [] | 27 | let servers: PeerTubeServer[] = [] |
29 | let video1Server2UUID: string | 28 | let video1Server2UUID: string |
30 | let video1Server2Id: number | 29 | let video1Server2Id: number |
31 | 30 | ||
32 | function checkMagnetWebseeds (file: { magnetUri: string, resolution: { id: number } }, baseWebseeds: string[], server: ServerInfo) { | 31 | function 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 | ||
43 | async function flushAndRunServers (strategy: VideoRedundancyStrategy | null, additionalParams: any = {}, withWebtorrent = true) { | 42 | async 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' | |||
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { | 5 | import { |
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' | |||
16 | const expect = chai.expect | 16 | const expect = chai.expect |
17 | 17 | ||
18 | describe('Test ActivityPub video channels search', function () { | 18 | describe('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' | |||
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { | 5 | import { |
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' | |||
17 | const expect = chai.expect | 17 | const expect = chai.expect |
18 | 18 | ||
19 | describe('Test ActivityPub playlists search', function () { | 19 | describe('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' | |||
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { | 5 | import { |
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' | |||
16 | const expect = chai.expect | 16 | const expect = chai.expect |
17 | 17 | ||
18 | describe('Test ActivityPub videos search', function () { | 18 | describe('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 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { cleanupTests, flushAndRunServer, SearchCommand, ServerInfo, setAccessTokensToServers } from '@shared/extra-utils' | 5 | import { cleanupTests, createSingleServer, SearchCommand, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils' |
6 | import { VideoChannel } from '@shared/models' | 6 | import { VideoChannel } from '@shared/models' |
7 | 7 | ||
8 | const expect = chai.expect | 8 | const expect = chai.expect |
9 | 9 | ||
10 | describe('Test channels search', function () { | 10 | describe('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 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { cleanupTests, flushAndRunServer, SearchCommand, ServerInfo, setAccessTokensToServers } from '@shared/extra-utils' | 5 | import { cleanupTests, createSingleServer, SearchCommand, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils' |
6 | import { BooleanBothQuery, VideoPlaylistPrivacy, VideoPlaylistType, VideosSearchQuery } from '@shared/models' | 6 | import { BooleanBothQuery, VideoPlaylistPrivacy, VideoPlaylistType, VideosSearchQuery } from '@shared/models' |
7 | 7 | ||
8 | const expect = chai.expect | 8 | const expect = chai.expect |
@@ -10,13 +10,13 @@ const expect = chai.expect | |||
10 | describe('Test videos search', function () { | 10 | describe('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' | |||
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { | 5 | import { |
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' | |||
15 | const expect = chai.expect | 15 | const expect = chai.expect |
16 | 16 | ||
17 | describe('Test playlists search', function () { | 17 | describe('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' | |||
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { | 5 | import { |
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' | |||
17 | const expect = chai.expect | 17 | const expect = chai.expect |
18 | 18 | ||
19 | describe('Test videos search', function () { | 19 | describe('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' | |||
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { | 5 | import { |
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 | ||
15 | const expect = chai.expect | 15 | const expect = chai.expect |
16 | 16 | ||
17 | async function checkFollow (follower: ServerInfo, following: ServerInfo, exists: boolean) { | 17 | async 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 | ||
35 | async function server1Follows2 (servers: ServerInfo[]) { | 35 | async 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 | ||
41 | async function resetFollows (servers: ServerInfo[]) { | 41 | async 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 | ||
54 | describe('Test auto follows', function () { | 54 | describe('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 | |||
17 | describe('Test bulk actions', function () { | 17 | describe('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' | |||
5 | import { HttpStatusCode } from '@shared/core-utils' | 5 | import { HttpStatusCode } from '@shared/core-utils' |
6 | import { | 6 | import { |
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' |
16 | import { CustomConfig } from '@shared/models' | 15 | import { CustomConfig } from '@shared/models' |
17 | 16 | ||
18 | const expect = chai.expect | 17 | const expect = chai.expect |
19 | 18 | ||
20 | function checkInitialConfig (server: ServerInfo, data: CustomConfig) { | 19 | function 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 | ||
206 | describe('Test config', function () { | 205 | describe('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 @@ | |||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { HttpStatusCode } from '@shared/core-utils' | 5 | import { HttpStatusCode } from '@shared/core-utils' |
6 | import { cleanupTests, flushAndRunServer, MockSmtpServer, ServerInfo, setAccessTokensToServers, wait, waitJobs } from '@shared/extra-utils' | 6 | import { |
7 | import { 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 | ||
9 | const expect = chai.expect | 17 | const expect = chai.expect |
10 | 18 | ||
11 | describe('Test contact form', function () { | 19 | describe('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 @@ | |||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { HttpStatusCode } from '@shared/core-utils' | 5 | import { HttpStatusCode } from '@shared/core-utils' |
6 | import { cleanupTests, flushAndRunServer, MockSmtpServer, ServerInfo, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' | 6 | import { cleanupTests, createSingleServer, MockSmtpServer, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' |
7 | 7 | ||
8 | const expect = chai.expect | 8 | const expect = chai.expect |
9 | 9 | ||
10 | describe('Test emails', function () { | 10 | describe('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 @@ | |||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { HttpStatusCode } from '@shared/core-utils' | 5 | import { HttpStatusCode } from '@shared/core-utils' |
6 | import { cleanupTests, doubleFollow, flushAndRunMultipleServers, ServerInfo, setAccessTokensToServers } from '@shared/extra-utils' | 6 | import { cleanupTests, doubleFollow, createMultipleServers, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils' |
7 | import { PeerTubeProblemDocument, ServerErrorCode } from '@shared/models' | 7 | import { PeerTubeProblemDocument, ServerErrorCode } from '@shared/models' |
8 | 8 | ||
9 | const expect = chai.expect | 9 | const expect = chai.expect |
10 | 10 | ||
11 | describe('Test follow constraints', function () { | 11 | describe('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' | |||
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { | 5 | import { |
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 | ||
14 | const expect = chai.expect | 14 | const expect = chai.expect |
15 | 15 | ||
16 | async function checkServer1And2HasFollowers (servers: ServerInfo[], state = 'accepted') { | 16 | async 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 | ||
33 | async function checkNoFollowers (servers: ServerInfo[]) { | 33 | async 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 | ||
45 | describe('Test follows moderation', function () { | 45 | describe('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' | |||
19 | const expect = chai.expect | 19 | const expect = chai.expect |
20 | 20 | ||
21 | describe('Test follows', function () { | 21 | describe('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' | |||
20 | const expect = chai.expect | 19 | const expect = chai.expect |
21 | 20 | ||
22 | describe('Test handle downs', function () { | 21 | describe('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' | |||
6 | import { | 6 | import { |
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 | ||
16 | const expect = chai.expect | 15 | const expect = chai.expect |
17 | 16 | ||
18 | async function getHomepageState (server: ServerInfo) { | 17 | async 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 | ||
24 | describe('Test instance homepage actions', function () { | 23 | describe('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 { | |||
15 | const expect = chai.expect | 15 | const expect = chai.expect |
16 | 16 | ||
17 | describe('Test jobs', function () { | 17 | describe('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' | |||
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { | 5 | import { |
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 { | |||
16 | const expect = chai.expect | 15 | const expect = chai.expect |
17 | 16 | ||
18 | describe('Test logs', function () { | 17 | describe('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 @@ | |||
1 | import 'mocha' | 1 | import 'mocha' |
2 | import * as request from 'supertest' | 2 | import * as request from 'supertest' |
3 | import { ServerInfo } from '../../../../shared/extra-utils' | 3 | import { PeerTubeServer } from '../../../../shared/extra-utils' |
4 | import { cleanupTests, flushAndRunServer } from '../../../../shared/extra-utils/server/servers' | 4 | import { cleanupTests, createSingleServer } from '../../../../shared/extra-utils/server/servers' |
5 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | 5 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' |
6 | 6 | ||
7 | describe('Start and stop server without web client routes', function () { | 7 | describe('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' | |||
5 | import { HttpStatusCode } from '@shared/core-utils' | 5 | import { HttpStatusCode } from '@shared/core-utils' |
6 | import { | 6 | import { |
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' | |||
19 | const expect = chai.expect | 18 | const expect = chai.expect |
20 | 19 | ||
21 | describe('Test plugins', function () { | 20 | describe('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 | ||
3 | import { expect } from 'chai' | 3 | import { expect } from 'chai' |
4 | import { HttpStatusCode } from '@shared/core-utils' | 4 | import { HttpStatusCode } from '@shared/core-utils' |
5 | import { cleanupTests, flushAndRunServer, ServerInfo, setAccessTokensToServers, wait } from '@shared/extra-utils' | 5 | import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers, wait } from '@shared/extra-utils' |
6 | 6 | ||
7 | describe('Test application behind a reverse proxy', function () { | 7 | describe('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 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { cleanupTests, flushAndRunServer, ServerInfo, setAccessTokensToServers, setDefaultVideoChannel } from '@shared/extra-utils' | 5 | import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers, setDefaultVideoChannel } from '@shared/extra-utils' |
6 | import { Video, VideoPlaylistPrivacy } from '@shared/models' | 6 | import { Video, VideoPlaylistPrivacy } from '@shared/models' |
7 | 7 | ||
8 | const expect = chai.expect | 8 | const expect = chai.expect |
9 | 9 | ||
10 | describe('Test services', function () { | 10 | describe('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' | |||
5 | import { | 5 | import { |
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' | |||
16 | const expect = chai.expect | 16 | const expect = chai.expect |
17 | 17 | ||
18 | describe('Test stats (excluding redundancy)', function () { | 18 | describe('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 @@ | |||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as magnetUtil from 'magnet-uri' | 4 | import * as magnetUtil from 'magnet-uri' |
5 | import * as WebTorrent from 'webtorrent' | 5 | import * as WebTorrent from 'webtorrent' |
6 | import { cleanupTests, flushAndRunServer, killallServers, reRunServer, ServerInfo, setAccessTokensToServers } from '@shared/extra-utils' | 6 | import { cleanupTests, createSingleServer, killallServers, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils' |
7 | 7 | ||
8 | describe('Test tracker', function () { | 8 | describe('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' | |||
5 | import { | 5 | import { |
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 { | |||
15 | const expect = chai.expect | 15 | const expect = chai.expect |
16 | 16 | ||
17 | describe('Test users subscriptions', function () { | 17 | describe('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' | |||
19 | const expect = chai.expect | 19 | const expect = chai.expect |
20 | 20 | ||
21 | describe('Test users with multiple servers', function () { | 21 | describe('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 @@ | |||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { HttpStatusCode } from '@shared/core-utils' | 5 | import { HttpStatusCode } from '@shared/core-utils' |
6 | import { cleanupTests, flushAndRunServer, MockSmtpServer, ServerInfo, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' | 6 | import { cleanupTests, createSingleServer, MockSmtpServer, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' |
7 | 7 | ||
8 | const expect = chai.expect | 8 | const expect = chai.expect |
9 | 9 | ||
10 | describe('Test users account verification', function () { | 10 | describe('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' | |||
5 | import { HttpStatusCode } from '@shared/core-utils' | 5 | import { HttpStatusCode } from '@shared/core-utils' |
6 | import { | 6 | import { |
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 | |||
19 | const expect = chai.expect | 18 | const expect = chai.expect |
20 | 19 | ||
21 | describe('Test users', function () { | 20 | describe('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' | |||
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { join } from 'path' | 5 | import { join } from 'path' |
6 | import { getAudioStream, getVideoStreamSize } from '@server/helpers/ffprobe-utils' | 6 | import { getAudioStream, getVideoStreamSize } from '@server/helpers/ffprobe-utils' |
7 | import { cleanupTests, doubleFollow, flushAndRunMultipleServers, ServerInfo, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' | 7 | import { cleanupTests, doubleFollow, createMultipleServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' |
8 | 8 | ||
9 | const expect = chai.expect | 9 | const expect = chai.expect |
10 | 10 | ||
11 | describe('Test audio only video transcoding', function () { | 11 | describe('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' | |||
25 | const expect = chai.expect | 25 | const expect = chai.expect |
26 | 26 | ||
27 | describe('Test multiple servers', function () { | 27 | describe('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' | |||
8 | import { | 8 | import { |
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 | ||
22 | describe('Test resumable upload', function () { | 22 | describe('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 | |||
19 | describe('Test a single server', function () { | 19 | describe('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 | |||
19 | describe('Test video captions', function () { | 19 | describe('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' | |||
19 | const expect = chai.expect | 19 | const expect = chai.expect |
20 | 20 | ||
21 | describe('Test video change ownership - nominal', function () { | 21 | describe('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 | ||
253 | describe('Test video change ownership - quota too small', function () { | 253 | describe('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' | |||
7 | import { | 7 | import { |
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 | ||
21 | const expect = chai.expect | 21 | const expect = chai.expect |
22 | 22 | ||
23 | async function findChannel (server: ServerInfo, channelId: number) { | 23 | async 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 | ||
29 | describe('Test video channels', function () { | 29 | describe('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 { | |||
15 | const expect = chai.expect | 15 | const expect = chai.expect |
16 | 16 | ||
17 | describe('Test video comments', function () { | 17 | describe('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 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { cleanupTests, doubleFollow, flushAndRunMultipleServers, ServerInfo, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' | 5 | import { cleanupTests, doubleFollow, createMultipleServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' |
6 | 6 | ||
7 | const expect = chai.expect | 7 | const expect = chai.expect |
8 | 8 | ||
9 | describe('Test video description', function () { | 9 | describe('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 | ||
24 | const expect = chai.expect | 24 | const expect = chai.expect |
25 | 25 | ||
26 | async function checkHlsPlaylist (servers: ServerInfo[], videoUUID: string, hlsOnly: boolean, resolutions = [ 240, 360, 480, 720 ]) { | 26 | async 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 | ||
100 | describe('Test HLS videos', function () { | 100 | describe('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' | |||
19 | const expect = chai.expect | 19 | const expect = chai.expect |
20 | 20 | ||
21 | describe('Test video imports', function () { | 21 | describe('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 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { cleanupTests, flushAndRunServer, ServerInfo, setAccessTokensToServers } from '@shared/extra-utils' | 5 | import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils' |
6 | import { BooleanBothQuery, CustomConfig, ResultList, Video, VideosOverview } from '@shared/models' | 6 | import { BooleanBothQuery, CustomConfig, ResultList, Video, VideosOverview } from '@shared/models' |
7 | 7 | ||
8 | const expect = chai.expect | 8 | const expect = chai.expect |
@@ -13,7 +13,7 @@ function createOverviewRes (overview: VideosOverview) { | |||
13 | } | 13 | } |
14 | 14 | ||
15 | describe('Test video NSFW policy', function () { | 15 | describe('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' | |||
5 | import { | 5 | import { |
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/ | |||
17 | const expect = chai.expect | 17 | const expect = chai.expect |
18 | 18 | ||
19 | describe('Playlist thumbnail', function () { | 19 | describe('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 { | |||
28 | const expect = chai.expect | 28 | const expect = chai.expect |
29 | 29 | ||
30 | async function checkPlaylistElementType ( | 30 | async 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 | ||
54 | describe('Test video playlists', function () { | 54 | describe('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 @@ | |||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { HttpStatusCode } from '@shared/core-utils' | 5 | import { HttpStatusCode } from '@shared/core-utils' |
6 | import { cleanupTests, doubleFollow, flushAndRunServer, ServerInfo, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' | 6 | import { cleanupTests, doubleFollow, createSingleServer, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' |
7 | import { VideoCreateResult, VideoPrivacy } from '@shared/models' | 7 | import { VideoCreateResult, VideoPrivacy } from '@shared/models' |
8 | 8 | ||
9 | const expect = chai.expect | 9 | const expect = chai.expect |
10 | 10 | ||
11 | describe('Test video privacy', function () { | 11 | describe('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' | |||
5 | import { | 5 | import { |
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 | ||
25 | describe('Test video update scheduler', function () { | 25 | describe('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 | ||
32 | const expect = chai.expect | 32 | const expect = chai.expect |
33 | 33 | ||
34 | function updateConfigForTranscoding (server: ServerInfo) { | 34 | function 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 | ||
58 | describe('Test video transcoding', function () { | 58 | describe('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' | |||
6 | import { | 6 | import { |
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' |
14 | import { UserRole, Video, VideoPrivacy } from '@shared/models' | 14 | import { UserRole, Video, VideoPrivacy } from '@shared/models' |
15 | 15 | ||
16 | async function getVideosNames (server: ServerInfo, token: string, filter: string, statusCodeExpected = HttpStatusCode.OK_200) { | 16 | async 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 | ||
44 | describe('Test videos filter', function () { | 44 | describe('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' | |||
5 | import { HttpStatusCode } from '@shared/core-utils' | 5 | import { HttpStatusCode } from '@shared/core-utils' |
6 | import { | 6 | import { |
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' | |||
18 | const expect = chai.expect | 17 | const expect = chai.expect |
19 | 18 | ||
20 | describe('Test videos history', function () { | 19 | describe('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 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { cleanupTests, flushAndRunServer, ServerInfo, setAccessTokensToServers, wait } from '@shared/extra-utils' | 5 | import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers, wait } from '@shared/extra-utils' |
6 | import { VideosOverview } from '@shared/models' | 6 | import { VideosOverview } from '@shared/models' |
7 | 7 | ||
8 | const expect = chai.expect | 8 | const expect = chai.expect |
9 | 9 | ||
10 | describe('Test a videos overview', function () { | 10 | describe('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' | |||
5 | import { | 5 | import { |
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 { | |||
17 | const expect = chai.expect | 16 | const expect = chai.expect |
18 | 17 | ||
19 | describe('Test video views cleaner', function () { | 18 | describe('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 | ||
diff --git a/server/tests/cli/create-import-video-file-job.ts b/server/tests/cli/create-import-video-file-job.ts index 26f4bdc8d..e8cd71e09 100644 --- a/server/tests/cli/create-import-video-file-job.ts +++ b/server/tests/cli/create-import-video-file-job.ts | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { cleanupTests, doubleFollow, flushAndRunMultipleServers, ServerInfo, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' | 5 | import { cleanupTests, doubleFollow, createMultipleServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' |
6 | import { VideoFile } from '@shared/models' | 6 | import { VideoFile } from '@shared/models' |
7 | 7 | ||
8 | const expect = chai.expect | 8 | const expect = chai.expect |
@@ -20,7 +20,7 @@ function assertVideoProperties (video: VideoFile, resolution: number, extname: s | |||
20 | describe('Test create import video jobs', function () { | 20 | describe('Test create import video jobs', function () { |
21 | this.timeout(60000) | 21 | this.timeout(60000) |
22 | 22 | ||
23 | let servers: ServerInfo[] = [] | 23 | let servers: PeerTubeServer[] = [] |
24 | let video1UUID: string | 24 | let video1UUID: string |
25 | let video2UUID: string | 25 | let video2UUID: string |
26 | 26 | ||
@@ -28,7 +28,7 @@ describe('Test create import video jobs', function () { | |||
28 | this.timeout(90000) | 28 | this.timeout(90000) |
29 | 29 | ||
30 | // Run server 2 to have transcoding enabled | 30 | // Run server 2 to have transcoding enabled |
31 | servers = await flushAndRunMultipleServers(2) | 31 | servers = await createMultipleServers(2) |
32 | await setAccessTokensToServers(servers) | 32 | await setAccessTokensToServers(servers) |
33 | 33 | ||
34 | await doubleFollow(servers[0], servers[1]) | 34 | await doubleFollow(servers[0], servers[1]) |
diff --git a/server/tests/cli/create-transcoding-job.ts b/server/tests/cli/create-transcoding-job.ts index c9bbab802..53f187f90 100644 --- a/server/tests/cli/create-transcoding-job.ts +++ b/server/tests/cli/create-transcoding-job.ts | |||
@@ -5,8 +5,8 @@ import * as chai from 'chai' | |||
5 | import { | 5 | import { |
6 | cleanupTests, | 6 | cleanupTests, |
7 | doubleFollow, | 7 | doubleFollow, |
8 | flushAndRunMultipleServers, | 8 | createMultipleServers, |
9 | ServerInfo, | 9 | PeerTubeServer, |
10 | setAccessTokensToServers, | 10 | setAccessTokensToServers, |
11 | waitJobs | 11 | waitJobs |
12 | } from '../../../shared/extra-utils' | 12 | } from '../../../shared/extra-utils' |
@@ -14,7 +14,7 @@ import { | |||
14 | const expect = chai.expect | 14 | const expect = chai.expect |
15 | 15 | ||
16 | describe('Test create transcoding jobs', function () { | 16 | describe('Test create transcoding jobs', function () { |
17 | let servers: ServerInfo[] = [] | 17 | let servers: PeerTubeServer[] = [] |
18 | const videosUUID: string[] = [] | 18 | const videosUUID: string[] = [] |
19 | 19 | ||
20 | const config = { | 20 | const config = { |
@@ -39,7 +39,7 @@ describe('Test create transcoding jobs', function () { | |||
39 | this.timeout(60000) | 39 | this.timeout(60000) |
40 | 40 | ||
41 | // Run server 2 to have transcoding enabled | 41 | // Run server 2 to have transcoding enabled |
42 | servers = await flushAndRunMultipleServers(2) | 42 | servers = await createMultipleServers(2) |
43 | await setAccessTokensToServers(servers) | 43 | await setAccessTokensToServers(servers) |
44 | 44 | ||
45 | await servers[0].config.updateCustomSubConfig({ newConfig: config }) | 45 | await servers[0].config.updateCustomSubConfig({ newConfig: config }) |
diff --git a/server/tests/cli/optimize-old-videos.ts b/server/tests/cli/optimize-old-videos.ts index eefc95a6d..53f47a85e 100644 --- a/server/tests/cli/optimize-old-videos.ts +++ b/server/tests/cli/optimize-old-videos.ts | |||
@@ -6,9 +6,9 @@ import { join } from 'path' | |||
6 | import { | 6 | import { |
7 | cleanupTests, | 7 | cleanupTests, |
8 | doubleFollow, | 8 | doubleFollow, |
9 | flushAndRunMultipleServers, | 9 | createMultipleServers, |
10 | generateHighBitrateVideo, | 10 | generateHighBitrateVideo, |
11 | ServerInfo, | 11 | PeerTubeServer, |
12 | setAccessTokensToServers, | 12 | setAccessTokensToServers, |
13 | wait, | 13 | wait, |
14 | waitJobs | 14 | waitJobs |
@@ -20,13 +20,13 @@ import { VIDEO_TRANSCODING_FPS } from '../../initializers/constants' | |||
20 | const expect = chai.expect | 20 | const expect = chai.expect |
21 | 21 | ||
22 | describe('Test optimize old videos', function () { | 22 | describe('Test optimize old videos', function () { |
23 | let servers: ServerInfo[] = [] | 23 | let servers: PeerTubeServer[] = [] |
24 | 24 | ||
25 | before(async function () { | 25 | before(async function () { |
26 | this.timeout(200000) | 26 | this.timeout(200000) |
27 | 27 | ||
28 | // Run server 2 to have transcoding enabled | 28 | // Run server 2 to have transcoding enabled |
29 | servers = await flushAndRunMultipleServers(2) | 29 | servers = await createMultipleServers(2) |
30 | await setAccessTokensToServers(servers) | 30 | await setAccessTokensToServers(servers) |
31 | 31 | ||
32 | await doubleFollow(servers[0], servers[1]) | 32 | await doubleFollow(servers[0], servers[1]) |
diff --git a/server/tests/cli/peertube.ts b/server/tests/cli/peertube.ts index a83aa7724..f19b6ae22 100644 --- a/server/tests/cli/peertube.ts +++ b/server/tests/cli/peertube.ts | |||
@@ -8,16 +8,16 @@ import { | |||
8 | cleanupTests, | 8 | cleanupTests, |
9 | CLICommand, | 9 | CLICommand, |
10 | doubleFollow, | 10 | doubleFollow, |
11 | flushAndRunServer, | 11 | createSingleServer, |
12 | ImportsCommand, | 12 | ImportsCommand, |
13 | ServerInfo, | 13 | PeerTubeServer, |
14 | setAccessTokensToServers, | 14 | setAccessTokensToServers, |
15 | testHelloWorldRegisteredSettings, | 15 | testHelloWorldRegisteredSettings, |
16 | waitJobs | 16 | waitJobs |
17 | } from '../../../shared/extra-utils' | 17 | } from '../../../shared/extra-utils' |
18 | 18 | ||
19 | describe('Test CLI wrapper', function () { | 19 | describe('Test CLI wrapper', function () { |
20 | let server: ServerInfo | 20 | let server: PeerTubeServer |
21 | let userAccessToken: string | 21 | let userAccessToken: string |
22 | 22 | ||
23 | let cliCommand: CLICommand | 23 | let cliCommand: CLICommand |
@@ -27,7 +27,7 @@ describe('Test CLI wrapper', function () { | |||
27 | before(async function () { | 27 | before(async function () { |
28 | this.timeout(30000) | 28 | this.timeout(30000) |
29 | 29 | ||
30 | server = await flushAndRunServer(1) | 30 | server = await createSingleServer(1) |
31 | await setAccessTokensToServers([ server ]) | 31 | await setAccessTokensToServers([ server ]) |
32 | 32 | ||
33 | await server.users.create({ username: 'user_1', password: 'super_password' }) | 33 | await server.users.create({ username: 'user_1', password: 'super_password' }) |
@@ -210,14 +210,14 @@ describe('Test CLI wrapper', function () { | |||
210 | }) | 210 | }) |
211 | 211 | ||
212 | describe('Manage video redundancies', function () { | 212 | describe('Manage video redundancies', function () { |
213 | let anotherServer: ServerInfo | 213 | let anotherServer: PeerTubeServer |
214 | let video1Server2: number | 214 | let video1Server2: number |
215 | let servers: ServerInfo[] | 215 | let servers: PeerTubeServer[] |
216 | 216 | ||
217 | before(async function () { | 217 | before(async function () { |
218 | this.timeout(120000) | 218 | this.timeout(120000) |
219 | 219 | ||
220 | anotherServer = await flushAndRunServer(2) | 220 | anotherServer = await createSingleServer(2) |
221 | await setAccessTokensToServers([ anotherServer ]) | 221 | await setAccessTokensToServers([ anotherServer ]) |
222 | 222 | ||
223 | await doubleFollow(server, anotherServer) | 223 | await doubleFollow(server, anotherServer) |
diff --git a/server/tests/cli/plugins.ts b/server/tests/cli/plugins.ts index 178a7a2d9..42651d79c 100644 --- a/server/tests/cli/plugins.ts +++ b/server/tests/cli/plugins.ts | |||
@@ -4,21 +4,20 @@ import 'mocha' | |||
4 | import { expect } from 'chai' | 4 | import { expect } from 'chai' |
5 | import { | 5 | import { |
6 | cleanupTests, | 6 | cleanupTests, |
7 | flushAndRunServer, | 7 | createSingleServer, |
8 | killallServers, | 8 | killallServers, |
9 | PluginsCommand, | 9 | PluginsCommand, |
10 | reRunServer, | 10 | PeerTubeServer, |
11 | ServerInfo, | ||
12 | setAccessTokensToServers | 11 | setAccessTokensToServers |
13 | } from '../../../shared/extra-utils' | 12 | } from '../../../shared/extra-utils' |
14 | 13 | ||
15 | describe('Test plugin scripts', function () { | 14 | describe('Test plugin scripts', function () { |
16 | let server: ServerInfo | 15 | let server: PeerTubeServer |
17 | 16 | ||
18 | before(async function () { | 17 | before(async function () { |
19 | this.timeout(30000) | 18 | this.timeout(30000) |
20 | 19 | ||
21 | server = await flushAndRunServer(1) | 20 | server = await createSingleServer(1) |
22 | await setAccessTokensToServers([ server ]) | 21 | await setAccessTokensToServers([ server ]) |
23 | }) | 22 | }) |
24 | 23 | ||
@@ -40,7 +39,7 @@ describe('Test plugin scripts', function () { | |||
40 | this.timeout(30000) | 39 | this.timeout(30000) |
41 | 40 | ||
42 | await killallServers([ server ]) | 41 | await killallServers([ server ]) |
43 | await reRunServer(server) | 42 | await server.run() |
44 | 43 | ||
45 | const config = await server.config.getConfig() | 44 | const config = await server.config.getConfig() |
46 | 45 | ||
@@ -63,7 +62,7 @@ describe('Test plugin scripts', function () { | |||
63 | this.timeout(30000) | 62 | this.timeout(30000) |
64 | 63 | ||
65 | await killallServers([ server ]) | 64 | await killallServers([ server ]) |
66 | await reRunServer(server) | 65 | await server.run() |
67 | 66 | ||
68 | const config = await server.config.getConfig() | 67 | const config = await server.config.getConfig() |
69 | 68 | ||
diff --git a/server/tests/cli/prune-storage.ts b/server/tests/cli/prune-storage.ts index 9912a36e0..5bf86462b 100644 --- a/server/tests/cli/prune-storage.ts +++ b/server/tests/cli/prune-storage.ts | |||
@@ -10,10 +10,10 @@ import { | |||
10 | cleanupTests, | 10 | cleanupTests, |
11 | CLICommand, | 11 | CLICommand, |
12 | doubleFollow, | 12 | doubleFollow, |
13 | flushAndRunMultipleServers, | 13 | createMultipleServers, |
14 | killallServers, | 14 | killallServers, |
15 | makeGetRequest, | 15 | makeGetRequest, |
16 | ServerInfo, | 16 | PeerTubeServer, |
17 | setAccessTokensToServers, | 17 | setAccessTokensToServers, |
18 | setDefaultVideoChannel, | 18 | setDefaultVideoChannel, |
19 | wait, | 19 | wait, |
@@ -23,13 +23,13 @@ import { VideoPlaylistPrivacy } from '@shared/models' | |||
23 | 23 | ||
24 | const expect = chai.expect | 24 | const expect = chai.expect |
25 | 25 | ||
26 | async function countFiles (server: ServerInfo, directory: string) { | 26 | async function countFiles (server: PeerTubeServer, directory: string) { |
27 | const files = await readdir(server.servers.buildDirectory(directory)) | 27 | const files = await readdir(server.servers.buildDirectory(directory)) |
28 | 28 | ||
29 | return files.length | 29 | return files.length |
30 | } | 30 | } |
31 | 31 | ||
32 | async function assertNotExists (server: ServerInfo, directory: string, substring: string) { | 32 | async function assertNotExists (server: PeerTubeServer, directory: string, substring: string) { |
33 | const files = await readdir(server.servers.buildDirectory(directory)) | 33 | const files = await readdir(server.servers.buildDirectory(directory)) |
34 | 34 | ||
35 | for (const f of files) { | 35 | for (const f of files) { |
@@ -37,7 +37,7 @@ async function assertNotExists (server: ServerInfo, directory: string, substring | |||
37 | } | 37 | } |
38 | } | 38 | } |
39 | 39 | ||
40 | async function assertCountAreOkay (servers: ServerInfo[]) { | 40 | async function assertCountAreOkay (servers: PeerTubeServer[]) { |
41 | for (const server of servers) { | 41 | for (const server of servers) { |
42 | const videosCount = await countFiles(server, 'videos') | 42 | const videosCount = await countFiles(server, 'videos') |
43 | expect(videosCount).to.equal(8) | 43 | expect(videosCount).to.equal(8) |
@@ -57,13 +57,13 @@ async function assertCountAreOkay (servers: ServerInfo[]) { | |||
57 | } | 57 | } |
58 | 58 | ||
59 | describe('Test prune storage scripts', function () { | 59 | describe('Test prune storage scripts', function () { |
60 | let servers: ServerInfo[] | 60 | let servers: PeerTubeServer[] |
61 | const badNames: { [directory: string]: string[] } = {} | 61 | const badNames: { [directory: string]: string[] } = {} |
62 | 62 | ||
63 | before(async function () { | 63 | before(async function () { |
64 | this.timeout(120000) | 64 | this.timeout(120000) |
65 | 65 | ||
66 | servers = await flushAndRunMultipleServers(2, { transcoding: { enabled: true } }) | 66 | servers = await createMultipleServers(2, { transcoding: { enabled: true } }) |
67 | await setAccessTokensToServers(servers) | 67 | await setAccessTokensToServers(servers) |
68 | await setDefaultVideoChannel(servers) | 68 | await setDefaultVideoChannel(servers) |
69 | 69 | ||
diff --git a/server/tests/cli/regenerate-thumbnails.ts b/server/tests/cli/regenerate-thumbnails.ts index 2df1a1157..d532a5c2b 100644 --- a/server/tests/cli/regenerate-thumbnails.ts +++ b/server/tests/cli/regenerate-thumbnails.ts | |||
@@ -7,14 +7,14 @@ import { Video } from '@shared/models' | |||
7 | import { | 7 | import { |
8 | cleanupTests, | 8 | cleanupTests, |
9 | doubleFollow, | 9 | doubleFollow, |
10 | flushAndRunMultipleServers, | 10 | createMultipleServers, |
11 | makeRawRequest, | 11 | makeRawRequest, |
12 | ServerInfo, | 12 | PeerTubeServer, |
13 | setAccessTokensToServers, | 13 | setAccessTokensToServers, |
14 | waitJobs | 14 | waitJobs |
15 | } from '../../../shared/extra-utils' | 15 | } from '../../../shared/extra-utils' |
16 | 16 | ||
17 | async function testThumbnail (server: ServerInfo, videoId: number | string) { | 17 | async function testThumbnail (server: PeerTubeServer, videoId: number | string) { |
18 | const video = await server.videos.get({ id: videoId }) | 18 | const video = await server.videos.get({ id: videoId }) |
19 | 19 | ||
20 | const requests = [ | 20 | const requests = [ |
@@ -29,7 +29,7 @@ async function testThumbnail (server: ServerInfo, videoId: number | string) { | |||
29 | } | 29 | } |
30 | 30 | ||
31 | describe('Test regenerate thumbnails script', function () { | 31 | describe('Test regenerate thumbnails script', function () { |
32 | let servers: ServerInfo[] | 32 | let servers: PeerTubeServer[] |
33 | 33 | ||
34 | let video1: Video | 34 | let video1: Video |
35 | let video2: Video | 35 | let video2: Video |
@@ -41,7 +41,7 @@ describe('Test regenerate thumbnails script', function () { | |||
41 | before(async function () { | 41 | before(async function () { |
42 | this.timeout(60000) | 42 | this.timeout(60000) |
43 | 43 | ||
44 | servers = await flushAndRunMultipleServers(2) | 44 | servers = await createMultipleServers(2) |
45 | await setAccessTokensToServers(servers) | 45 | await setAccessTokensToServers(servers) |
46 | 46 | ||
47 | await doubleFollow(servers[0], servers[1]) | 47 | await doubleFollow(servers[0], servers[1]) |
diff --git a/server/tests/cli/reset-password.ts b/server/tests/cli/reset-password.ts index e0d6f220a..4a02db35d 100644 --- a/server/tests/cli/reset-password.ts +++ b/server/tests/cli/reset-password.ts | |||
@@ -1,12 +1,12 @@ | |||
1 | import 'mocha' | 1 | import 'mocha' |
2 | import { cleanupTests, CLICommand, flushAndRunServer, ServerInfo, setAccessTokensToServers } from '../../../shared/extra-utils' | 2 | import { cleanupTests, CLICommand, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '../../../shared/extra-utils' |
3 | 3 | ||
4 | describe('Test reset password scripts', function () { | 4 | describe('Test reset password scripts', function () { |
5 | let server: ServerInfo | 5 | let server: PeerTubeServer |
6 | 6 | ||
7 | before(async function () { | 7 | before(async function () { |
8 | this.timeout(30000) | 8 | this.timeout(30000) |
9 | server = await flushAndRunServer(1) | 9 | server = await createSingleServer(1) |
10 | await setAccessTokensToServers([ server ]) | 10 | await setAccessTokensToServers([ server ]) |
11 | 11 | ||
12 | await server.users.create({ username: 'user_1', password: 'super password' }) | 12 | await server.users.create({ username: 'user_1', password: 'super password' }) |
diff --git a/server/tests/cli/update-host.ts b/server/tests/cli/update-host.ts index d2d196456..fcbcb55ba 100644 --- a/server/tests/cli/update-host.ts +++ b/server/tests/cli/update-host.ts | |||
@@ -4,18 +4,17 @@ import 'mocha' | |||
4 | import { expect } from 'chai' | 4 | import { expect } from 'chai' |
5 | import { | 5 | import { |
6 | cleanupTests, | 6 | cleanupTests, |
7 | flushAndRunServer, | 7 | createSingleServer, |
8 | killallServers, | 8 | killallServers, |
9 | makeActivityPubGetRequest, | 9 | makeActivityPubGetRequest, |
10 | parseTorrentVideo, | 10 | parseTorrentVideo, |
11 | reRunServer, | 11 | PeerTubeServer, |
12 | ServerInfo, | ||
13 | setAccessTokensToServers, | 12 | setAccessTokensToServers, |
14 | waitJobs | 13 | waitJobs |
15 | } from '@shared/extra-utils' | 14 | } from '@shared/extra-utils' |
16 | 15 | ||
17 | describe('Test update host scripts', function () { | 16 | describe('Test update host scripts', function () { |
18 | let server: ServerInfo | 17 | let server: PeerTubeServer |
19 | 18 | ||
20 | before(async function () { | 19 | before(async function () { |
21 | this.timeout(60000) | 20 | this.timeout(60000) |
@@ -26,7 +25,7 @@ describe('Test update host scripts', function () { | |||
26 | } | 25 | } |
27 | } | 26 | } |
28 | // Run server 2 to have transcoding enabled | 27 | // Run server 2 to have transcoding enabled |
29 | server = await flushAndRunServer(2, overrideConfig) | 28 | server = await createSingleServer(2, overrideConfig) |
30 | await setAccessTokensToServers([ server ]) | 29 | await setAccessTokensToServers([ server ]) |
31 | 30 | ||
32 | // Upload two videos for our needs | 31 | // Upload two videos for our needs |
@@ -56,7 +55,7 @@ describe('Test update host scripts', function () { | |||
56 | 55 | ||
57 | await killallServers([ server ]) | 56 | await killallServers([ server ]) |
58 | // Run server with standard configuration | 57 | // Run server with standard configuration |
59 | await reRunServer(server) | 58 | await server.run() |
60 | 59 | ||
61 | await server.cli.execWithEnv(`npm run update-host`) | 60 | await server.cli.execWithEnv(`npm run update-host`) |
62 | }) | 61 | }) |
diff --git a/server/tests/client.ts b/server/tests/client.ts index caf6fb00c..959b34653 100644 --- a/server/tests/client.ts +++ b/server/tests/client.ts | |||
@@ -8,10 +8,10 @@ import { Account, HTMLServerConfig, ServerConfig, VideoPlaylistCreateResult, Vid | |||
8 | import { | 8 | import { |
9 | cleanupTests, | 9 | cleanupTests, |
10 | doubleFollow, | 10 | doubleFollow, |
11 | flushAndRunMultipleServers, | 11 | createMultipleServers, |
12 | makeGetRequest, | 12 | makeGetRequest, |
13 | makeHTMLRequest, | 13 | makeHTMLRequest, |
14 | ServerInfo, | 14 | PeerTubeServer, |
15 | setAccessTokensToServers, | 15 | setAccessTokensToServers, |
16 | setDefaultVideoChannel, | 16 | setDefaultVideoChannel, |
17 | waitJobs | 17 | waitJobs |
@@ -29,7 +29,7 @@ function checkIndexTags (html: string, title: string, description: string, css: | |||
29 | } | 29 | } |
30 | 30 | ||
31 | describe('Test a client controllers', function () { | 31 | describe('Test a client controllers', function () { |
32 | let servers: ServerInfo[] = [] | 32 | let servers: PeerTubeServer[] = [] |
33 | let account: Account | 33 | let account: Account |
34 | 34 | ||
35 | const videoName = 'my super name for server 1' | 35 | const videoName = 'my super name for server 1' |
@@ -51,7 +51,7 @@ describe('Test a client controllers', function () { | |||
51 | before(async function () { | 51 | before(async function () { |
52 | this.timeout(120000) | 52 | this.timeout(120000) |
53 | 53 | ||
54 | servers = await flushAndRunMultipleServers(2) | 54 | servers = await createMultipleServers(2) |
55 | 55 | ||
56 | await setAccessTokensToServers(servers) | 56 | await setAccessTokensToServers(servers) |
57 | 57 | ||
diff --git a/server/tests/external-plugins/auth-ldap.ts b/server/tests/external-plugins/auth-ldap.ts index ef624152e..aaaf23278 100644 --- a/server/tests/external-plugins/auth-ldap.ts +++ b/server/tests/external-plugins/auth-ldap.ts | |||
@@ -3,17 +3,17 @@ | |||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import { expect } from 'chai' | 4 | import { expect } from 'chai' |
5 | import { HttpStatusCode } from '@shared/core-utils' | 5 | import { HttpStatusCode } from '@shared/core-utils' |
6 | import { cleanupTests, flushAndRunServer, ServerInfo, setAccessTokensToServers } from '@shared/extra-utils' | 6 | import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils' |
7 | 7 | ||
8 | describe('Official plugin auth-ldap', function () { | 8 | describe('Official plugin auth-ldap', function () { |
9 | let server: ServerInfo | 9 | let server: PeerTubeServer |
10 | let accessToken: string | 10 | let accessToken: string |
11 | let userId: number | 11 | let userId: number |
12 | 12 | ||
13 | before(async function () { | 13 | before(async function () { |
14 | this.timeout(30000) | 14 | this.timeout(30000) |
15 | 15 | ||
16 | server = await flushAndRunServer(1) | 16 | server = await createSingleServer(1) |
17 | await setAccessTokensToServers([ server ]) | 17 | await setAccessTokensToServers([ server ]) |
18 | 18 | ||
19 | await server.plugins.install({ npmName: 'peertube-plugin-auth-ldap' }) | 19 | await server.plugins.install({ npmName: 'peertube-plugin-auth-ldap' }) |
diff --git a/server/tests/external-plugins/auto-block-videos.ts b/server/tests/external-plugins/auto-block-videos.ts index 3b4b48bf0..9cb86310b 100644 --- a/server/tests/external-plugins/auto-block-videos.ts +++ b/server/tests/external-plugins/auto-block-videos.ts | |||
@@ -5,17 +5,16 @@ import { expect } from 'chai' | |||
5 | import { | 5 | import { |
6 | cleanupTests, | 6 | cleanupTests, |
7 | doubleFollow, | 7 | doubleFollow, |
8 | flushAndRunMultipleServers, | 8 | createMultipleServers, |
9 | killallServers, | 9 | killallServers, |
10 | MockBlocklist, | 10 | MockBlocklist, |
11 | reRunServer, | 11 | PeerTubeServer, |
12 | ServerInfo, | ||
13 | setAccessTokensToServers, | 12 | setAccessTokensToServers, |
14 | wait | 13 | wait |
15 | } from '@shared/extra-utils' | 14 | } from '@shared/extra-utils' |
16 | import { Video } from '@shared/models' | 15 | import { Video } from '@shared/models' |
17 | 16 | ||
18 | async function check (server: ServerInfo, videoUUID: string, exists = true) { | 17 | async function check (server: PeerTubeServer, videoUUID: string, exists = true) { |
19 | const { data } = await server.videos.list() | 18 | const { data } = await server.videos.list() |
20 | 19 | ||
21 | const video = data.find(v => v.uuid === videoUUID) | 20 | const video = data.find(v => v.uuid === videoUUID) |
@@ -25,7 +24,7 @@ async function check (server: ServerInfo, videoUUID: string, exists = true) { | |||
25 | } | 24 | } |
26 | 25 | ||
27 | describe('Official plugin auto-block videos', function () { | 26 | describe('Official plugin auto-block videos', function () { |
28 | let servers: ServerInfo[] | 27 | let servers: PeerTubeServer[] |
29 | let blocklistServer: MockBlocklist | 28 | let blocklistServer: MockBlocklist |
30 | let server1Videos: Video[] = [] | 29 | let server1Videos: Video[] = [] |
31 | let server2Videos: Video[] = [] | 30 | let server2Videos: Video[] = [] |
@@ -34,7 +33,7 @@ describe('Official plugin auto-block videos', function () { | |||
34 | before(async function () { | 33 | before(async function () { |
35 | this.timeout(60000) | 34 | this.timeout(60000) |
36 | 35 | ||
37 | servers = await flushAndRunMultipleServers(2) | 36 | servers = await createMultipleServers(2) |
38 | await setAccessTokensToServers(servers) | 37 | await setAccessTokensToServers(servers) |
39 | 38 | ||
40 | for (const server of servers) { | 39 | for (const server of servers) { |
@@ -161,7 +160,7 @@ describe('Official plugin auto-block videos', function () { | |||
161 | await check(servers[0], video.uuid, true) | 160 | await check(servers[0], video.uuid, true) |
162 | 161 | ||
163 | await killallServers([ servers[0] ]) | 162 | await killallServers([ servers[0] ]) |
164 | await reRunServer(servers[0]) | 163 | await servers[0].run() |
165 | await wait(2000) | 164 | await wait(2000) |
166 | 165 | ||
167 | await check(servers[0], video.uuid, true) | 166 | await check(servers[0], video.uuid, true) |
diff --git a/server/tests/external-plugins/auto-mute.ts b/server/tests/external-plugins/auto-mute.ts index 25b56a546..771201505 100644 --- a/server/tests/external-plugins/auto-mute.ts +++ b/server/tests/external-plugins/auto-mute.ts | |||
@@ -6,26 +6,25 @@ import { HttpStatusCode } from '@shared/core-utils' | |||
6 | import { | 6 | import { |
7 | cleanupTests, | 7 | cleanupTests, |
8 | doubleFollow, | 8 | doubleFollow, |
9 | flushAndRunMultipleServers, | 9 | createMultipleServers, |
10 | killallServers, | 10 | killallServers, |
11 | makeGetRequest, | 11 | makeGetRequest, |
12 | MockBlocklist, | 12 | MockBlocklist, |
13 | reRunServer, | 13 | PeerTubeServer, |
14 | ServerInfo, | ||
15 | setAccessTokensToServers, | 14 | setAccessTokensToServers, |
16 | wait | 15 | wait |
17 | } from '@shared/extra-utils' | 16 | } from '@shared/extra-utils' |
18 | 17 | ||
19 | describe('Official plugin auto-mute', function () { | 18 | describe('Official plugin auto-mute', function () { |
20 | const autoMuteListPath = '/plugins/auto-mute/router/api/v1/mute-list' | 19 | const autoMuteListPath = '/plugins/auto-mute/router/api/v1/mute-list' |
21 | let servers: ServerInfo[] | 20 | let servers: PeerTubeServer[] |
22 | let blocklistServer: MockBlocklist | 21 | let blocklistServer: MockBlocklist |
23 | let port: number | 22 | let port: number |
24 | 23 | ||
25 | before(async function () { | 24 | before(async function () { |
26 | this.timeout(30000) | 25 | this.timeout(30000) |
27 | 26 | ||
28 | servers = await flushAndRunMultipleServers(2) | 27 | servers = await createMultipleServers(2) |
29 | await setAccessTokensToServers(servers) | 28 | await setAccessTokensToServers(servers) |
30 | 29 | ||
31 | for (const server of servers) { | 30 | for (const server of servers) { |
@@ -150,7 +149,7 @@ describe('Official plugin auto-mute', function () { | |||
150 | } | 149 | } |
151 | 150 | ||
152 | await killallServers([ servers[0] ]) | 151 | await killallServers([ servers[0] ]) |
153 | await reRunServer(servers[0]) | 152 | await servers[0].run() |
154 | await wait(2000) | 153 | await wait(2000) |
155 | 154 | ||
156 | { | 155 | { |
diff --git a/server/tests/feeds/feeds.ts b/server/tests/feeds/feeds.ts index 8bdafc644..7735299d3 100644 --- a/server/tests/feeds/feeds.ts +++ b/server/tests/feeds/feeds.ts | |||
@@ -7,9 +7,9 @@ import { HttpStatusCode } from '@shared/core-utils' | |||
7 | import { | 7 | import { |
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 | waitJobs | 14 | waitJobs |
15 | } from '@shared/extra-utils' | 15 | } from '@shared/extra-utils' |
@@ -21,8 +21,8 @@ chai.config.includeStack = true | |||
21 | const expect = chai.expect | 21 | const expect = chai.expect |
22 | 22 | ||
23 | describe('Test syndication feeds', () => { | 23 | describe('Test syndication feeds', () => { |
24 | let servers: ServerInfo[] = [] | 24 | let servers: PeerTubeServer[] = [] |
25 | let serverHLSOnly: ServerInfo | 25 | let serverHLSOnly: PeerTubeServer |
26 | let userAccessToken: string | 26 | let userAccessToken: string |
27 | let rootAccountId: number | 27 | let rootAccountId: number |
28 | let rootChannelId: number | 28 | let rootChannelId: number |
@@ -34,8 +34,8 @@ describe('Test syndication feeds', () => { | |||
34 | this.timeout(120000) | 34 | this.timeout(120000) |
35 | 35 | ||
36 | // Run servers | 36 | // Run servers |
37 | servers = await flushAndRunMultipleServers(2) | 37 | servers = await createMultipleServers(2) |
38 | serverHLSOnly = await flushAndRunServer(3, { | 38 | serverHLSOnly = await createSingleServer(3, { |
39 | transcoding: { | 39 | transcoding: { |
40 | enabled: true, | 40 | enabled: true, |
41 | webtorrent: { enabled: false }, | 41 | webtorrent: { enabled: false }, |
diff --git a/server/tests/misc-endpoints.ts b/server/tests/misc-endpoints.ts index f7c9e6c26..a4f344fcc 100644 --- a/server/tests/misc-endpoints.ts +++ b/server/tests/misc-endpoints.ts | |||
@@ -3,18 +3,18 @@ | |||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { HttpStatusCode } from '@shared/core-utils' | 5 | import { HttpStatusCode } from '@shared/core-utils' |
6 | import { cleanupTests, flushAndRunServer, makeGetRequest, ServerInfo, setAccessTokensToServers } from '@shared/extra-utils' | 6 | import { cleanupTests, createSingleServer, makeGetRequest, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils' |
7 | import { VideoPrivacy } from '@shared/models' | 7 | import { VideoPrivacy } from '@shared/models' |
8 | 8 | ||
9 | const expect = chai.expect | 9 | const expect = chai.expect |
10 | 10 | ||
11 | describe('Test misc endpoints', function () { | 11 | describe('Test misc endpoints', function () { |
12 | let server: ServerInfo | 12 | let server: PeerTubeServer |
13 | 13 | ||
14 | before(async function () { | 14 | before(async function () { |
15 | this.timeout(120000) | 15 | this.timeout(120000) |
16 | 16 | ||
17 | server = await flushAndRunServer(1) | 17 | server = await createSingleServer(1) |
18 | await setAccessTokensToServers([ server ]) | 18 | await setAccessTokensToServers([ server ]) |
19 | }) | 19 | }) |
20 | 20 | ||
diff --git a/server/tests/plugins/action-hooks.ts b/server/tests/plugins/action-hooks.ts index 12d5c23c5..b96de4e90 100644 --- a/server/tests/plugins/action-hooks.ts +++ b/server/tests/plugins/action-hooks.ts | |||
@@ -3,18 +3,17 @@ | |||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import { | 4 | import { |
5 | cleanupTests, | 5 | cleanupTests, |
6 | flushAndRunMultipleServers, | 6 | createMultipleServers, |
7 | killallServers, | 7 | killallServers, |
8 | PeerTubeServer, | ||
8 | PluginsCommand, | 9 | PluginsCommand, |
9 | reRunServer, | ||
10 | ServerInfo, | ||
11 | setAccessTokensToServers, | 10 | setAccessTokensToServers, |
12 | setDefaultVideoChannel | 11 | setDefaultVideoChannel |
13 | } from '@shared/extra-utils' | 12 | } from '@shared/extra-utils' |
14 | import { ServerHookName, VideoPlaylistPrivacy, VideoPrivacy } from '@shared/models' | 13 | import { ServerHookName, VideoPlaylistPrivacy, VideoPrivacy } from '@shared/models' |
15 | 14 | ||
16 | describe('Test plugin action hooks', function () { | 15 | describe('Test plugin action hooks', function () { |
17 | let servers: ServerInfo[] | 16 | let servers: PeerTubeServer[] |
18 | let videoUUID: string | 17 | let videoUUID: string |
19 | let threadId: number | 18 | let threadId: number |
20 | 19 | ||
@@ -25,7 +24,7 @@ describe('Test plugin action hooks', function () { | |||
25 | before(async function () { | 24 | before(async function () { |
26 | this.timeout(30000) | 25 | this.timeout(30000) |
27 | 26 | ||
28 | servers = await flushAndRunMultipleServers(2) | 27 | servers = await createMultipleServers(2) |
29 | await setAccessTokensToServers(servers) | 28 | await setAccessTokensToServers(servers) |
30 | await setDefaultVideoChannel(servers) | 29 | await setDefaultVideoChannel(servers) |
31 | 30 | ||
@@ -33,7 +32,7 @@ describe('Test plugin action hooks', function () { | |||
33 | 32 | ||
34 | await killallServers([ servers[0] ]) | 33 | await killallServers([ servers[0] ]) |
35 | 34 | ||
36 | await reRunServer(servers[0], { | 35 | await servers[0].run({ |
37 | live: { | 36 | live: { |
38 | enabled: true | 37 | enabled: true |
39 | } | 38 | } |
diff --git a/server/tests/plugins/external-auth.ts b/server/tests/plugins/external-auth.ts index 48f942f7f..c0834a14c 100644 --- a/server/tests/plugins/external-auth.ts +++ b/server/tests/plugins/external-auth.ts | |||
@@ -6,16 +6,16 @@ import { HttpStatusCode } from '@shared/core-utils' | |||
6 | import { | 6 | import { |
7 | cleanupTests, | 7 | cleanupTests, |
8 | decodeQueryString, | 8 | decodeQueryString, |
9 | flushAndRunServer, | 9 | createSingleServer, |
10 | PluginsCommand, | 10 | PluginsCommand, |
11 | ServerInfo, | 11 | PeerTubeServer, |
12 | setAccessTokensToServers, | 12 | setAccessTokensToServers, |
13 | wait | 13 | wait |
14 | } from '@shared/extra-utils' | 14 | } from '@shared/extra-utils' |
15 | import { UserRole } from '@shared/models' | 15 | import { UserRole } from '@shared/models' |
16 | 16 | ||
17 | async function loginExternal (options: { | 17 | async function loginExternal (options: { |
18 | server: ServerInfo | 18 | server: PeerTubeServer |
19 | npmName: string | 19 | npmName: string |
20 | authName: string | 20 | authName: string |
21 | username: string | 21 | username: string |
@@ -46,7 +46,7 @@ async function loginExternal (options: { | |||
46 | } | 46 | } |
47 | 47 | ||
48 | describe('Test external auth plugins', function () { | 48 | describe('Test external auth plugins', function () { |
49 | let server: ServerInfo | 49 | let server: PeerTubeServer |
50 | 50 | ||
51 | let cyanAccessToken: string | 51 | let cyanAccessToken: string |
52 | let cyanRefreshToken: string | 52 | let cyanRefreshToken: string |
@@ -59,7 +59,7 @@ describe('Test external auth plugins', function () { | |||
59 | before(async function () { | 59 | before(async function () { |
60 | this.timeout(30000) | 60 | this.timeout(30000) |
61 | 61 | ||
62 | server = await flushAndRunServer(1) | 62 | server = await createSingleServer(1) |
63 | await setAccessTokensToServers([ server ]) | 63 | await setAccessTokensToServers([ server ]) |
64 | 64 | ||
65 | for (const suffix of [ 'one', 'two', 'three' ]) { | 65 | for (const suffix of [ 'one', 'two', 'three' ]) { |
diff --git a/server/tests/plugins/filter-hooks.ts b/server/tests/plugins/filter-hooks.ts index 18479dcf5..5d94303a9 100644 --- a/server/tests/plugins/filter-hooks.ts +++ b/server/tests/plugins/filter-hooks.ts | |||
@@ -6,11 +6,11 @@ import { HttpStatusCode } from '@shared/core-utils' | |||
6 | import { | 6 | import { |
7 | cleanupTests, | 7 | cleanupTests, |
8 | doubleFollow, | 8 | doubleFollow, |
9 | flushAndRunMultipleServers, | 9 | createMultipleServers, |
10 | ImportsCommand, | 10 | ImportsCommand, |
11 | makeRawRequest, | 11 | makeRawRequest, |
12 | PluginsCommand, | 12 | PluginsCommand, |
13 | ServerInfo, | 13 | PeerTubeServer, |
14 | setAccessTokensToServers, | 14 | setAccessTokensToServers, |
15 | setDefaultVideoChannel, | 15 | setDefaultVideoChannel, |
16 | waitJobs | 16 | waitJobs |
@@ -20,14 +20,14 @@ import { VideoDetails, VideoImportState, VideoPlaylist, VideoPlaylistPrivacy, Vi | |||
20 | const expect = chai.expect | 20 | const expect = chai.expect |
21 | 21 | ||
22 | describe('Test plugin filter hooks', function () { | 22 | describe('Test plugin filter hooks', function () { |
23 | let servers: ServerInfo[] | 23 | let servers: PeerTubeServer[] |
24 | let videoUUID: string | 24 | let videoUUID: string |
25 | let threadId: number | 25 | let threadId: number |
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 | await setDefaultVideoChannel(servers) | 32 | await setDefaultVideoChannel(servers) |
33 | await doubleFollow(servers[0], servers[1]) | 33 | await doubleFollow(servers[0], servers[1]) |
diff --git a/server/tests/plugins/html-injection.ts b/server/tests/plugins/html-injection.ts index 0cb89f511..2902c39b7 100644 --- a/server/tests/plugins/html-injection.ts +++ b/server/tests/plugins/html-injection.ts | |||
@@ -4,23 +4,23 @@ import 'mocha' | |||
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { | 5 | import { |
6 | cleanupTests, | 6 | cleanupTests, |
7 | flushAndRunServer, | 7 | createSingleServer, |
8 | makeHTMLRequest, | 8 | makeHTMLRequest, |
9 | PluginsCommand, | 9 | PluginsCommand, |
10 | ServerInfo, | 10 | PeerTubeServer, |
11 | setAccessTokensToServers | 11 | setAccessTokensToServers |
12 | } from '../../../shared/extra-utils' | 12 | } from '../../../shared/extra-utils' |
13 | 13 | ||
14 | const expect = chai.expect | 14 | const expect = chai.expect |
15 | 15 | ||
16 | describe('Test plugins HTML injection', function () { | 16 | describe('Test plugins HTML injection', function () { |
17 | let server: ServerInfo = null | 17 | let server: PeerTubeServer = null |
18 | let command: PluginsCommand | 18 | let command: PluginsCommand |
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 | await setAccessTokensToServers([ server ]) | 24 | await setAccessTokensToServers([ server ]) |
25 | 25 | ||
26 | command = server.plugins | 26 | command = server.plugins |
diff --git a/server/tests/plugins/id-and-pass-auth.ts b/server/tests/plugins/id-and-pass-auth.ts index 203996af8..981bcad91 100644 --- a/server/tests/plugins/id-and-pass-auth.ts +++ b/server/tests/plugins/id-and-pass-auth.ts | |||
@@ -3,11 +3,11 @@ | |||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import { expect } from 'chai' | 4 | import { expect } from 'chai' |
5 | import { HttpStatusCode } from '@shared/core-utils' | 5 | import { HttpStatusCode } from '@shared/core-utils' |
6 | import { cleanupTests, flushAndRunServer, PluginsCommand, ServerInfo, setAccessTokensToServers, wait } from '@shared/extra-utils' | 6 | import { cleanupTests, createSingleServer, PluginsCommand, PeerTubeServer, setAccessTokensToServers, wait } from '@shared/extra-utils' |
7 | import { UserRole } from '@shared/models' | 7 | import { UserRole } from '@shared/models' |
8 | 8 | ||
9 | describe('Test id and pass auth plugins', function () { | 9 | describe('Test id and pass auth plugins', function () { |
10 | let server: ServerInfo | 10 | let server: PeerTubeServer |
11 | 11 | ||
12 | let crashAccessToken: string | 12 | let crashAccessToken: string |
13 | let crashRefreshToken: string | 13 | let crashRefreshToken: string |
@@ -18,7 +18,7 @@ describe('Test id and pass auth plugins', function () { | |||
18 | before(async function () { | 18 | before(async function () { |
19 | this.timeout(30000) | 19 | this.timeout(30000) |
20 | 20 | ||
21 | server = await flushAndRunServer(1) | 21 | server = await createSingleServer(1) |
22 | await setAccessTokensToServers([ server ]) | 22 | await setAccessTokensToServers([ server ]) |
23 | 23 | ||
24 | for (const suffix of [ 'one', 'two', 'three' ]) { | 24 | for (const suffix of [ 'one', 'two', 'three' ]) { |
diff --git a/server/tests/plugins/plugin-helpers.ts b/server/tests/plugins/plugin-helpers.ts index cf16aaa9d..1d87b84ae 100644 --- a/server/tests/plugins/plugin-helpers.ts +++ b/server/tests/plugins/plugin-helpers.ts | |||
@@ -7,16 +7,16 @@ import { | |||
7 | checkVideoFilesWereRemoved, | 7 | checkVideoFilesWereRemoved, |
8 | cleanupTests, | 8 | cleanupTests, |
9 | doubleFollow, | 9 | doubleFollow, |
10 | flushAndRunMultipleServers, | 10 | createMultipleServers, |
11 | makeGetRequest, | 11 | makeGetRequest, |
12 | makePostBodyRequest, | 12 | makePostBodyRequest, |
13 | PluginsCommand, | 13 | PluginsCommand, |
14 | ServerInfo, | 14 | PeerTubeServer, |
15 | setAccessTokensToServers, | 15 | setAccessTokensToServers, |
16 | waitJobs | 16 | waitJobs |
17 | } from '@shared/extra-utils' | 17 | } from '@shared/extra-utils' |
18 | 18 | ||
19 | function postCommand (server: ServerInfo, command: string, bodyArg?: object) { | 19 | function postCommand (server: PeerTubeServer, command: string, bodyArg?: object) { |
20 | const body = { command } | 20 | const body = { command } |
21 | if (bodyArg) Object.assign(body, bodyArg) | 21 | if (bodyArg) Object.assign(body, bodyArg) |
22 | 22 | ||
@@ -29,12 +29,12 @@ function postCommand (server: ServerInfo, command: string, bodyArg?: object) { | |||
29 | } | 29 | } |
30 | 30 | ||
31 | describe('Test plugin helpers', function () { | 31 | describe('Test plugin helpers', function () { |
32 | let servers: ServerInfo[] | 32 | let servers: PeerTubeServer[] |
33 | 33 | ||
34 | before(async function () { | 34 | before(async function () { |
35 | this.timeout(60000) | 35 | this.timeout(60000) |
36 | 36 | ||
37 | servers = await flushAndRunMultipleServers(2) | 37 | servers = await createMultipleServers(2) |
38 | await setAccessTokensToServers(servers) | 38 | await setAccessTokensToServers(servers) |
39 | 39 | ||
40 | await doubleFollow(servers[0], servers[1]) | 40 | await doubleFollow(servers[0], servers[1]) |
diff --git a/server/tests/plugins/plugin-router.ts b/server/tests/plugins/plugin-router.ts index 1c53dd80c..dec8ca4bb 100644 --- a/server/tests/plugins/plugin-router.ts +++ b/server/tests/plugins/plugin-router.ts | |||
@@ -5,16 +5,16 @@ import { expect } from 'chai' | |||
5 | import { HttpStatusCode } from '@shared/core-utils' | 5 | import { HttpStatusCode } from '@shared/core-utils' |
6 | import { | 6 | import { |
7 | cleanupTests, | 7 | cleanupTests, |
8 | flushAndRunServer, | 8 | createSingleServer, |
9 | makeGetRequest, | 9 | makeGetRequest, |
10 | makePostBodyRequest, | 10 | makePostBodyRequest, |
11 | PluginsCommand, | 11 | PluginsCommand, |
12 | ServerInfo, | 12 | PeerTubeServer, |
13 | setAccessTokensToServers | 13 | setAccessTokensToServers |
14 | } from '@shared/extra-utils' | 14 | } from '@shared/extra-utils' |
15 | 15 | ||
16 | describe('Test plugin helpers', function () { | 16 | describe('Test plugin helpers', function () { |
17 | let server: ServerInfo | 17 | let server: PeerTubeServer |
18 | const basePaths = [ | 18 | const basePaths = [ |
19 | '/plugins/test-five/router/', | 19 | '/plugins/test-five/router/', |
20 | '/plugins/test-five/0.0.1/router/' | 20 | '/plugins/test-five/0.0.1/router/' |
@@ -23,7 +23,7 @@ describe('Test plugin helpers', function () { | |||
23 | before(async function () { | 23 | before(async function () { |
24 | this.timeout(30000) | 24 | this.timeout(30000) |
25 | 25 | ||
26 | server = await flushAndRunServer(1) | 26 | server = await createSingleServer(1) |
27 | await setAccessTokensToServers([ server ]) | 27 | await setAccessTokensToServers([ server ]) |
28 | 28 | ||
29 | await server.plugins.install({ path: PluginsCommand.getPluginTestPath('-five') }) | 29 | await server.plugins.install({ path: PluginsCommand.getPluginTestPath('-five') }) |
diff --git a/server/tests/plugins/plugin-storage.ts b/server/tests/plugins/plugin-storage.ts index 30e231439..5745914a5 100644 --- a/server/tests/plugins/plugin-storage.ts +++ b/server/tests/plugins/plugin-storage.ts | |||
@@ -5,15 +5,22 @@ import { expect } from 'chai' | |||
5 | import { pathExists, readdir, readFile } from 'fs-extra' | 5 | import { pathExists, readdir, readFile } from 'fs-extra' |
6 | import { join } from 'path' | 6 | import { join } from 'path' |
7 | import { HttpStatusCode } from '@shared/core-utils' | 7 | import { HttpStatusCode } from '@shared/core-utils' |
8 | import { cleanupTests, flushAndRunServer, makeGetRequest, PluginsCommand, ServerInfo, setAccessTokensToServers } from '@shared/extra-utils' | 8 | import { |
9 | cleanupTests, | ||
10 | createSingleServer, | ||
11 | makeGetRequest, | ||
12 | PeerTubeServer, | ||
13 | PluginsCommand, | ||
14 | setAccessTokensToServers | ||
15 | } from '@shared/extra-utils' | ||
9 | 16 | ||
10 | describe('Test plugin storage', function () { | 17 | describe('Test plugin storage', function () { |
11 | let server: ServerInfo | 18 | let server: PeerTubeServer |
12 | 19 | ||
13 | before(async function () { | 20 | before(async function () { |
14 | this.timeout(30000) | 21 | this.timeout(30000) |
15 | 22 | ||
16 | server = await flushAndRunServer(1) | 23 | server = await createSingleServer(1) |
17 | await setAccessTokensToServers([ server ]) | 24 | await setAccessTokensToServers([ server ]) |
18 | 25 | ||
19 | await server.plugins.install({ path: PluginsCommand.getPluginTestPath('-six') }) | 26 | await server.plugins.install({ path: PluginsCommand.getPluginTestPath('-six') }) |
diff --git a/server/tests/plugins/plugin-transcoding.ts b/server/tests/plugins/plugin-transcoding.ts index 3a03065b0..3c54d3796 100644 --- a/server/tests/plugins/plugin-transcoding.ts +++ b/server/tests/plugins/plugin-transcoding.ts | |||
@@ -6,9 +6,9 @@ import { join } from 'path' | |||
6 | import { getAudioStream, getVideoFileFPS, getVideoStreamFromFile } from '@server/helpers/ffprobe-utils' | 6 | import { getAudioStream, getVideoFileFPS, getVideoStreamFromFile } from '@server/helpers/ffprobe-utils' |
7 | import { | 7 | import { |
8 | cleanupTests, | 8 | cleanupTests, |
9 | flushAndRunServer, | 9 | createSingleServer, |
10 | PluginsCommand, | 10 | PluginsCommand, |
11 | ServerInfo, | 11 | PeerTubeServer, |
12 | setAccessTokensToServers, | 12 | setAccessTokensToServers, |
13 | setDefaultVideoChannel, | 13 | setDefaultVideoChannel, |
14 | testFfmpegStreamError, | 14 | testFfmpegStreamError, |
@@ -16,7 +16,7 @@ import { | |||
16 | } from '@shared/extra-utils' | 16 | } from '@shared/extra-utils' |
17 | import { VideoPrivacy } from '@shared/models' | 17 | import { VideoPrivacy } from '@shared/models' |
18 | 18 | ||
19 | async function createLiveWrapper (server: ServerInfo) { | 19 | async function createLiveWrapper (server: PeerTubeServer) { |
20 | const liveAttributes = { | 20 | const liveAttributes = { |
21 | name: 'live video', | 21 | name: 'live video', |
22 | channelId: server.store.channel.id, | 22 | channelId: server.store.channel.id, |
@@ -28,7 +28,7 @@ async function createLiveWrapper (server: ServerInfo) { | |||
28 | return uuid | 28 | return uuid |
29 | } | 29 | } |
30 | 30 | ||
31 | function updateConf (server: ServerInfo, vodProfile: string, liveProfile: string) { | 31 | function updateConf (server: PeerTubeServer, vodProfile: string, liveProfile: string) { |
32 | return server.config.updateCustomSubConfig({ | 32 | return server.config.updateCustomSubConfig({ |
33 | newConfig: { | 33 | newConfig: { |
34 | transcoding: { | 34 | transcoding: { |
@@ -64,12 +64,12 @@ function updateConf (server: ServerInfo, vodProfile: string, liveProfile: string | |||
64 | } | 64 | } |
65 | 65 | ||
66 | describe('Test transcoding plugins', function () { | 66 | describe('Test transcoding plugins', function () { |
67 | let server: ServerInfo | 67 | let server: PeerTubeServer |
68 | 68 | ||
69 | before(async function () { | 69 | before(async function () { |
70 | this.timeout(60000) | 70 | this.timeout(60000) |
71 | 71 | ||
72 | server = await flushAndRunServer(1) | 72 | server = await createSingleServer(1) |
73 | await setAccessTokensToServers([ server ]) | 73 | await setAccessTokensToServers([ server ]) |
74 | await setDefaultVideoChannel([ server ]) | 74 | await setDefaultVideoChannel([ server ]) |
75 | 75 | ||
diff --git a/server/tests/plugins/plugin-unloading.ts b/server/tests/plugins/plugin-unloading.ts index 26a27abca..6c405b7f5 100644 --- a/server/tests/plugins/plugin-unloading.ts +++ b/server/tests/plugins/plugin-unloading.ts | |||
@@ -3,17 +3,24 @@ | |||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import { expect } from 'chai' | 4 | import { expect } from 'chai' |
5 | import { HttpStatusCode } from '@shared/core-utils' | 5 | import { HttpStatusCode } from '@shared/core-utils' |
6 | import { cleanupTests, flushAndRunServer, makeGetRequest, PluginsCommand, ServerInfo, setAccessTokensToServers } from '@shared/extra-utils' | 6 | import { |
7 | cleanupTests, | ||
8 | createSingleServer, | ||
9 | makeGetRequest, | ||
10 | PeerTubeServer, | ||
11 | PluginsCommand, | ||
12 | setAccessTokensToServers | ||
13 | } from '@shared/extra-utils' | ||
7 | 14 | ||
8 | describe('Test plugins module unloading', function () { | 15 | describe('Test plugins module unloading', function () { |
9 | let server: ServerInfo = null | 16 | let server: PeerTubeServer = null |
10 | const requestPath = '/plugins/test-unloading/router/get' | 17 | const requestPath = '/plugins/test-unloading/router/get' |
11 | let value: string = null | 18 | let value: string = null |
12 | 19 | ||
13 | before(async function () { | 20 | before(async function () { |
14 | this.timeout(30000) | 21 | this.timeout(30000) |
15 | 22 | ||
16 | server = await flushAndRunServer(1) | 23 | server = await createSingleServer(1) |
17 | await setAccessTokensToServers([ server ]) | 24 | await setAccessTokensToServers([ server ]) |
18 | 25 | ||
19 | await server.plugins.install({ path: PluginsCommand.getPluginTestPath('-unloading') }) | 26 | await server.plugins.install({ path: PluginsCommand.getPluginTestPath('-unloading') }) |
diff --git a/server/tests/plugins/translations.ts b/server/tests/plugins/translations.ts index d8d878026..8b25c6b75 100644 --- a/server/tests/plugins/translations.ts +++ b/server/tests/plugins/translations.ts | |||
@@ -2,19 +2,18 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { PluginsCommand, setAccessTokensToServers } from '../../../shared/extra-utils' | 5 | import { cleanupTests, createSingleServer, PeerTubeServer, PluginsCommand, setAccessTokensToServers } from '@shared/extra-utils' |
6 | import { cleanupTests, flushAndRunServer, ServerInfo } from '../../../shared/extra-utils/server/servers' | ||
7 | 6 | ||
8 | const expect = chai.expect | 7 | const expect = chai.expect |
9 | 8 | ||
10 | describe('Test plugin translations', function () { | 9 | describe('Test plugin translations', function () { |
11 | let server: ServerInfo | 10 | let server: PeerTubeServer |
12 | let command: PluginsCommand | 11 | let command: PluginsCommand |
13 | 12 | ||
14 | before(async function () { | 13 | before(async function () { |
15 | this.timeout(30000) | 14 | this.timeout(30000) |
16 | 15 | ||
17 | server = await flushAndRunServer(1) | 16 | server = await createSingleServer(1) |
18 | await setAccessTokensToServers([ server ]) | 17 | await setAccessTokensToServers([ server ]) |
19 | 18 | ||
20 | command = server.plugins | 19 | command = server.plugins |
diff --git a/server/tests/plugins/video-constants.ts b/server/tests/plugins/video-constants.ts index facc6bbc1..953916e8e 100644 --- a/server/tests/plugins/video-constants.ts +++ b/server/tests/plugins/video-constants.ts | |||
@@ -3,18 +3,18 @@ | |||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { HttpStatusCode } from '@shared/core-utils' | 5 | import { HttpStatusCode } from '@shared/core-utils' |
6 | import { cleanupTests, flushAndRunServer, PluginsCommand, ServerInfo, setAccessTokensToServers } from '@shared/extra-utils' | 6 | import { cleanupTests, createSingleServer, PluginsCommand, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils' |
7 | import { VideoPlaylistPrivacy } from '@shared/models' | 7 | import { VideoPlaylistPrivacy } from '@shared/models' |
8 | 8 | ||
9 | const expect = chai.expect | 9 | const expect = chai.expect |
10 | 10 | ||
11 | describe('Test plugin altering video constants', function () { | 11 | describe('Test plugin altering video constants', function () { |
12 | let server: ServerInfo | 12 | let server: PeerTubeServer |
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 | await setAccessTokensToServers([ server ]) | 18 | await setAccessTokensToServers([ server ]) |
19 | 19 | ||
20 | await server.plugins.install({ path: PluginsCommand.getPluginTestPath('-video-constants') }) | 20 | await server.plugins.install({ path: PluginsCommand.getPluginTestPath('-video-constants') }) |
diff --git a/server/tools/cli.ts b/server/tools/cli.ts index 7d5eb72ed..52e6ea593 100644 --- a/server/tools/cli.ts +++ b/server/tools/cli.ts | |||
@@ -2,7 +2,7 @@ import { Command } from 'commander' | |||
2 | import { Netrc } from 'netrc-parser' | 2 | import { Netrc } from 'netrc-parser' |
3 | import { join } from 'path' | 3 | import { join } from 'path' |
4 | import { createLogger, format, transports } from 'winston' | 4 | import { createLogger, format, transports } from 'winston' |
5 | import { assignCommands, ServerInfo } from '@shared/extra-utils' | 5 | import { PeerTubeServer } from '@shared/extra-utils' |
6 | import { UserRole } from '@shared/models' | 6 | import { UserRole } from '@shared/models' |
7 | import { VideoPrivacy } from '../../shared/models/videos' | 7 | import { VideoPrivacy } from '../../shared/models/videos' |
8 | import { getAppNumber, isTestInstance, root } from '../helpers/core-utils' | 8 | import { getAppNumber, isTestInstance, root } from '../helpers/core-utils' |
@@ -14,7 +14,7 @@ const config = require('application-config')(configName) | |||
14 | 14 | ||
15 | const version = require('../../../package.json').version | 15 | const version = require('../../../package.json').version |
16 | 16 | ||
17 | async function getAdminTokenOrDie (server: ServerInfo, username: string, password: string) { | 17 | async function getAdminTokenOrDie (server: PeerTubeServer, username: string, password: string) { |
18 | const token = await server.login.getAccessToken(username, password) | 18 | const token = await server.login.getAccessToken(username, password) |
19 | const me = await server.users.getMyInfo({ token }) | 19 | const me = await server.users.getMyInfo({ token }) |
20 | 20 | ||
@@ -124,7 +124,7 @@ function buildCommonVideoOptions (command: Command) { | |||
124 | .option('-v, --verbose <verbose>', 'Verbosity, from 0/\'error\' to 4/\'debug\'', 'info') | 124 | .option('-v, --verbose <verbose>', 'Verbosity, from 0/\'error\' to 4/\'debug\'', 'info') |
125 | } | 125 | } |
126 | 126 | ||
127 | async function buildVideoAttributesFromCommander (server: ServerInfo, command: Command, defaultAttributes: any = {}) { | 127 | async function buildVideoAttributesFromCommander (server: PeerTubeServer, command: Command, defaultAttributes: any = {}) { |
128 | const options = command.opts() | 128 | const options = command.opts() |
129 | 129 | ||
130 | const defaultBooleanAttributes = { | 130 | const defaultBooleanAttributes = { |
@@ -179,14 +179,11 @@ function getServerCredentials (program: Command) { | |||
179 | }) | 179 | }) |
180 | } | 180 | } |
181 | 181 | ||
182 | function buildServer (url: string): ServerInfo { | 182 | function buildServer (url: string) { |
183 | const server = { url, internalServerNumber: undefined } | 183 | return new PeerTubeServer({ url }) |
184 | assignCommands(server) | ||
185 | |||
186 | return server | ||
187 | } | 184 | } |
188 | 185 | ||
189 | async function assignToken (server: ServerInfo, username: string, password: string) { | 186 | async function assignToken (server: PeerTubeServer, username: string, password: string) { |
190 | const bodyClient = await server.login.getClient() | 187 | const bodyClient = await server.login.getClient() |
191 | const client = { id: bodyClient.client_id, secret: bodyClient.client_secret } | 188 | const client = { id: bodyClient.client_id, secret: bodyClient.client_secret } |
192 | 189 | ||
diff --git a/server/tools/peertube-import-videos.ts b/server/tools/peertube-import-videos.ts index caf1facc7..52aae3d2c 100644 --- a/server/tools/peertube-import-videos.ts +++ b/server/tools/peertube-import-videos.ts | |||
@@ -20,7 +20,7 @@ import { | |||
20 | getLogger, | 20 | getLogger, |
21 | getServerCredentials | 21 | getServerCredentials |
22 | } from './cli' | 22 | } from './cli' |
23 | import { ServerInfo } from '@shared/extra-utils' | 23 | import { PeerTubeServer } from '@shared/extra-utils' |
24 | 24 | ||
25 | const processOptions = { | 25 | const processOptions = { |
26 | maxBuffer: Infinity | 26 | maxBuffer: Infinity |
@@ -270,7 +270,7 @@ async function uploadVideoOnPeerTube (parameters: { | |||
270 | 270 | ||
271 | /* ---------------------------------------------------------- */ | 271 | /* ---------------------------------------------------------- */ |
272 | 272 | ||
273 | async function getCategory (server: ServerInfo, categories: string[]) { | 273 | async function getCategory (server: PeerTubeServer, categories: string[]) { |
274 | if (!categories) return undefined | 274 | if (!categories) return undefined |
275 | 275 | ||
276 | const categoryString = categories[0] | 276 | const categoryString = categories[0] |
diff --git a/server/tools/test-live.ts b/server/tools/test-live.ts index bc31b6926..0cb0c3668 100644 --- a/server/tools/test-live.ts +++ b/server/tools/test-live.ts | |||
@@ -1,10 +1,10 @@ | |||
1 | import { program } from 'commander' | 1 | import { program } from 'commander' |
2 | import { LiveVideoCreate, VideoPrivacy } from '@shared/models' | 2 | import { LiveVideoCreate, VideoPrivacy } from '@shared/models' |
3 | import { | 3 | import { |
4 | flushAndRunServer, | 4 | createSingleServer, |
5 | killallServers, | 5 | killallServers, |
6 | sendRTMPStream, | 6 | sendRTMPStream, |
7 | ServerInfo, | 7 | PeerTubeServer, |
8 | setAccessTokensToServers, | 8 | setAccessTokensToServers, |
9 | setDefaultVideoChannel | 9 | setDefaultVideoChannel |
10 | } from '../../shared/extra-utils' | 10 | } from '../../shared/extra-utils' |
@@ -36,7 +36,7 @@ async function run () { | |||
36 | 36 | ||
37 | console.log('Starting server.') | 37 | console.log('Starting server.') |
38 | 38 | ||
39 | const server = await flushAndRunServer(1, {}, [], { hideLogs: false, execArgv: [ '--inspect' ] }) | 39 | const server = await createSingleServer(1, {}, [], { hideLogs: false, execArgv: [ '--inspect' ] }) |
40 | 40 | ||
41 | const cleanup = async () => { | 41 | const cleanup = async () => { |
42 | console.log('Killing server') | 42 | console.log('Killing server') |
@@ -81,7 +81,7 @@ async function run () { | |||
81 | 81 | ||
82 | // ---------------------------------------------------------------------------- | 82 | // ---------------------------------------------------------------------------- |
83 | 83 | ||
84 | async function buildConfig (server: ServerInfo, commandType: CommandType) { | 84 | async function buildConfig (server: PeerTubeServer, commandType: CommandType) { |
85 | await server.config.updateCustomSubConfig({ | 85 | await server.config.updateCustomSubConfig({ |
86 | newConfig: { | 86 | newConfig: { |
87 | instance: { | 87 | instance: { |
diff --git a/shared/extra-utils/miscs/checks.ts b/shared/extra-utils/miscs/checks.ts index 8f7bdb9b5..c81460330 100644 --- a/shared/extra-utils/miscs/checks.ts +++ b/shared/extra-utils/miscs/checks.ts | |||
@@ -6,7 +6,7 @@ import { join } from 'path' | |||
6 | import { root } from '@server/helpers/core-utils' | 6 | import { root } from '@server/helpers/core-utils' |
7 | import { HttpStatusCode } from '@shared/core-utils' | 7 | import { HttpStatusCode } from '@shared/core-utils' |
8 | import { makeGetRequest } from '../requests' | 8 | import { makeGetRequest } from '../requests' |
9 | import { ServerInfo } from '../server' | 9 | import { PeerTubeServer } from '../server' |
10 | 10 | ||
11 | // Default interval -> 5 minutes | 11 | // Default interval -> 5 minutes |
12 | function dateIsValid (dateString: string, interval = 300000) { | 12 | function dateIsValid (dateString: string, interval = 300000) { |
@@ -33,7 +33,7 @@ async function testImage (url: string, imageName: string, imagePath: string, ext | |||
33 | expect(data.length).to.be.below(maxLength, 'the generated image is way larger than the recorded fixture') | 33 | expect(data.length).to.be.below(maxLength, 'the generated image is way larger than the recorded fixture') |
34 | } | 34 | } |
35 | 35 | ||
36 | async function testFileExistsOrNot (server: ServerInfo, directory: string, filePath: string, exist: boolean) { | 36 | async function testFileExistsOrNot (server: PeerTubeServer, directory: string, filePath: string, exist: boolean) { |
37 | const base = server.servers.buildDirectory(directory) | 37 | const base = server.servers.buildDirectory(directory) |
38 | 38 | ||
39 | expect(await pathExists(join(base, filePath))).to.equal(exist) | 39 | expect(await pathExists(join(base, filePath))).to.equal(exist) |
diff --git a/shared/extra-utils/miscs/webtorrent.ts b/shared/extra-utils/miscs/webtorrent.ts index 84e390b2a..815ea3d56 100644 --- a/shared/extra-utils/miscs/webtorrent.ts +++ b/shared/extra-utils/miscs/webtorrent.ts | |||
@@ -2,7 +2,7 @@ import { readFile } from 'fs-extra' | |||
2 | import * as parseTorrent from 'parse-torrent' | 2 | import * as parseTorrent from 'parse-torrent' |
3 | import { join } from 'path' | 3 | import { join } from 'path' |
4 | import * as WebTorrent from 'webtorrent' | 4 | import * as WebTorrent from 'webtorrent' |
5 | import { ServerInfo } from '../server' | 5 | import { PeerTubeServer } from '../server' |
6 | 6 | ||
7 | let webtorrent: WebTorrent.Instance | 7 | let webtorrent: WebTorrent.Instance |
8 | 8 | ||
@@ -15,7 +15,7 @@ function webtorrentAdd (torrent: string, refreshWebTorrent = false) { | |||
15 | return new Promise<WebTorrent.Torrent>(res => webtorrent.add(torrent, res)) | 15 | return new Promise<WebTorrent.Torrent>(res => webtorrent.add(torrent, res)) |
16 | } | 16 | } |
17 | 17 | ||
18 | async function parseTorrentVideo (server: ServerInfo, videoUUID: string, resolution: number) { | 18 | async function parseTorrentVideo (server: PeerTubeServer, videoUUID: string, resolution: number) { |
19 | const torrentName = videoUUID + '-' + resolution + '.torrent' | 19 | const torrentName = videoUUID + '-' + resolution + '.torrent' |
20 | const torrentPath = server.servers.buildDirectory(join('torrents', torrentName)) | 20 | const torrentPath = server.servers.buildDirectory(join('torrents', torrentName)) |
21 | 21 | ||
diff --git a/shared/extra-utils/server/directories.ts b/shared/extra-utils/server/directories.ts index 3cd38a561..b6465cbf4 100644 --- a/shared/extra-utils/server/directories.ts +++ b/shared/extra-utils/server/directories.ts | |||
@@ -4,9 +4,9 @@ import { expect } from 'chai' | |||
4 | import { pathExists, readdir } from 'fs-extra' | 4 | import { pathExists, readdir } from 'fs-extra' |
5 | import { join } from 'path' | 5 | import { join } from 'path' |
6 | import { root } from '@server/helpers/core-utils' | 6 | import { root } from '@server/helpers/core-utils' |
7 | import { ServerInfo } from './servers' | 7 | import { PeerTubeServer } from './server' |
8 | 8 | ||
9 | async function checkTmpIsEmpty (server: ServerInfo) { | 9 | async function checkTmpIsEmpty (server: PeerTubeServer) { |
10 | await checkDirectoryIsEmpty(server, 'tmp', [ 'plugins-global.css', 'hls', 'resumable-uploads' ]) | 10 | await checkDirectoryIsEmpty(server, 'tmp', [ 'plugins-global.css', 'hls', 'resumable-uploads' ]) |
11 | 11 | ||
12 | if (await pathExists(join('test' + server.internalServerNumber, 'tmp', 'hls'))) { | 12 | if (await pathExists(join('test' + server.internalServerNumber, 'tmp', 'hls'))) { |
@@ -14,7 +14,7 @@ async function checkTmpIsEmpty (server: ServerInfo) { | |||
14 | } | 14 | } |
15 | } | 15 | } |
16 | 16 | ||
17 | async function checkDirectoryIsEmpty (server: ServerInfo, directory: string, exceptions: string[] = []) { | 17 | async function checkDirectoryIsEmpty (server: PeerTubeServer, directory: string, exceptions: string[] = []) { |
18 | const testDirectory = 'test' + server.internalServerNumber | 18 | const testDirectory = 'test' + server.internalServerNumber |
19 | 19 | ||
20 | const directoryPath = join(root(), testDirectory, directory) | 20 | const directoryPath = join(root(), testDirectory, directory) |
diff --git a/shared/extra-utils/server/follows-command.ts b/shared/extra-utils/server/follows-command.ts index 4e1e56d7a..4e9ed9494 100644 --- a/shared/extra-utils/server/follows-command.ts +++ b/shared/extra-utils/server/follows-command.ts | |||
@@ -2,7 +2,7 @@ import { pick } from 'lodash' | |||
2 | import { ActivityPubActorType, ActorFollow, FollowState, ResultList } from '@shared/models' | 2 | import { ActivityPubActorType, ActorFollow, FollowState, ResultList } from '@shared/models' |
3 | import { HttpStatusCode } from '../../core-utils/miscs/http-error-codes' | 3 | import { HttpStatusCode } from '../../core-utils/miscs/http-error-codes' |
4 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | 4 | import { AbstractCommand, OverrideCommandOptions } from '../shared' |
5 | import { ServerInfo } from './servers' | 5 | import { PeerTubeServer } from './server' |
6 | 6 | ||
7 | export class FollowsCommand extends AbstractCommand { | 7 | export class FollowsCommand extends AbstractCommand { |
8 | 8 | ||
@@ -70,7 +70,7 @@ export class FollowsCommand extends AbstractCommand { | |||
70 | } | 70 | } |
71 | 71 | ||
72 | async unfollow (options: OverrideCommandOptions & { | 72 | async unfollow (options: OverrideCommandOptions & { |
73 | target: ServerInfo | 73 | target: PeerTubeServer |
74 | }) { | 74 | }) { |
75 | const path = '/api/v1/server/following/' + options.target.host | 75 | const path = '/api/v1/server/following/' + options.target.host |
76 | 76 | ||
@@ -112,7 +112,7 @@ export class FollowsCommand extends AbstractCommand { | |||
112 | } | 112 | } |
113 | 113 | ||
114 | removeFollower (options: OverrideCommandOptions & { | 114 | removeFollower (options: OverrideCommandOptions & { |
115 | follower: ServerInfo | 115 | follower: PeerTubeServer |
116 | }) { | 116 | }) { |
117 | const path = '/api/v1/server/followers/peertube@' + options.follower.host | 117 | const path = '/api/v1/server/followers/peertube@' + options.follower.host |
118 | 118 | ||
diff --git a/shared/extra-utils/server/follows.ts b/shared/extra-utils/server/follows.ts index 50ae898cc..0188be1aa 100644 --- a/shared/extra-utils/server/follows.ts +++ b/shared/extra-utils/server/follows.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import { waitJobs } from './jobs' | 1 | import { waitJobs } from './jobs' |
2 | import { ServerInfo } from './servers' | 2 | import { PeerTubeServer } from './server' |
3 | 3 | ||
4 | async function doubleFollow (server1: ServerInfo, server2: ServerInfo) { | 4 | async function doubleFollow (server1: PeerTubeServer, server2: PeerTubeServer) { |
5 | await Promise.all([ | 5 | await Promise.all([ |
6 | server1.follows.follow({ targets: [ server2.url ] }), | 6 | server1.follows.follow({ targets: [ server2.url ] }), |
7 | server2.follows.follow({ targets: [ server1.url ] }) | 7 | server2.follows.follow({ targets: [ server1.url ] }) |
diff --git a/shared/extra-utils/server/index.ts b/shared/extra-utils/server/index.ts index 669b004cd..9055dfc57 100644 --- a/shared/extra-utils/server/index.ts +++ b/shared/extra-utils/server/index.ts | |||
@@ -9,6 +9,7 @@ export * from './jobs-command' | |||
9 | export * from './plugins-command' | 9 | export * from './plugins-command' |
10 | export * from './plugins' | 10 | export * from './plugins' |
11 | export * from './redundancy-command' | 11 | export * from './redundancy-command' |
12 | export * from './server' | ||
12 | export * from './servers-command' | 13 | export * from './servers-command' |
13 | export * from './servers' | 14 | export * from './servers' |
14 | export * from './stats-command' | 15 | export * from './stats-command' |
diff --git a/shared/extra-utils/server/jobs.ts b/shared/extra-utils/server/jobs.ts index 754530977..64a0353eb 100644 --- a/shared/extra-utils/server/jobs.ts +++ b/shared/extra-utils/server/jobs.ts | |||
@@ -1,17 +1,17 @@ | |||
1 | 1 | ||
2 | import { JobState } from '../../models' | 2 | import { JobState } from '../../models' |
3 | import { wait } from '../miscs' | 3 | import { wait } from '../miscs' |
4 | import { ServerInfo } from './servers' | 4 | import { PeerTubeServer } from './server' |
5 | 5 | ||
6 | async function waitJobs (serversArg: ServerInfo[] | ServerInfo) { | 6 | async function waitJobs (serversArg: PeerTubeServer[] | PeerTubeServer) { |
7 | const pendingJobWait = process.env.NODE_PENDING_JOB_WAIT | 7 | const pendingJobWait = process.env.NODE_PENDING_JOB_WAIT |
8 | ? parseInt(process.env.NODE_PENDING_JOB_WAIT, 10) | 8 | ? parseInt(process.env.NODE_PENDING_JOB_WAIT, 10) |
9 | : 250 | 9 | : 250 |
10 | 10 | ||
11 | let servers: ServerInfo[] | 11 | let servers: PeerTubeServer[] |
12 | 12 | ||
13 | if (Array.isArray(serversArg) === false) servers = [ serversArg as ServerInfo ] | 13 | if (Array.isArray(serversArg) === false) servers = [ serversArg as PeerTubeServer ] |
14 | else servers = serversArg as ServerInfo[] | 14 | else servers = serversArg as PeerTubeServer[] |
15 | 15 | ||
16 | const states: JobState[] = [ 'waiting', 'active', 'delayed' ] | 16 | const states: JobState[] = [ 'waiting', 'active', 'delayed' ] |
17 | const repeatableJobs = [ 'videos-views', 'activitypub-cleaner' ] | 17 | const repeatableJobs = [ 'videos-views', 'activitypub-cleaner' ] |
diff --git a/shared/extra-utils/server/plugins.ts b/shared/extra-utils/server/plugins.ts index d1cc7e383..0f5fabd5a 100644 --- a/shared/extra-utils/server/plugins.ts +++ b/shared/extra-utils/server/plugins.ts | |||
@@ -1,9 +1,9 @@ | |||
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 | ||
3 | import { expect } from 'chai' | 3 | import { expect } from 'chai' |
4 | import { ServerInfo } from '../server/servers' | 4 | import { PeerTubeServer } from '../server/server' |
5 | 5 | ||
6 | async function testHelloWorldRegisteredSettings (server: ServerInfo) { | 6 | async function testHelloWorldRegisteredSettings (server: PeerTubeServer) { |
7 | const body = await server.plugins.getRegisteredSettings({ npmName: 'peertube-plugin-hello-world' }) | 7 | const body = await server.plugins.getRegisteredSettings({ npmName: 'peertube-plugin-hello-world' }) |
8 | 8 | ||
9 | const registeredSettings = body.registeredSettings | 9 | const registeredSettings = body.registeredSettings |
diff --git a/shared/extra-utils/server/server.ts b/shared/extra-utils/server/server.ts new file mode 100644 index 000000000..b1347661f --- /dev/null +++ b/shared/extra-utils/server/server.ts | |||
@@ -0,0 +1,376 @@ | |||
1 | import { ChildProcess, fork } from 'child_process' | ||
2 | import { copy } from 'fs-extra' | ||
3 | import { join } from 'path' | ||
4 | import { root } from '@server/helpers/core-utils' | ||
5 | import { randomInt } from '../../core-utils/miscs/miscs' | ||
6 | import { VideoChannel } from '../../models/videos' | ||
7 | import { BulkCommand } from '../bulk' | ||
8 | import { CLICommand } from '../cli' | ||
9 | import { CustomPagesCommand } from '../custom-pages' | ||
10 | import { FeedCommand } from '../feeds' | ||
11 | import { LogsCommand } from '../logs' | ||
12 | import { parallelTests, SQLCommand } from '../miscs' | ||
13 | import { AbusesCommand } from '../moderation' | ||
14 | import { OverviewsCommand } from '../overviews' | ||
15 | import { SearchCommand } from '../search' | ||
16 | import { SocketIOCommand } from '../socket' | ||
17 | import { AccountsCommand, BlocklistCommand, LoginCommand, NotificationsCommand, SubscriptionsCommand, UsersCommand } from '../users' | ||
18 | import { | ||
19 | BlacklistCommand, | ||
20 | CaptionsCommand, | ||
21 | ChangeOwnershipCommand, | ||
22 | ChannelsCommand, | ||
23 | HistoryCommand, | ||
24 | ImportsCommand, | ||
25 | LiveCommand, | ||
26 | PlaylistsCommand, | ||
27 | ServicesCommand, | ||
28 | StreamingPlaylistsCommand, | ||
29 | VideosCommand | ||
30 | } from '../videos' | ||
31 | import { CommentsCommand } from '../videos/comments-command' | ||
32 | import { ConfigCommand } from './config-command' | ||
33 | import { ContactFormCommand } from './contact-form-command' | ||
34 | import { DebugCommand } from './debug-command' | ||
35 | import { FollowsCommand } from './follows-command' | ||
36 | import { JobsCommand } from './jobs-command' | ||
37 | import { PluginsCommand } from './plugins-command' | ||
38 | import { RedundancyCommand } from './redundancy-command' | ||
39 | import { ServersCommand } from './servers-command' | ||
40 | import { StatsCommand } from './stats-command' | ||
41 | |||
42 | export type RunServerOptions = { | ||
43 | hideLogs?: boolean | ||
44 | execArgv?: string[] | ||
45 | } | ||
46 | |||
47 | export class PeerTubeServer { | ||
48 | app?: ChildProcess | ||
49 | |||
50 | url: string | ||
51 | host?: string | ||
52 | hostname?: string | ||
53 | port?: number | ||
54 | |||
55 | rtmpPort?: number | ||
56 | |||
57 | parallel?: boolean | ||
58 | internalServerNumber: number | ||
59 | |||
60 | serverNumber?: number | ||
61 | customConfigFile?: string | ||
62 | |||
63 | store?: { | ||
64 | client?: { | ||
65 | id?: string | ||
66 | secret?: string | ||
67 | } | ||
68 | |||
69 | user?: { | ||
70 | username: string | ||
71 | password: string | ||
72 | email?: string | ||
73 | } | ||
74 | |||
75 | channel?: VideoChannel | ||
76 | |||
77 | video?: { | ||
78 | id: number | ||
79 | uuid: string | ||
80 | shortUUID: string | ||
81 | name?: string | ||
82 | url?: string | ||
83 | |||
84 | account?: { | ||
85 | name: string | ||
86 | } | ||
87 | |||
88 | embedPath?: string | ||
89 | } | ||
90 | |||
91 | videos?: { id: number, uuid: string }[] | ||
92 | } | ||
93 | |||
94 | accessToken?: string | ||
95 | refreshToken?: string | ||
96 | |||
97 | bulk?: BulkCommand | ||
98 | cli?: CLICommand | ||
99 | customPage?: CustomPagesCommand | ||
100 | feed?: FeedCommand | ||
101 | logs?: LogsCommand | ||
102 | abuses?: AbusesCommand | ||
103 | overviews?: OverviewsCommand | ||
104 | search?: SearchCommand | ||
105 | contactForm?: ContactFormCommand | ||
106 | debug?: DebugCommand | ||
107 | follows?: FollowsCommand | ||
108 | jobs?: JobsCommand | ||
109 | plugins?: PluginsCommand | ||
110 | redundancy?: RedundancyCommand | ||
111 | stats?: StatsCommand | ||
112 | config?: ConfigCommand | ||
113 | socketIO?: SocketIOCommand | ||
114 | accounts?: AccountsCommand | ||
115 | blocklist?: BlocklistCommand | ||
116 | subscriptions?: SubscriptionsCommand | ||
117 | live?: LiveCommand | ||
118 | services?: ServicesCommand | ||
119 | blacklist?: BlacklistCommand | ||
120 | captions?: CaptionsCommand | ||
121 | changeOwnership?: ChangeOwnershipCommand | ||
122 | playlists?: PlaylistsCommand | ||
123 | history?: HistoryCommand | ||
124 | imports?: ImportsCommand | ||
125 | streamingPlaylists?: StreamingPlaylistsCommand | ||
126 | channels?: ChannelsCommand | ||
127 | comments?: CommentsCommand | ||
128 | sql?: SQLCommand | ||
129 | notifications?: NotificationsCommand | ||
130 | servers?: ServersCommand | ||
131 | login?: LoginCommand | ||
132 | users?: UsersCommand | ||
133 | videos?: VideosCommand | ||
134 | |||
135 | constructor (options: { serverNumber: number } | { url: string }) { | ||
136 | if ((options as any).url) { | ||
137 | this.setUrl((options as any).url) | ||
138 | } else { | ||
139 | this.setServerNumber((options as any).serverNumber) | ||
140 | } | ||
141 | |||
142 | this.store = { | ||
143 | client: { | ||
144 | id: null, | ||
145 | secret: null | ||
146 | }, | ||
147 | user: { | ||
148 | username: null, | ||
149 | password: null | ||
150 | } | ||
151 | } | ||
152 | |||
153 | this.assignCommands() | ||
154 | } | ||
155 | |||
156 | setServerNumber (serverNumber: number) { | ||
157 | this.serverNumber = serverNumber | ||
158 | |||
159 | this.parallel = parallelTests() | ||
160 | |||
161 | this.internalServerNumber = this.parallel ? this.randomServer() : this.serverNumber | ||
162 | this.rtmpPort = this.parallel ? this.randomRTMP() : 1936 | ||
163 | this.port = 9000 + this.internalServerNumber | ||
164 | |||
165 | this.url = `http://localhost:${this.port}` | ||
166 | this.host = `localhost:${this.port}` | ||
167 | this.hostname = 'localhost' | ||
168 | } | ||
169 | |||
170 | setUrl (url: string) { | ||
171 | const parsed = new URL(url) | ||
172 | |||
173 | this.url = url | ||
174 | this.host = parsed.host | ||
175 | this.hostname = parsed.hostname | ||
176 | this.port = parseInt(parsed.port) | ||
177 | } | ||
178 | |||
179 | async flushAndRun (configOverride?: Object, args = [], options: RunServerOptions = {}) { | ||
180 | await ServersCommand.flushTests(this.internalServerNumber) | ||
181 | |||
182 | return this.run(configOverride, args, options) | ||
183 | } | ||
184 | |||
185 | async run (configOverrideArg?: any, args = [], options: RunServerOptions = {}) { | ||
186 | // These actions are async so we need to be sure that they have both been done | ||
187 | const serverRunString = { | ||
188 | 'HTTP server listening': false | ||
189 | } | ||
190 | const key = 'Database peertube_test' + this.internalServerNumber + ' is ready' | ||
191 | serverRunString[key] = false | ||
192 | |||
193 | const regexps = { | ||
194 | client_id: 'Client id: (.+)', | ||
195 | client_secret: 'Client secret: (.+)', | ||
196 | user_username: 'Username: (.+)', | ||
197 | user_password: 'User password: (.+)' | ||
198 | } | ||
199 | |||
200 | await this.assignCustomConfigFile() | ||
201 | |||
202 | const configOverride = this.buildConfigOverride() | ||
203 | |||
204 | if (configOverrideArg !== undefined) { | ||
205 | Object.assign(configOverride, configOverrideArg) | ||
206 | } | ||
207 | |||
208 | // Share the environment | ||
209 | const env = Object.create(process.env) | ||
210 | env['NODE_ENV'] = 'test' | ||
211 | env['NODE_APP_INSTANCE'] = this.internalServerNumber.toString() | ||
212 | env['NODE_CONFIG'] = JSON.stringify(configOverride) | ||
213 | |||
214 | const forkOptions = { | ||
215 | silent: true, | ||
216 | env, | ||
217 | detached: true, | ||
218 | execArgv: options.execArgv || [] | ||
219 | } | ||
220 | |||
221 | return new Promise<void>(res => { | ||
222 | this.app = fork(join(root(), 'dist', 'server.js'), args, forkOptions) | ||
223 | this.app.stdout.on('data', function onStdout (data) { | ||
224 | let dontContinue = false | ||
225 | |||
226 | // Capture things if we want to | ||
227 | for (const key of Object.keys(regexps)) { | ||
228 | const regexp = regexps[key] | ||
229 | const matches = data.toString().match(regexp) | ||
230 | if (matches !== null) { | ||
231 | if (key === 'client_id') this.store.client.id = matches[1] | ||
232 | else if (key === 'client_secret') this.store.client.secret = matches[1] | ||
233 | else if (key === 'user_username') this.store.user.username = matches[1] | ||
234 | else if (key === 'user_password') this.store.user.password = matches[1] | ||
235 | } | ||
236 | } | ||
237 | |||
238 | // Check if all required sentences are here | ||
239 | for (const key of Object.keys(serverRunString)) { | ||
240 | if (data.toString().indexOf(key) !== -1) serverRunString[key] = true | ||
241 | if (serverRunString[key] === false) dontContinue = true | ||
242 | } | ||
243 | |||
244 | // If no, there is maybe one thing not already initialized (client/user credentials generation...) | ||
245 | if (dontContinue === true) return | ||
246 | |||
247 | if (options.hideLogs === false) { | ||
248 | console.log(data.toString()) | ||
249 | } else { | ||
250 | this.app.stdout.removeListener('data', onStdout) | ||
251 | } | ||
252 | |||
253 | process.on('exit', () => { | ||
254 | try { | ||
255 | process.kill(this.server.app.pid) | ||
256 | } catch { /* empty */ } | ||
257 | }) | ||
258 | |||
259 | res() | ||
260 | }) | ||
261 | }) | ||
262 | } | ||
263 | |||
264 | async kill () { | ||
265 | if (!this.app) return | ||
266 | |||
267 | await this.sql.cleanup() | ||
268 | |||
269 | process.kill(-this.app.pid) | ||
270 | |||
271 | this.app = null | ||
272 | } | ||
273 | |||
274 | private randomServer () { | ||
275 | const low = 10 | ||
276 | const high = 10000 | ||
277 | |||
278 | return randomInt(low, high) | ||
279 | } | ||
280 | |||
281 | private randomRTMP () { | ||
282 | const low = 1900 | ||
283 | const high = 2100 | ||
284 | |||
285 | return randomInt(low, high) | ||
286 | } | ||
287 | |||
288 | private async assignCustomConfigFile () { | ||
289 | if (this.internalServerNumber === this.serverNumber) return | ||
290 | |||
291 | const basePath = join(root(), 'config') | ||
292 | |||
293 | const tmpConfigFile = join(basePath, `test-${this.internalServerNumber}.yaml`) | ||
294 | await copy(join(basePath, `test-${this.serverNumber}.yaml`), tmpConfigFile) | ||
295 | |||
296 | this.customConfigFile = tmpConfigFile | ||
297 | } | ||
298 | |||
299 | private buildConfigOverride () { | ||
300 | if (!this.parallel) return {} | ||
301 | |||
302 | return { | ||
303 | listen: { | ||
304 | port: this.port | ||
305 | }, | ||
306 | webserver: { | ||
307 | port: this.port | ||
308 | }, | ||
309 | database: { | ||
310 | suffix: '_test' + this.internalServerNumber | ||
311 | }, | ||
312 | storage: { | ||
313 | tmp: `test${this.internalServerNumber}/tmp/`, | ||
314 | avatars: `test${this.internalServerNumber}/avatars/`, | ||
315 | videos: `test${this.internalServerNumber}/videos/`, | ||
316 | streaming_playlists: `test${this.internalServerNumber}/streaming-playlists/`, | ||
317 | redundancy: `test${this.internalServerNumber}/redundancy/`, | ||
318 | logs: `test${this.internalServerNumber}/logs/`, | ||
319 | previews: `test${this.internalServerNumber}/previews/`, | ||
320 | thumbnails: `test${this.internalServerNumber}/thumbnails/`, | ||
321 | torrents: `test${this.internalServerNumber}/torrents/`, | ||
322 | captions: `test${this.internalServerNumber}/captions/`, | ||
323 | cache: `test${this.internalServerNumber}/cache/`, | ||
324 | plugins: `test${this.internalServerNumber}/plugins/` | ||
325 | }, | ||
326 | admin: { | ||
327 | email: `admin${this.internalServerNumber}@example.com` | ||
328 | }, | ||
329 | live: { | ||
330 | rtmp: { | ||
331 | port: this.rtmpPort | ||
332 | } | ||
333 | } | ||
334 | } | ||
335 | } | ||
336 | |||
337 | private assignCommands () { | ||
338 | this.bulk = new BulkCommand(this) | ||
339 | this.cli = new CLICommand(this) | ||
340 | this.customPage = new CustomPagesCommand(this) | ||
341 | this.feed = new FeedCommand(this) | ||
342 | this.logs = new LogsCommand(this) | ||
343 | this.abuses = new AbusesCommand(this) | ||
344 | this.overviews = new OverviewsCommand(this) | ||
345 | this.search = new SearchCommand(this) | ||
346 | this.contactForm = new ContactFormCommand(this) | ||
347 | this.debug = new DebugCommand(this) | ||
348 | this.follows = new FollowsCommand(this) | ||
349 | this.jobs = new JobsCommand(this) | ||
350 | this.plugins = new PluginsCommand(this) | ||
351 | this.redundancy = new RedundancyCommand(this) | ||
352 | this.stats = new StatsCommand(this) | ||
353 | this.config = new ConfigCommand(this) | ||
354 | this.socketIO = new SocketIOCommand(this) | ||
355 | this.accounts = new AccountsCommand(this) | ||
356 | this.blocklist = new BlocklistCommand(this) | ||
357 | this.subscriptions = new SubscriptionsCommand(this) | ||
358 | this.live = new LiveCommand(this) | ||
359 | this.services = new ServicesCommand(this) | ||
360 | this.blacklist = new BlacklistCommand(this) | ||
361 | this.captions = new CaptionsCommand(this) | ||
362 | this.changeOwnership = new ChangeOwnershipCommand(this) | ||
363 | this.playlists = new PlaylistsCommand(this) | ||
364 | this.history = new HistoryCommand(this) | ||
365 | this.imports = new ImportsCommand(this) | ||
366 | this.streamingPlaylists = new StreamingPlaylistsCommand(this) | ||
367 | this.channels = new ChannelsCommand(this) | ||
368 | this.comments = new CommentsCommand(this) | ||
369 | this.sql = new SQLCommand(this) | ||
370 | this.notifications = new NotificationsCommand(this) | ||
371 | this.servers = new ServersCommand(this) | ||
372 | this.login = new LoginCommand(this) | ||
373 | this.users = new UsersCommand(this) | ||
374 | this.videos = new VideosCommand(this) | ||
375 | } | ||
376 | } | ||
diff --git a/shared/extra-utils/server/servers-command.ts b/shared/extra-utils/server/servers-command.ts index a7c5a868d..1a7b2aade 100644 --- a/shared/extra-utils/server/servers-command.ts +++ b/shared/extra-utils/server/servers-command.ts | |||
@@ -37,7 +37,7 @@ export class ServersCommand extends AbstractCommand { | |||
37 | if (isGithubCI()) { | 37 | if (isGithubCI()) { |
38 | await ensureDir('artifacts') | 38 | await ensureDir('artifacts') |
39 | 39 | ||
40 | const origin = this.server.servers.buildDirectory('logs/peertube.log') | 40 | const origin = this.buildDirectory('logs/peertube.log') |
41 | const destname = `peertube-${this.server.internalServerNumber}.log` | 41 | const destname = `peertube-${this.server.internalServerNumber}.log` |
42 | console.log('Saving logs %s.', destname) | 42 | console.log('Saving logs %s.', destname) |
43 | 43 | ||
diff --git a/shared/extra-utils/server/servers.ts b/shared/extra-utils/server/servers.ts index ea3f19a92..87d7e9449 100644 --- a/shared/extra-utils/server/servers.ts +++ b/shared/extra-utils/server/servers.ts | |||
@@ -1,391 +1,30 @@ | |||
1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/no-floating-promises */ | 1 | import { ensureDir } from 'fs-extra' |
2 | import { isGithubCI } from '../miscs' | ||
3 | import { PeerTubeServer, RunServerOptions } from './server' | ||
2 | 4 | ||
3 | import { ChildProcess, fork } from 'child_process' | 5 | async function createSingleServer (serverNumber: number, configOverride?: Object, args = [], options: RunServerOptions = {}) { |
4 | import { copy, ensureDir } from 'fs-extra' | 6 | const server = new PeerTubeServer({ serverNumber }) |
5 | import { join } from 'path' | ||
6 | import { root } from '@server/helpers/core-utils' | ||
7 | import { randomInt } from '../../core-utils/miscs/miscs' | ||
8 | import { VideoChannel } from '../../models/videos' | ||
9 | import { BulkCommand } from '../bulk' | ||
10 | import { CLICommand } from '../cli' | ||
11 | import { CustomPagesCommand } from '../custom-pages' | ||
12 | import { FeedCommand } from '../feeds' | ||
13 | import { LogsCommand } from '../logs' | ||
14 | import { isGithubCI, parallelTests, SQLCommand } from '../miscs' | ||
15 | import { AbusesCommand } from '../moderation' | ||
16 | import { OverviewsCommand } from '../overviews' | ||
17 | import { SearchCommand } from '../search' | ||
18 | import { SocketIOCommand } from '../socket' | ||
19 | import { AccountsCommand, BlocklistCommand, LoginCommand, NotificationsCommand, SubscriptionsCommand, UsersCommand } from '../users' | ||
20 | import { | ||
21 | BlacklistCommand, | ||
22 | CaptionsCommand, | ||
23 | ChangeOwnershipCommand, | ||
24 | ChannelsCommand, | ||
25 | HistoryCommand, | ||
26 | ImportsCommand, | ||
27 | LiveCommand, | ||
28 | PlaylistsCommand, | ||
29 | ServicesCommand, | ||
30 | StreamingPlaylistsCommand, | ||
31 | VideosCommand | ||
32 | } from '../videos' | ||
33 | import { CommentsCommand } from '../videos/comments-command' | ||
34 | import { ConfigCommand } from './config-command' | ||
35 | import { ContactFormCommand } from './contact-form-command' | ||
36 | import { DebugCommand } from './debug-command' | ||
37 | import { FollowsCommand } from './follows-command' | ||
38 | import { JobsCommand } from './jobs-command' | ||
39 | import { PluginsCommand } from './plugins-command' | ||
40 | import { RedundancyCommand } from './redundancy-command' | ||
41 | import { ServersCommand } from './servers-command' | ||
42 | import { StatsCommand } from './stats-command' | ||
43 | 7 | ||
44 | interface ServerInfo { | 8 | await server.flushAndRun(configOverride, args, options) |
45 | app?: ChildProcess | ||
46 | 9 | ||
47 | url: string | 10 | return server |
48 | host?: string | ||
49 | hostname?: string | ||
50 | port?: number | ||
51 | |||
52 | rtmpPort?: number | ||
53 | |||
54 | parallel?: boolean | ||
55 | internalServerNumber: number | ||
56 | |||
57 | serverNumber?: number | ||
58 | customConfigFile?: string | ||
59 | |||
60 | store?: { | ||
61 | client?: { | ||
62 | id?: string | ||
63 | secret?: string | ||
64 | } | ||
65 | |||
66 | user?: { | ||
67 | username: string | ||
68 | password: string | ||
69 | email?: string | ||
70 | } | ||
71 | |||
72 | channel?: VideoChannel | ||
73 | |||
74 | video?: { | ||
75 | id: number | ||
76 | uuid: string | ||
77 | shortUUID: string | ||
78 | name?: string | ||
79 | url?: string | ||
80 | |||
81 | account?: { | ||
82 | name: string | ||
83 | } | ||
84 | |||
85 | embedPath?: string | ||
86 | } | ||
87 | |||
88 | videos?: { id: number, uuid: string }[] | ||
89 | } | ||
90 | |||
91 | accessToken?: string | ||
92 | refreshToken?: string | ||
93 | |||
94 | bulk?: BulkCommand | ||
95 | cli?: CLICommand | ||
96 | customPage?: CustomPagesCommand | ||
97 | feed?: FeedCommand | ||
98 | logs?: LogsCommand | ||
99 | abuses?: AbusesCommand | ||
100 | overviews?: OverviewsCommand | ||
101 | search?: SearchCommand | ||
102 | contactForm?: ContactFormCommand | ||
103 | debug?: DebugCommand | ||
104 | follows?: FollowsCommand | ||
105 | jobs?: JobsCommand | ||
106 | plugins?: PluginsCommand | ||
107 | redundancy?: RedundancyCommand | ||
108 | stats?: StatsCommand | ||
109 | config?: ConfigCommand | ||
110 | socketIO?: SocketIOCommand | ||
111 | accounts?: AccountsCommand | ||
112 | blocklist?: BlocklistCommand | ||
113 | subscriptions?: SubscriptionsCommand | ||
114 | live?: LiveCommand | ||
115 | services?: ServicesCommand | ||
116 | blacklist?: BlacklistCommand | ||
117 | captions?: CaptionsCommand | ||
118 | changeOwnership?: ChangeOwnershipCommand | ||
119 | playlists?: PlaylistsCommand | ||
120 | history?: HistoryCommand | ||
121 | imports?: ImportsCommand | ||
122 | streamingPlaylists?: StreamingPlaylistsCommand | ||
123 | channels?: ChannelsCommand | ||
124 | comments?: CommentsCommand | ||
125 | sql?: SQLCommand | ||
126 | notifications?: NotificationsCommand | ||
127 | servers?: ServersCommand | ||
128 | login?: LoginCommand | ||
129 | users?: UsersCommand | ||
130 | videos?: VideosCommand | ||
131 | } | ||
132 | |||
133 | function flushAndRunMultipleServers (totalServers: number, configOverride?: Object) { | ||
134 | const apps = [] | ||
135 | let i = 0 | ||
136 | |||
137 | return new Promise<ServerInfo[]>(res => { | ||
138 | function anotherServerDone (serverNumber, app) { | ||
139 | apps[serverNumber - 1] = app | ||
140 | i++ | ||
141 | if (i === totalServers) { | ||
142 | return res(apps) | ||
143 | } | ||
144 | } | ||
145 | |||
146 | for (let j = 1; j <= totalServers; j++) { | ||
147 | flushAndRunServer(j, configOverride).then(app => anotherServerDone(j, app)) | ||
148 | } | ||
149 | }) | ||
150 | } | ||
151 | |||
152 | function randomServer () { | ||
153 | const low = 10 | ||
154 | const high = 10000 | ||
155 | |||
156 | return randomInt(low, high) | ||
157 | } | ||
158 | |||
159 | function randomRTMP () { | ||
160 | const low = 1900 | ||
161 | const high = 2100 | ||
162 | |||
163 | return randomInt(low, high) | ||
164 | } | ||
165 | |||
166 | type RunServerOptions = { | ||
167 | hideLogs?: boolean | ||
168 | execArgv?: string[] | ||
169 | } | ||
170 | |||
171 | async function flushAndRunServer (serverNumber: number, configOverride?: Object, args = [], options: RunServerOptions = {}) { | ||
172 | const parallel = parallelTests() | ||
173 | |||
174 | const internalServerNumber = parallel ? randomServer() : serverNumber | ||
175 | const rtmpPort = parallel ? randomRTMP() : 1936 | ||
176 | const port = 9000 + internalServerNumber | ||
177 | |||
178 | await ServersCommand.flushTests(internalServerNumber) | ||
179 | |||
180 | const server: ServerInfo = { | ||
181 | app: null, | ||
182 | port, | ||
183 | internalServerNumber, | ||
184 | rtmpPort, | ||
185 | parallel, | ||
186 | serverNumber, | ||
187 | url: `http://localhost:${port}`, | ||
188 | host: `localhost:${port}`, | ||
189 | hostname: 'localhost', | ||
190 | store: { | ||
191 | client: { | ||
192 | id: null, | ||
193 | secret: null | ||
194 | }, | ||
195 | user: { | ||
196 | username: null, | ||
197 | password: null | ||
198 | } | ||
199 | } | ||
200 | } | ||
201 | |||
202 | return runServer(server, configOverride, args, options) | ||
203 | } | 11 | } |
204 | 12 | ||
205 | async function runServer (server: ServerInfo, configOverrideArg?: any, args = [], options: RunServerOptions = {}) { | 13 | function createMultipleServers (totalServers: number, configOverride?: Object) { |
206 | // These actions are async so we need to be sure that they have both been done | 14 | const serverPromises: Promise<PeerTubeServer>[] = [] |
207 | const serverRunString = { | ||
208 | 'HTTP server listening': false | ||
209 | } | ||
210 | const key = 'Database peertube_test' + server.internalServerNumber + ' is ready' | ||
211 | serverRunString[key] = false | ||
212 | |||
213 | const regexps = { | ||
214 | client_id: 'Client id: (.+)', | ||
215 | client_secret: 'Client secret: (.+)', | ||
216 | user_username: 'Username: (.+)', | ||
217 | user_password: 'User password: (.+)' | ||
218 | } | ||
219 | |||
220 | if (server.internalServerNumber !== server.serverNumber) { | ||
221 | const basePath = join(root(), 'config') | ||
222 | |||
223 | const tmpConfigFile = join(basePath, `test-${server.internalServerNumber}.yaml`) | ||
224 | await copy(join(basePath, `test-${server.serverNumber}.yaml`), tmpConfigFile) | ||
225 | |||
226 | server.customConfigFile = tmpConfigFile | ||
227 | } | ||
228 | |||
229 | const configOverride: any = {} | ||
230 | |||
231 | if (server.parallel) { | ||
232 | Object.assign(configOverride, { | ||
233 | listen: { | ||
234 | port: server.port | ||
235 | }, | ||
236 | webserver: { | ||
237 | port: server.port | ||
238 | }, | ||
239 | database: { | ||
240 | suffix: '_test' + server.internalServerNumber | ||
241 | }, | ||
242 | storage: { | ||
243 | tmp: `test${server.internalServerNumber}/tmp/`, | ||
244 | avatars: `test${server.internalServerNumber}/avatars/`, | ||
245 | videos: `test${server.internalServerNumber}/videos/`, | ||
246 | streaming_playlists: `test${server.internalServerNumber}/streaming-playlists/`, | ||
247 | redundancy: `test${server.internalServerNumber}/redundancy/`, | ||
248 | logs: `test${server.internalServerNumber}/logs/`, | ||
249 | previews: `test${server.internalServerNumber}/previews/`, | ||
250 | thumbnails: `test${server.internalServerNumber}/thumbnails/`, | ||
251 | torrents: `test${server.internalServerNumber}/torrents/`, | ||
252 | captions: `test${server.internalServerNumber}/captions/`, | ||
253 | cache: `test${server.internalServerNumber}/cache/`, | ||
254 | plugins: `test${server.internalServerNumber}/plugins/` | ||
255 | }, | ||
256 | admin: { | ||
257 | email: `admin${server.internalServerNumber}@example.com` | ||
258 | }, | ||
259 | live: { | ||
260 | rtmp: { | ||
261 | port: server.rtmpPort | ||
262 | } | ||
263 | } | ||
264 | }) | ||
265 | } | ||
266 | |||
267 | if (configOverrideArg !== undefined) { | ||
268 | Object.assign(configOverride, configOverrideArg) | ||
269 | } | ||
270 | |||
271 | // Share the environment | ||
272 | const env = Object.create(process.env) | ||
273 | env['NODE_ENV'] = 'test' | ||
274 | env['NODE_APP_INSTANCE'] = server.internalServerNumber.toString() | ||
275 | env['NODE_CONFIG'] = JSON.stringify(configOverride) | ||
276 | 15 | ||
277 | const forkOptions = { | 16 | for (let i = 1; i <= totalServers; i++) { |
278 | silent: true, | 17 | serverPromises.push(createSingleServer(i, configOverride)) |
279 | env, | ||
280 | detached: true, | ||
281 | execArgv: options.execArgv || [] | ||
282 | } | 18 | } |
283 | 19 | ||
284 | return new Promise<ServerInfo>(res => { | 20 | return Promise.all(serverPromises) |
285 | server.app = fork(join(root(), 'dist', 'server.js'), args, forkOptions) | ||
286 | server.app.stdout.on('data', function onStdout (data) { | ||
287 | let dontContinue = false | ||
288 | |||
289 | // Capture things if we want to | ||
290 | for (const key of Object.keys(regexps)) { | ||
291 | const regexp = regexps[key] | ||
292 | const matches = data.toString().match(regexp) | ||
293 | if (matches !== null) { | ||
294 | if (key === 'client_id') server.store.client.id = matches[1] | ||
295 | else if (key === 'client_secret') server.store.client.secret = matches[1] | ||
296 | else if (key === 'user_username') server.store.user.username = matches[1] | ||
297 | else if (key === 'user_password') server.store.user.password = matches[1] | ||
298 | } | ||
299 | } | ||
300 | |||
301 | // Check if all required sentences are here | ||
302 | for (const key of Object.keys(serverRunString)) { | ||
303 | if (data.toString().indexOf(key) !== -1) serverRunString[key] = true | ||
304 | if (serverRunString[key] === false) dontContinue = true | ||
305 | } | ||
306 | |||
307 | // If no, there is maybe one thing not already initialized (client/user credentials generation...) | ||
308 | if (dontContinue === true) return | ||
309 | |||
310 | if (options.hideLogs === false) { | ||
311 | console.log(data.toString()) | ||
312 | } else { | ||
313 | server.app.stdout.removeListener('data', onStdout) | ||
314 | } | ||
315 | |||
316 | process.on('exit', () => { | ||
317 | try { | ||
318 | process.kill(server.app.pid) | ||
319 | } catch { /* empty */ } | ||
320 | }) | ||
321 | |||
322 | assignCommands(server) | ||
323 | |||
324 | res(server) | ||
325 | }) | ||
326 | }) | ||
327 | } | ||
328 | |||
329 | function assignCommands (server: ServerInfo) { | ||
330 | server.bulk = new BulkCommand(server) | ||
331 | server.cli = new CLICommand(server) | ||
332 | server.customPage = new CustomPagesCommand(server) | ||
333 | server.feed = new FeedCommand(server) | ||
334 | server.logs = new LogsCommand(server) | ||
335 | server.abuses = new AbusesCommand(server) | ||
336 | server.overviews = new OverviewsCommand(server) | ||
337 | server.search = new SearchCommand(server) | ||
338 | server.contactForm = new ContactFormCommand(server) | ||
339 | server.debug = new DebugCommand(server) | ||
340 | server.follows = new FollowsCommand(server) | ||
341 | server.jobs = new JobsCommand(server) | ||
342 | server.plugins = new PluginsCommand(server) | ||
343 | server.redundancy = new RedundancyCommand(server) | ||
344 | server.stats = new StatsCommand(server) | ||
345 | server.config = new ConfigCommand(server) | ||
346 | server.socketIO = new SocketIOCommand(server) | ||
347 | server.accounts = new AccountsCommand(server) | ||
348 | server.blocklist = new BlocklistCommand(server) | ||
349 | server.subscriptions = new SubscriptionsCommand(server) | ||
350 | server.live = new LiveCommand(server) | ||
351 | server.services = new ServicesCommand(server) | ||
352 | server.blacklist = new BlacklistCommand(server) | ||
353 | server.captions = new CaptionsCommand(server) | ||
354 | server.changeOwnership = new ChangeOwnershipCommand(server) | ||
355 | server.playlists = new PlaylistsCommand(server) | ||
356 | server.history = new HistoryCommand(server) | ||
357 | server.imports = new ImportsCommand(server) | ||
358 | server.streamingPlaylists = new StreamingPlaylistsCommand(server) | ||
359 | server.channels = new ChannelsCommand(server) | ||
360 | server.comments = new CommentsCommand(server) | ||
361 | server.sql = new SQLCommand(server) | ||
362 | server.notifications = new NotificationsCommand(server) | ||
363 | server.servers = new ServersCommand(server) | ||
364 | server.login = new LoginCommand(server) | ||
365 | server.users = new UsersCommand(server) | ||
366 | server.videos = new VideosCommand(server) | ||
367 | } | ||
368 | |||
369 | async function reRunServer (server: ServerInfo, configOverride?: any) { | ||
370 | const newServer = await runServer(server, configOverride) | ||
371 | server.app = newServer.app | ||
372 | |||
373 | return server | ||
374 | } | 21 | } |
375 | 22 | ||
376 | async function killallServers (servers: ServerInfo[]) { | 23 | async function killallServers (servers: PeerTubeServer[]) { |
377 | for (const server of servers) { | 24 | return Promise.all(servers.map(s => s.kill())) |
378 | if (!server.app) continue | ||
379 | |||
380 | await server.sql.cleanup() | ||
381 | |||
382 | process.kill(-server.app.pid) | ||
383 | |||
384 | server.app = null | ||
385 | } | ||
386 | } | 25 | } |
387 | 26 | ||
388 | async function cleanupTests (servers: ServerInfo[]) { | 27 | async function cleanupTests (servers: PeerTubeServer[]) { |
389 | await killallServers(servers) | 28 | await killallServers(servers) |
390 | 29 | ||
391 | if (isGithubCI()) { | 30 | if (isGithubCI()) { |
@@ -403,11 +42,8 @@ async function cleanupTests (servers: ServerInfo[]) { | |||
403 | // --------------------------------------------------------------------------- | 42 | // --------------------------------------------------------------------------- |
404 | 43 | ||
405 | export { | 44 | export { |
406 | ServerInfo, | 45 | createSingleServer, |
46 | createMultipleServers, | ||
407 | cleanupTests, | 47 | cleanupTests, |
408 | flushAndRunMultipleServers, | 48 | killallServers |
409 | flushAndRunServer, | ||
410 | killallServers, | ||
411 | reRunServer, | ||
412 | assignCommands | ||
413 | } | 49 | } |
diff --git a/shared/extra-utils/shared/abstract-command.ts b/shared/extra-utils/shared/abstract-command.ts index 5fddcf639..967f8f2ac 100644 --- a/shared/extra-utils/shared/abstract-command.ts +++ b/shared/extra-utils/shared/abstract-command.ts | |||
@@ -9,7 +9,7 @@ import { | |||
9 | unwrapBody, | 9 | unwrapBody, |
10 | unwrapText | 10 | unwrapText |
11 | } from '../requests/requests' | 11 | } from '../requests/requests' |
12 | import { ServerInfo } from '../server/servers' | 12 | import { PeerTubeServer } from '../server/server' |
13 | 13 | ||
14 | export interface OverrideCommandOptions { | 14 | export interface OverrideCommandOptions { |
15 | token?: string | 15 | token?: string |
@@ -38,7 +38,7 @@ interface InternalGetCommandOptions extends InternalCommonCommandOptions { | |||
38 | abstract class AbstractCommand { | 38 | abstract class AbstractCommand { |
39 | 39 | ||
40 | constructor ( | 40 | constructor ( |
41 | protected server: ServerInfo | 41 | protected server: PeerTubeServer |
42 | ) { | 42 | ) { |
43 | 43 | ||
44 | } | 44 | } |
diff --git a/shared/extra-utils/users/accounts.ts b/shared/extra-utils/users/accounts.ts index 2c9a4b71c..9fc1bcfc4 100644 --- a/shared/extra-utils/users/accounts.ts +++ b/shared/extra-utils/users/accounts.ts | |||
@@ -4,10 +4,10 @@ import { expect } from 'chai' | |||
4 | import { pathExists, readdir } from 'fs-extra' | 4 | import { pathExists, readdir } from 'fs-extra' |
5 | import { join } from 'path' | 5 | import { join } from 'path' |
6 | import { root } from '@server/helpers/core-utils' | 6 | import { root } from '@server/helpers/core-utils' |
7 | import { ServerInfo } from '../server' | 7 | import { PeerTubeServer } from '../server' |
8 | 8 | ||
9 | async function expectAccountFollows (options: { | 9 | async function expectAccountFollows (options: { |
10 | server: ServerInfo | 10 | server: PeerTubeServer |
11 | handle: string | 11 | handle: string |
12 | followers: number | 12 | followers: number |
13 | following: number | 13 | following: number |
diff --git a/shared/extra-utils/users/login.ts b/shared/extra-utils/users/login.ts index d0c26a4f0..f1df027d3 100644 --- a/shared/extra-utils/users/login.ts +++ b/shared/extra-utils/users/login.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { ServerInfo } from '../server/servers' | 1 | import { PeerTubeServer } from '../server/server' |
2 | 2 | ||
3 | function setAccessTokensToServers (servers: ServerInfo[]) { | 3 | function setAccessTokensToServers (servers: PeerTubeServer[]) { |
4 | const tasks: Promise<any>[] = [] | 4 | const tasks: Promise<any>[] = [] |
5 | 5 | ||
6 | for (const server of servers) { | 6 | for (const server of servers) { |
diff --git a/shared/extra-utils/users/notifications.ts b/shared/extra-utils/users/notifications.ts index 9196f0bf5..4c42fad3e 100644 --- a/shared/extra-utils/users/notifications.ts +++ b/shared/extra-utils/users/notifications.ts | |||
@@ -5,8 +5,9 @@ import { inspect } from 'util' | |||
5 | import { AbuseState, PluginType } from '@shared/models' | 5 | import { AbuseState, PluginType } from '@shared/models' |
6 | import { UserNotification, UserNotificationSetting, UserNotificationSettingValue, UserNotificationType } from '../../models/users' | 6 | import { UserNotification, UserNotificationSetting, UserNotificationSettingValue, UserNotificationType } from '../../models/users' |
7 | import { MockSmtpServer } from '../mock-servers/mock-email' | 7 | import { MockSmtpServer } from '../mock-servers/mock-email' |
8 | import { PeerTubeServer } from '../server' | ||
8 | import { doubleFollow } from '../server/follows' | 9 | import { doubleFollow } from '../server/follows' |
9 | import { flushAndRunMultipleServers, ServerInfo } from '../server/servers' | 10 | import { createMultipleServers } from '../server/servers' |
10 | import { setAccessTokensToServers } from './login' | 11 | import { setAccessTokensToServers } from './login' |
11 | 12 | ||
12 | function getAllNotificationsSettings (): UserNotificationSetting { | 13 | function getAllNotificationsSettings (): UserNotificationSetting { |
@@ -31,7 +32,7 @@ function getAllNotificationsSettings (): UserNotificationSetting { | |||
31 | } | 32 | } |
32 | 33 | ||
33 | type CheckerBaseParams = { | 34 | type CheckerBaseParams = { |
34 | server: ServerInfo | 35 | server: PeerTubeServer |
35 | emails: any[] | 36 | emails: any[] |
36 | socketNotifications: UserNotification[] | 37 | socketNotifications: UserNotification[] |
37 | token: string | 38 | token: string |
@@ -642,7 +643,7 @@ async function prepareNotificationsTest (serversCount = 3, overrideConfigArg: an | |||
642 | limit: 20 | 643 | limit: 20 |
643 | } | 644 | } |
644 | } | 645 | } |
645 | const servers = await flushAndRunMultipleServers(serversCount, Object.assign(overrideConfig, overrideConfigArg)) | 646 | const servers = await createMultipleServers(serversCount, Object.assign(overrideConfig, overrideConfigArg)) |
646 | 647 | ||
647 | await setAccessTokensToServers(servers) | 648 | await setAccessTokensToServers(servers) |
648 | 649 | ||
diff --git a/shared/extra-utils/videos/channels.ts b/shared/extra-utils/videos/channels.ts index 81e818094..756c47453 100644 --- a/shared/extra-utils/videos/channels.ts +++ b/shared/extra-utils/videos/channels.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { ServerInfo } from '../server/servers' | 1 | import { PeerTubeServer } from '../server/server' |
2 | 2 | ||
3 | function setDefaultVideoChannel (servers: ServerInfo[]) { | 3 | function setDefaultVideoChannel (servers: PeerTubeServer[]) { |
4 | const tasks: Promise<any>[] = [] | 4 | const tasks: Promise<any>[] = [] |
5 | 5 | ||
6 | for (const server of servers) { | 6 | for (const server of servers) { |
diff --git a/shared/extra-utils/videos/live.ts b/shared/extra-utils/videos/live.ts index 353595811..502964b1a 100644 --- a/shared/extra-utils/videos/live.ts +++ b/shared/extra-utils/videos/live.ts | |||
@@ -5,7 +5,7 @@ import * as ffmpeg from 'fluent-ffmpeg' | |||
5 | import { pathExists, readdir } from 'fs-extra' | 5 | import { pathExists, readdir } from 'fs-extra' |
6 | import { join } from 'path' | 6 | import { join } from 'path' |
7 | import { buildAbsoluteFixturePath, wait } from '../miscs' | 7 | import { buildAbsoluteFixturePath, wait } from '../miscs' |
8 | import { ServerInfo } from '../server/servers' | 8 | import { PeerTubeServer } from '../server/server' |
9 | 9 | ||
10 | function sendRTMPStream (rtmpBaseUrl: string, streamKey: string, fixtureName = 'video_short.mp4') { | 10 | function sendRTMPStream (rtmpBaseUrl: string, streamKey: string, fixtureName = 'video_short.mp4') { |
11 | const fixture = buildAbsoluteFixturePath(fixtureName) | 11 | const fixture = buildAbsoluteFixturePath(fixtureName) |
@@ -70,13 +70,13 @@ async function stopFfmpeg (command: ffmpeg.FfmpegCommand) { | |||
70 | await wait(500) | 70 | await wait(500) |
71 | } | 71 | } |
72 | 72 | ||
73 | async function waitUntilLivePublishedOnAllServers (servers: ServerInfo[], videoId: string) { | 73 | async function waitUntilLivePublishedOnAllServers (servers: PeerTubeServer[], videoId: string) { |
74 | for (const server of servers) { | 74 | for (const server of servers) { |
75 | await server.live.waitUntilPublished({ videoId }) | 75 | await server.live.waitUntilPublished({ videoId }) |
76 | } | 76 | } |
77 | } | 77 | } |
78 | 78 | ||
79 | async function checkLiveCleanup (server: ServerInfo, videoUUID: string, resolutions: number[] = []) { | 79 | async function checkLiveCleanup (server: PeerTubeServer, videoUUID: string, resolutions: number[] = []) { |
80 | const basePath = server.servers.buildDirectory('streaming-playlists') | 80 | const basePath = server.servers.buildDirectory('streaming-playlists') |
81 | const hlsPath = join(basePath, 'hls', videoUUID) | 81 | const hlsPath = join(basePath, 'hls', videoUUID) |
82 | 82 | ||
diff --git a/shared/extra-utils/videos/streaming-playlists.ts b/shared/extra-utils/videos/streaming-playlists.ts index e8fd2f232..002ae08b2 100644 --- a/shared/extra-utils/videos/streaming-playlists.ts +++ b/shared/extra-utils/videos/streaming-playlists.ts | |||
@@ -2,10 +2,10 @@ import { expect } from 'chai' | |||
2 | import { sha256 } from '@server/helpers/core-utils' | 2 | import { sha256 } from '@server/helpers/core-utils' |
3 | import { HttpStatusCode } from '@shared/core-utils' | 3 | import { HttpStatusCode } from '@shared/core-utils' |
4 | import { VideoStreamingPlaylist } from '@shared/models' | 4 | import { VideoStreamingPlaylist } from '@shared/models' |
5 | import { ServerInfo } from '../server' | 5 | import { PeerTubeServer } from '../server' |
6 | 6 | ||
7 | async function checkSegmentHash (options: { | 7 | async function checkSegmentHash (options: { |
8 | server: ServerInfo | 8 | server: PeerTubeServer |
9 | baseUrlPlaylist: string | 9 | baseUrlPlaylist: string |
10 | baseUrlSegment: string | 10 | baseUrlSegment: string |
11 | videoUUID: string | 11 | videoUUID: string |
@@ -36,7 +36,7 @@ async function checkSegmentHash (options: { | |||
36 | } | 36 | } |
37 | 37 | ||
38 | async function checkLiveSegmentHash (options: { | 38 | async function checkLiveSegmentHash (options: { |
39 | server: ServerInfo | 39 | server: PeerTubeServer |
40 | baseUrlSegment: string | 40 | baseUrlSegment: string |
41 | videoUUID: string | 41 | videoUUID: string |
42 | segmentName: string | 42 | segmentName: string |
@@ -52,7 +52,7 @@ async function checkLiveSegmentHash (options: { | |||
52 | } | 52 | } |
53 | 53 | ||
54 | async function checkResolutionsInMasterPlaylist (options: { | 54 | async function checkResolutionsInMasterPlaylist (options: { |
55 | server: ServerInfo | 55 | server: PeerTubeServer |
56 | playlistUrl: string | 56 | playlistUrl: string |
57 | resolutions: number[] | 57 | resolutions: number[] |
58 | }) { | 58 | }) { |
diff --git a/shared/extra-utils/videos/videos-command.ts b/shared/extra-utils/videos/videos-command.ts index 5556cddf6..feef5a771 100644 --- a/shared/extra-utils/videos/videos-command.ts +++ b/shared/extra-utils/videos/videos-command.ts | |||
@@ -22,7 +22,7 @@ import { | |||
22 | } from '@shared/models' | 22 | } from '@shared/models' |
23 | import { buildAbsoluteFixturePath, wait } from '../miscs' | 23 | import { buildAbsoluteFixturePath, wait } from '../miscs' |
24 | import { unwrapBody } from '../requests' | 24 | import { unwrapBody } from '../requests' |
25 | import { ServerInfo, waitJobs } from '../server' | 25 | import { PeerTubeServer, waitJobs } from '../server' |
26 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | 26 | import { AbstractCommand, OverrideCommandOptions } from '../shared' |
27 | 27 | ||
28 | export type VideoEdit = Partial<Omit<VideoCreate, 'thumbnailfile' | 'previewfile'>> & { | 28 | export type VideoEdit = Partial<Omit<VideoCreate, 'thumbnailfile' | 'previewfile'>> & { |
@@ -33,7 +33,7 @@ export type VideoEdit = Partial<Omit<VideoCreate, 'thumbnailfile' | 'previewfile | |||
33 | 33 | ||
34 | export class VideosCommand extends AbstractCommand { | 34 | export class VideosCommand extends AbstractCommand { |
35 | 35 | ||
36 | constructor (server: ServerInfo) { | 36 | constructor (server: PeerTubeServer) { |
37 | super(server) | 37 | super(server) |
38 | 38 | ||
39 | loadLanguages() | 39 | loadLanguages() |
diff --git a/shared/extra-utils/videos/videos.ts b/shared/extra-utils/videos/videos.ts index 86f49384d..b41533808 100644 --- a/shared/extra-utils/videos/videos.ts +++ b/shared/extra-utils/videos/videos.ts | |||
@@ -9,12 +9,12 @@ import { VIDEO_CATEGORIES, VIDEO_LANGUAGES, VIDEO_LICENCES, VIDEO_PRIVACIES } fr | |||
9 | import { dateIsValid, testImage, webtorrentAdd } from '../miscs' | 9 | import { dateIsValid, testImage, webtorrentAdd } from '../miscs' |
10 | import { makeRawRequest } from '../requests/requests' | 10 | import { makeRawRequest } from '../requests/requests' |
11 | import { waitJobs } from '../server' | 11 | import { waitJobs } from '../server' |
12 | import { ServerInfo } from '../server/servers' | 12 | import { PeerTubeServer } from '../server/server' |
13 | import { VideoEdit } from './videos-command' | 13 | import { VideoEdit } from './videos-command' |
14 | 14 | ||
15 | async function checkVideoFilesWereRemoved ( | 15 | async function checkVideoFilesWereRemoved ( |
16 | videoUUID: string, | 16 | videoUUID: string, |
17 | server: ServerInfo, | 17 | server: PeerTubeServer, |
18 | directories = [ | 18 | directories = [ |
19 | 'redundancy', | 19 | 'redundancy', |
20 | 'videos', | 20 | 'videos', |
@@ -40,7 +40,7 @@ async function checkVideoFilesWereRemoved ( | |||
40 | } | 40 | } |
41 | 41 | ||
42 | function checkUploadVideoParam ( | 42 | function checkUploadVideoParam ( |
43 | server: ServerInfo, | 43 | server: PeerTubeServer, |
44 | token: string, | 44 | token: string, |
45 | attributes: Partial<VideoEdit>, | 45 | attributes: Partial<VideoEdit>, |
46 | expectedStatus = HttpStatusCode.OK_200, | 46 | expectedStatus = HttpStatusCode.OK_200, |
@@ -52,7 +52,7 @@ function checkUploadVideoParam ( | |||
52 | } | 52 | } |
53 | 53 | ||
54 | async function completeVideoCheck ( | 54 | async function completeVideoCheck ( |
55 | server: ServerInfo, | 55 | server: PeerTubeServer, |
56 | video: any, | 56 | video: any, |
57 | attributes: { | 57 | attributes: { |
58 | name: string | 58 | name: string |
@@ -197,7 +197,7 @@ async function completeVideoCheck ( | |||
197 | 197 | ||
198 | // serverNumber starts from 1 | 198 | // serverNumber starts from 1 |
199 | async function uploadRandomVideoOnServers ( | 199 | async function uploadRandomVideoOnServers ( |
200 | servers: ServerInfo[], | 200 | servers: PeerTubeServer[], |
201 | serverNumber: number, | 201 | serverNumber: number, |
202 | additionalParams?: VideoEdit & { prefixName?: string } | 202 | additionalParams?: VideoEdit & { prefixName?: string } |
203 | ) { | 203 | ) { |