diff options
Diffstat (limited to 'server/tests/cli')
-rw-r--r-- | server/tests/cli/create-import-video-file-job.ts | 8 | ||||
-rw-r--r-- | server/tests/cli/create-transcoding-job.ts | 9 | ||||
-rw-r--r-- | server/tests/cli/optimize-old-videos.ts | 11 | ||||
-rw-r--r-- | server/tests/cli/peertube.ts | 14 | ||||
-rw-r--r-- | server/tests/cli/reset-password.ts | 15 | ||||
-rw-r--r-- | server/tests/cli/update-host.ts | 35 |
6 files changed, 45 insertions, 47 deletions
diff --git a/server/tests/cli/create-import-video-file-job.ts b/server/tests/cli/create-import-video-file-job.ts index 4acda47b1..0d378c1aa 100644 --- a/server/tests/cli/create-import-video-file-job.ts +++ b/server/tests/cli/create-import-video-file-job.ts | |||
@@ -4,6 +4,7 @@ import 'mocha' | |||
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { VideoDetails, VideoFile } from '../../../shared/models/videos' | 5 | import { VideoDetails, VideoFile } from '../../../shared/models/videos' |
6 | import { | 6 | import { |
7 | cleanupTests, | ||
7 | doubleFollow, | 8 | doubleFollow, |
8 | execCLI, | 9 | execCLI, |
9 | flushAndRunMultipleServers, | 10 | flushAndRunMultipleServers, |
@@ -15,8 +16,8 @@ import { | |||
15 | ServerInfo, | 16 | ServerInfo, |
16 | setAccessTokensToServers, | 17 | setAccessTokensToServers, |
17 | uploadVideo | 18 | uploadVideo |
18 | } from '../../../shared/utils' | 19 | } from '../../../shared/extra-utils' |
19 | import { waitJobs } from '../../../shared/utils/server/jobs' | 20 | import { waitJobs } from '../../../shared/extra-utils/server/jobs' |
20 | 21 | ||
21 | const expect = chai.expect | 22 | const expect = chai.expect |
22 | 23 | ||
@@ -39,7 +40,6 @@ describe('Test create import video jobs', function () { | |||
39 | 40 | ||
40 | before(async function () { | 41 | before(async function () { |
41 | this.timeout(90000) | 42 | this.timeout(90000) |
42 | await flushTests() | ||
43 | 43 | ||
44 | // Run server 2 to have transcoding enabled | 44 | // Run server 2 to have transcoding enabled |
45 | servers = await flushAndRunMultipleServers(2) | 45 | servers = await flushAndRunMultipleServers(2) |
@@ -132,6 +132,6 @@ describe('Test create import video jobs', function () { | |||
132 | }) | 132 | }) |
133 | 133 | ||
134 | after(async function () { | 134 | after(async function () { |
135 | killallServers(servers) | 135 | await cleanupTests(servers) |
136 | }) | 136 | }) |
137 | }) | 137 | }) |
diff --git a/server/tests/cli/create-transcoding-job.ts b/server/tests/cli/create-transcoding-job.ts index 50be5fa19..1c0e10066 100644 --- a/server/tests/cli/create-transcoding-job.ts +++ b/server/tests/cli/create-transcoding-job.ts | |||
@@ -4,6 +4,7 @@ import 'mocha' | |||
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { VideoDetails } from '../../../shared/models/videos' | 5 | import { VideoDetails } from '../../../shared/models/videos' |
6 | import { | 6 | import { |
7 | cleanupTests, | ||
7 | doubleFollow, | 8 | doubleFollow, |
8 | execCLI, | 9 | execCLI, |
9 | flushAndRunMultipleServers, | 10 | flushAndRunMultipleServers, |
@@ -15,8 +16,8 @@ import { | |||
15 | ServerInfo, | 16 | ServerInfo, |
16 | setAccessTokensToServers, | 17 | setAccessTokensToServers, |
17 | uploadVideo, wait | 18 | uploadVideo, wait |
18 | } from '../../../shared/utils' | 19 | } from '../../../shared/extra-utils' |
19 | import { waitJobs } from '../../../shared/utils/server/jobs' | 20 | import { waitJobs } from '../../../shared/extra-utils/server/jobs' |
20 | 21 | ||
21 | const expect = chai.expect | 22 | const expect = chai.expect |
22 | 23 | ||
@@ -28,8 +29,6 @@ describe('Test create transcoding jobs', function () { | |||
28 | before(async function () { | 29 | before(async function () { |
29 | this.timeout(60000) | 30 | this.timeout(60000) |
30 | 31 | ||
31 | await flushTests() | ||
32 | |||
33 | // Run server 2 to have transcoding enabled | 32 | // Run server 2 to have transcoding enabled |
34 | servers = await flushAndRunMultipleServers(2) | 33 | servers = await flushAndRunMultipleServers(2) |
35 | await setAccessTokensToServers(servers) | 34 | await setAccessTokensToServers(servers) |
@@ -127,6 +126,6 @@ describe('Test create transcoding jobs', function () { | |||
127 | }) | 126 | }) |
128 | 127 | ||
129 | after(async function () { | 128 | after(async function () { |
130 | killallServers(servers) | 129 | await cleanupTests(servers) |
131 | }) | 130 | }) |
132 | }) | 131 | }) |
diff --git a/server/tests/cli/optimize-old-videos.ts b/server/tests/cli/optimize-old-videos.ts index 6f6bc25a6..5e12c0089 100644 --- a/server/tests/cli/optimize-old-videos.ts +++ b/server/tests/cli/optimize-old-videos.ts | |||
@@ -4,6 +4,7 @@ import 'mocha' | |||
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { getMaxBitrate, Video, VideoDetails, VideoResolution } from '../../../shared/models/videos' | 5 | import { getMaxBitrate, Video, VideoDetails, VideoResolution } from '../../../shared/models/videos' |
6 | import { | 6 | import { |
7 | cleanupTests, | ||
7 | doubleFollow, | 8 | doubleFollow, |
8 | execCLI, | 9 | execCLI, |
9 | flushAndRunMultipleServers, | 10 | flushAndRunMultipleServers, |
@@ -15,10 +16,10 @@ import { | |||
15 | ServerInfo, | 16 | ServerInfo, |
16 | setAccessTokensToServers, | 17 | setAccessTokensToServers, |
17 | uploadVideo, viewVideo, wait | 18 | uploadVideo, viewVideo, wait |
18 | } from '../../../shared/utils' | 19 | } from '../../../shared/extra-utils' |
19 | import { waitJobs } from '../../../shared/utils/server/jobs' | 20 | import { waitJobs } from '../../../shared/extra-utils/server/jobs' |
20 | import { getVideoFileBitrate, getVideoFileFPS, getVideoFileResolution } from '../../helpers/ffmpeg-utils' | 21 | import { getVideoFileBitrate, getVideoFileFPS, getVideoFileResolution } from '../../helpers/ffmpeg-utils' |
21 | import { VIDEO_TRANSCODING_FPS } from '../../initializers' | 22 | import { VIDEO_TRANSCODING_FPS } from '../../initializers/constants' |
22 | import { join } from 'path' | 23 | import { join } from 'path' |
23 | 24 | ||
24 | const expect = chai.expect | 25 | const expect = chai.expect |
@@ -31,8 +32,6 @@ describe('Test optimize old videos', function () { | |||
31 | before(async function () { | 32 | before(async function () { |
32 | this.timeout(200000) | 33 | this.timeout(200000) |
33 | 34 | ||
34 | await flushTests() | ||
35 | |||
36 | // Run server 2 to have transcoding enabled | 35 | // Run server 2 to have transcoding enabled |
37 | servers = await flushAndRunMultipleServers(2) | 36 | servers = await flushAndRunMultipleServers(2) |
38 | await setAccessTokensToServers(servers) | 37 | await setAccessTokensToServers(servers) |
@@ -115,6 +114,6 @@ describe('Test optimize old videos', function () { | |||
115 | }) | 114 | }) |
116 | 115 | ||
117 | after(async function () { | 116 | after(async function () { |
118 | killallServers(servers) | 117 | await cleanupTests(servers) |
119 | }) | 118 | }) |
120 | }) | 119 | }) |
diff --git a/server/tests/cli/peertube.ts b/server/tests/cli/peertube.ts index e2836d0c3..80bbc98d5 100644 --- a/server/tests/cli/peertube.ts +++ b/server/tests/cli/peertube.ts | |||
@@ -8,10 +8,10 @@ import { | |||
8 | flushTests, | 8 | flushTests, |
9 | getEnvCli, | 9 | getEnvCli, |
10 | killallServers, | 10 | killallServers, |
11 | runServer, | 11 | flushAndRunServer, |
12 | ServerInfo, | 12 | ServerInfo, |
13 | setAccessTokensToServers | 13 | setAccessTokensToServers, cleanupTests |
14 | } from '../../../shared/utils' | 14 | } from '../../../shared/extra-utils' |
15 | 15 | ||
16 | describe('Test CLI wrapper', function () { | 16 | describe('Test CLI wrapper', function () { |
17 | let server: ServerInfo | 17 | let server: ServerInfo |
@@ -19,12 +19,10 @@ describe('Test CLI wrapper', function () { | |||
19 | 19 | ||
20 | before(async function () { | 20 | before(async function () { |
21 | this.timeout(30000) | 21 | this.timeout(30000) |
22 | 22 | server = await flushAndRunServer(1) | |
23 | await flushTests() | ||
24 | server = await runServer(1) | ||
25 | await setAccessTokensToServers([ server ]) | 23 | await setAccessTokensToServers([ server ]) |
26 | 24 | ||
27 | await createUser(server.url, server.accessToken, 'user_1', 'super password') | 25 | await createUser({ url: server.url, accessToken: server.accessToken, username: 'user_1', password: 'super password' }) |
28 | }) | 26 | }) |
29 | 27 | ||
30 | it('Should display no selected instance', async function () { | 28 | it('Should display no selected instance', async function () { |
@@ -48,6 +46,6 @@ describe('Test CLI wrapper', function () { | |||
48 | 46 | ||
49 | await execCLI(cmd + ` auth del ${server.url}`) | 47 | await execCLI(cmd + ` auth del ${server.url}`) |
50 | 48 | ||
51 | killallServers([ server ]) | 49 | await cleanupTests([ server ]) |
52 | }) | 50 | }) |
53 | }) | 51 | }) |
diff --git a/server/tests/cli/reset-password.ts b/server/tests/cli/reset-password.ts index 1b65f7e39..6abb6738f 100644 --- a/server/tests/cli/reset-password.ts +++ b/server/tests/cli/reset-password.ts | |||
@@ -1,28 +1,25 @@ | |||
1 | import 'mocha' | 1 | import 'mocha' |
2 | 2 | ||
3 | import { | 3 | import { |
4 | cleanupTests, | ||
4 | createUser, | 5 | createUser, |
5 | execCLI, | 6 | execCLI, |
6 | flushTests, | 7 | flushAndRunServer, |
7 | getEnvCli, | 8 | getEnvCli, |
8 | killallServers, | ||
9 | login, | 9 | login, |
10 | runServer, | ||
11 | ServerInfo, | 10 | ServerInfo, |
12 | setAccessTokensToServers | 11 | setAccessTokensToServers |
13 | } from '../../../shared/utils' | 12 | } from '../../../shared/extra-utils' |
14 | 13 | ||
15 | describe('Test reset password scripts', function () { | 14 | describe('Test reset password scripts', function () { |
16 | let server: ServerInfo | 15 | let server: ServerInfo |
17 | 16 | ||
18 | before(async function () { | 17 | before(async function () { |
19 | this.timeout(30000) | 18 | this.timeout(30000) |
20 | 19 | server = await flushAndRunServer(1) | |
21 | await flushTests() | ||
22 | server = await runServer(1) | ||
23 | await setAccessTokensToServers([ server ]) | 20 | await setAccessTokensToServers([ server ]) |
24 | 21 | ||
25 | await createUser(server.url, server.accessToken, 'user_1', 'super password') | 22 | await createUser({ url: server.url, accessToken: server.accessToken, username: 'user_1', password: 'super password' }) |
26 | }) | 23 | }) |
27 | 24 | ||
28 | it('Should change the user password from CLI', async function () { | 25 | it('Should change the user password from CLI', async function () { |
@@ -35,6 +32,6 @@ describe('Test reset password scripts', function () { | |||
35 | }) | 32 | }) |
36 | 33 | ||
37 | after(async function () { | 34 | after(async function () { |
38 | killallServers([ server ]) | 35 | await cleanupTests([ server ]) |
39 | }) | 36 | }) |
40 | }) | 37 | }) |
diff --git a/server/tests/cli/update-host.ts b/server/tests/cli/update-host.ts index 811ea6a9f..55c43b32f 100644 --- a/server/tests/cli/update-host.ts +++ b/server/tests/cli/update-host.ts | |||
@@ -3,26 +3,26 @@ | |||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { VideoDetails } from '../../../shared/models/videos' | 5 | import { VideoDetails } from '../../../shared/models/videos' |
6 | import { waitJobs } from '../../../shared/utils/server/jobs' | 6 | import { waitJobs } from '../../../shared/extra-utils/server/jobs' |
7 | import { addVideoCommentThread } from '../../../shared/utils/videos/video-comments' | 7 | import { addVideoCommentThread } from '../../../shared/extra-utils/videos/video-comments' |
8 | import { | 8 | import { |
9 | addVideoChannel, | 9 | addVideoChannel, |
10 | cleanupTests, | ||
10 | createUser, | 11 | createUser, |
11 | execCLI, | 12 | execCLI, |
12 | flushTests, | 13 | flushAndRunServer, |
13 | getEnvCli, | 14 | getEnvCli, |
14 | getVideo, | 15 | getVideo, |
15 | getVideoChannelsList, | 16 | getVideoChannelsList, |
16 | getVideosList, | 17 | getVideosList, |
17 | killallServers, | 18 | killallServers, |
18 | makeActivityPubGetRequest, | 19 | makeActivityPubGetRequest, |
19 | parseTorrentVideo, | 20 | parseTorrentVideo, reRunServer, |
20 | runServer, | ||
21 | ServerInfo, | 21 | ServerInfo, |
22 | setAccessTokensToServers, | 22 | setAccessTokensToServers, |
23 | uploadVideo | 23 | uploadVideo |
24 | } from '../../../shared/utils' | 24 | } from '../../../shared/extra-utils' |
25 | import { getAccountsList } from '../../../shared/utils/users/accounts' | 25 | import { getAccountsList } from '../../../shared/extra-utils/users/accounts' |
26 | 26 | ||
27 | const expect = chai.expect | 27 | const expect = chai.expect |
28 | 28 | ||
@@ -32,15 +32,13 @@ describe('Test update host scripts', function () { | |||
32 | before(async function () { | 32 | before(async function () { |
33 | this.timeout(60000) | 33 | this.timeout(60000) |
34 | 34 | ||
35 | await flushTests() | ||
36 | |||
37 | const overrideConfig = { | 35 | const overrideConfig = { |
38 | webserver: { | 36 | webserver: { |
39 | port: 9256 | 37 | port: 9256 |
40 | } | 38 | } |
41 | } | 39 | } |
42 | // Run server 2 to have transcoding enabled | 40 | // Run server 2 to have transcoding enabled |
43 | server = await runServer(2, overrideConfig) | 41 | server = await flushAndRunServer(2, overrideConfig) |
44 | await setAccessTokensToServers([ server ]) | 42 | await setAccessTokensToServers([ server ]) |
45 | 43 | ||
46 | // Upload two videos for our needs | 44 | // Upload two videos for our needs |
@@ -50,7 +48,7 @@ describe('Test update host scripts', function () { | |||
50 | await uploadVideo(server.url, server.accessToken, videoAttributes) | 48 | await uploadVideo(server.url, server.accessToken, videoAttributes) |
51 | 49 | ||
52 | // Create a user | 50 | // Create a user |
53 | await createUser(server.url, server.accessToken, 'toto', 'coucou') | 51 | await createUser({ url: server.url, accessToken: server.accessToken, username: 'toto', password: 'coucou' }) |
54 | 52 | ||
55 | // Create channel | 53 | // Create channel |
56 | const videoChannel = { | 54 | const videoChannel = { |
@@ -72,7 +70,7 @@ describe('Test update host scripts', function () { | |||
72 | 70 | ||
73 | killallServers([ server ]) | 71 | killallServers([ server ]) |
74 | // Run server with standard configuration | 72 | // Run server with standard configuration |
75 | server = await runServer(2) | 73 | await reRunServer(server) |
76 | 74 | ||
77 | const env = getEnvCli(server) | 75 | const env = getEnvCli(server) |
78 | await execCLI(`${env} npm run update-host`) | 76 | await execCLI(`${env} npm run update-host`) |
@@ -86,6 +84,13 @@ describe('Test update host scripts', function () { | |||
86 | const { body } = await makeActivityPubGetRequest(server.url, '/videos/watch/' + video.uuid) | 84 | const { body } = await makeActivityPubGetRequest(server.url, '/videos/watch/' + video.uuid) |
87 | 85 | ||
88 | expect(body.id).to.equal('http://localhost:9002/videos/watch/' + video.uuid) | 86 | expect(body.id).to.equal('http://localhost:9002/videos/watch/' + video.uuid) |
87 | |||
88 | const res = await getVideo(server.url, video.uuid) | ||
89 | const videoDetails: VideoDetails = res.body | ||
90 | |||
91 | expect(videoDetails.trackerUrls[0]).to.include(server.host) | ||
92 | expect(videoDetails.streamingPlaylists[0].playlistUrl).to.include(server.host) | ||
93 | expect(videoDetails.streamingPlaylists[0].segmentsSha256Url).to.include(server.host) | ||
89 | } | 94 | } |
90 | }) | 95 | }) |
91 | 96 | ||
@@ -100,7 +105,7 @@ describe('Test update host scripts', function () { | |||
100 | } | 105 | } |
101 | }) | 106 | }) |
102 | 107 | ||
103 | it('Should have update accounts url', async function () { | 108 | it('Should have updated accounts url', async function () { |
104 | const res = await getAccountsList(server.url) | 109 | const res = await getAccountsList(server.url) |
105 | expect(res.body.total).to.equal(3) | 110 | expect(res.body.total).to.equal(3) |
106 | 111 | ||
@@ -112,7 +117,7 @@ describe('Test update host scripts', function () { | |||
112 | } | 117 | } |
113 | }) | 118 | }) |
114 | 119 | ||
115 | it('Should update torrent hosts', async function () { | 120 | it('Should have updated torrent hosts', async function () { |
116 | this.timeout(30000) | 121 | this.timeout(30000) |
117 | 122 | ||
118 | const res = await getVideosList(server.url) | 123 | const res = await getVideosList(server.url) |
@@ -142,6 +147,6 @@ describe('Test update host scripts', function () { | |||
142 | }) | 147 | }) |
143 | 148 | ||
144 | after(async function () { | 149 | after(async function () { |
145 | killallServers([ server ]) | 150 | await cleanupTests([ server ]) |
146 | }) | 151 | }) |
147 | }) | 152 | }) |