diff options
Diffstat (limited to 'server/tests/cli')
-rw-r--r-- | server/tests/cli/create-import-video-file-job.ts | 6 | ||||
-rw-r--r-- | server/tests/cli/create-transcoding-job.ts | 8 | ||||
-rw-r--r-- | server/tests/cli/optimize-old-videos.ts | 8 | ||||
-rw-r--r-- | server/tests/cli/peertube.ts | 14 | ||||
-rw-r--r-- | server/tests/cli/plugins.ts | 13 | ||||
-rw-r--r-- | server/tests/cli/prune-storage.ts | 14 | ||||
-rw-r--r-- | server/tests/cli/regenerate-thumbnails.ts | 10 | ||||
-rw-r--r-- | server/tests/cli/reset-password.ts | 6 | ||||
-rw-r--r-- | server/tests/cli/update-host.ts | 11 |
9 files changed, 44 insertions, 46 deletions
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 | }) |