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-move-video-storage-job.ts | 9 | ||||
-rw-r--r-- | server/tests/cli/create-transcoding-job.ts | 6 | ||||
-rw-r--r-- | server/tests/cli/peertube.ts | 27 | ||||
-rw-r--r-- | server/tests/cli/plugins.ts | 2 | ||||
-rw-r--r-- | server/tests/cli/print-transcode-command.ts | 3 | ||||
-rw-r--r-- | server/tests/cli/prune-storage.ts | 57 | ||||
-rw-r--r-- | server/tests/cli/regenerate-thumbnails.ts | 2 | ||||
-rw-r--r-- | server/tests/cli/reset-password.ts | 2 | ||||
-rw-r--r-- | server/tests/cli/update-host.ts | 2 |
10 files changed, 57 insertions, 61 deletions
diff --git a/server/tests/cli/create-import-video-file-job.ts b/server/tests/cli/create-import-video-file-job.ts index c06b9550c..8ef0545d0 100644 --- a/server/tests/cli/create-import-video-file-job.ts +++ b/server/tests/cli/create-import-video-file-job.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 { areObjectStorageTestsDisabled } from '@shared/core-utils' | ||
6 | import { HttpStatusCode, VideoDetails, VideoFile, VideoInclude } from '@shared/models' | ||
5 | import { | 7 | import { |
6 | areObjectStorageTestsDisabled, | ||
7 | cleanupTests, | 8 | cleanupTests, |
8 | createMultipleServers, | 9 | createMultipleServers, |
9 | doubleFollow, | 10 | doubleFollow, |
10 | expectStartWith, | ||
11 | makeRawRequest, | 11 | makeRawRequest, |
12 | ObjectStorageCommand, | 12 | ObjectStorageCommand, |
13 | PeerTubeServer, | 13 | PeerTubeServer, |
14 | setAccessTokensToServers, | 14 | setAccessTokensToServers, |
15 | waitJobs | 15 | waitJobs |
16 | } from '@shared/extra-utils' | 16 | } from '@shared/server-commands' |
17 | import { HttpStatusCode, VideoDetails, VideoFile, VideoInclude } from '@shared/models' | 17 | import { expectStartWith } from '../shared' |
18 | 18 | ||
19 | const expect = chai.expect | 19 | const expect = chai.expect |
20 | 20 | ||
diff --git a/server/tests/cli/create-move-video-storage-job.ts b/server/tests/cli/create-move-video-storage-job.ts index b598c8359..c674d28d2 100644 --- a/server/tests/cli/create-move-video-storage-job.ts +++ b/server/tests/cli/create-move-video-storage-job.ts | |||
@@ -1,20 +1,19 @@ | |||
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 | 4 | import { areObjectStorageTestsDisabled } from '@shared/core-utils' | |
5 | import { HttpStatusCode, VideoDetails } from '@shared/models' | ||
5 | import { | 6 | import { |
6 | areObjectStorageTestsDisabled, | ||
7 | cleanupTests, | 7 | cleanupTests, |
8 | createMultipleServers, | 8 | createMultipleServers, |
9 | doubleFollow, | 9 | doubleFollow, |
10 | expectStartWith, | ||
11 | makeRawRequest, | 10 | makeRawRequest, |
12 | ObjectStorageCommand, | 11 | ObjectStorageCommand, |
13 | PeerTubeServer, | 12 | PeerTubeServer, |
14 | setAccessTokensToServers, | 13 | setAccessTokensToServers, |
15 | waitJobs | 14 | waitJobs |
16 | } from '@shared/extra-utils' | 15 | } from '@shared/server-commands' |
17 | import { HttpStatusCode, VideoDetails } from '@shared/models' | 16 | import { expectStartWith } from '../shared' |
18 | 17 | ||
19 | async function checkFiles (origin: PeerTubeServer, video: VideoDetails, inObjectStorage: boolean) { | 18 | async function checkFiles (origin: PeerTubeServer, video: VideoDetails, inObjectStorage: boolean) { |
20 | for (const file of video.files) { | 19 | for (const file of video.files) { |
diff --git a/server/tests/cli/create-transcoding-job.ts b/server/tests/cli/create-transcoding-job.ts index fb9c2584f..c85130fef 100644 --- a/server/tests/cli/create-transcoding-job.ts +++ b/server/tests/cli/create-transcoding-job.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 { areObjectStorageTestsDisabled } from '@shared/core-utils' | ||
5 | import { HttpStatusCode, VideoFile } from '@shared/models' | 6 | import { HttpStatusCode, VideoFile } from '@shared/models' |
6 | import { | 7 | import { |
7 | areObjectStorageTestsDisabled, | ||
8 | cleanupTests, | 8 | cleanupTests, |
9 | createMultipleServers, | 9 | createMultipleServers, |
10 | doubleFollow, | 10 | doubleFollow, |
11 | expectStartWith, | ||
12 | makeRawRequest, | 11 | makeRawRequest, |
13 | ObjectStorageCommand, | 12 | ObjectStorageCommand, |
14 | PeerTubeServer, | 13 | PeerTubeServer, |
15 | setAccessTokensToServers, | 14 | setAccessTokensToServers, |
16 | waitJobs | 15 | waitJobs |
17 | } from '../../../shared/extra-utils' | 16 | } from '@shared/server-commands' |
17 | import { expectStartWith } from '../shared' | ||
18 | 18 | ||
19 | const expect = chai.expect | 19 | const expect = chai.expect |
20 | 20 | ||
diff --git a/server/tests/cli/peertube.ts b/server/tests/cli/peertube.ts index f2a984962..034d216e3 100644 --- a/server/tests/cli/peertube.ts +++ b/server/tests/cli/peertube.ts | |||
@@ -2,19 +2,17 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import { expect } from 'chai' | 4 | import { expect } from 'chai' |
5 | import { areHttpImportTestsDisabled, buildAbsoluteFixturePath } from '@shared/core-utils' | ||
5 | import { | 6 | import { |
6 | areHttpImportTestsDisabled, | ||
7 | buildAbsoluteFixturePath, | ||
8 | cleanupTests, | 7 | cleanupTests, |
9 | CLICommand, | 8 | CLICommand, |
10 | createSingleServer, | 9 | createSingleServer, |
11 | doubleFollow, | 10 | doubleFollow, |
12 | FIXTURE_URLS, | ||
13 | PeerTubeServer, | 11 | PeerTubeServer, |
14 | setAccessTokensToServers, | 12 | setAccessTokensToServers, |
15 | testHelloWorldRegisteredSettings, | ||
16 | waitJobs | 13 | waitJobs |
17 | } from '../../../shared/extra-utils' | 14 | } from '@shared/server-commands' |
15 | import { FIXTURE_URLS, testHelloWorldRegisteredSettings } from '../shared' | ||
18 | 16 | ||
19 | describe('Test CLI wrapper', function () { | 17 | describe('Test CLI wrapper', function () { |
20 | let server: PeerTubeServer | 18 | let server: PeerTubeServer |
@@ -207,6 +205,25 @@ describe('Test CLI wrapper', function () { | |||
207 | 205 | ||
208 | expect(res).to.not.contain('peertube-plugin-hello-world') | 206 | expect(res).to.not.contain('peertube-plugin-hello-world') |
209 | }) | 207 | }) |
208 | |||
209 | it('Should install a plugin in requested version', async function () { | ||
210 | this.timeout(60000) | ||
211 | |||
212 | await cliCommand.execWithEnv(`${cmd} plugins install --npm-name peertube-plugin-hello-world --plugin-version 0.0.17`) | ||
213 | }) | ||
214 | |||
215 | it('Should list installed plugins, in correct version', async function () { | ||
216 | const res = await cliCommand.execWithEnv(`${cmd} plugins list`) | ||
217 | |||
218 | expect(res).to.contain('peertube-plugin-hello-world') | ||
219 | expect(res).to.contain('0.0.17') | ||
220 | }) | ||
221 | |||
222 | it('Should uninstall the plugin again', async function () { | ||
223 | const res = await cliCommand.execWithEnv(`${cmd} plugins uninstall --npm-name peertube-plugin-hello-world`) | ||
224 | |||
225 | expect(res).to.not.contain('peertube-plugin-hello-world') | ||
226 | }) | ||
210 | }) | 227 | }) |
211 | 228 | ||
212 | describe('Manage video redundancies', function () { | 229 | describe('Manage video redundancies', function () { |
diff --git a/server/tests/cli/plugins.ts b/server/tests/cli/plugins.ts index 07c78cc89..cd9f4e1c3 100644 --- a/server/tests/cli/plugins.ts +++ b/server/tests/cli/plugins.ts | |||
@@ -9,7 +9,7 @@ import { | |||
9 | PeerTubeServer, | 9 | PeerTubeServer, |
10 | PluginsCommand, | 10 | PluginsCommand, |
11 | setAccessTokensToServers | 11 | setAccessTokensToServers |
12 | } from '../../../shared/extra-utils' | 12 | } from '@shared/server-commands' |
13 | 13 | ||
14 | describe('Test plugin scripts', function () { | 14 | describe('Test plugin scripts', function () { |
15 | let server: PeerTubeServer | 15 | let server: PeerTubeServer |
diff --git a/server/tests/cli/print-transcode-command.ts b/server/tests/cli/print-transcode-command.ts index 0b8629251..27896f031 100644 --- a/server/tests/cli/print-transcode-command.ts +++ b/server/tests/cli/print-transcode-command.ts | |||
@@ -2,7 +2,8 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { buildAbsoluteFixturePath, CLICommand } from '@shared/extra-utils' | 5 | import { buildAbsoluteFixturePath } from '@shared/core-utils' |
6 | import { CLICommand } from '@shared/server-commands' | ||
6 | import { VideoResolution } from '../../../shared/models/videos' | 7 | import { VideoResolution } from '../../../shared/models/videos' |
7 | 8 | ||
8 | const expect = chai.expect | 9 | const expect = chai.expect |
diff --git a/server/tests/cli/prune-storage.ts b/server/tests/cli/prune-storage.ts index 2d4c02da7..a723ed8b4 100644 --- a/server/tests/cli/prune-storage.ts +++ b/server/tests/cli/prune-storage.ts | |||
@@ -4,7 +4,9 @@ import 'mocha' | |||
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { createFile, readdir } from 'fs-extra' | 5 | import { createFile, readdir } from 'fs-extra' |
6 | import { join } from 'path' | 6 | import { join } from 'path' |
7 | import { buildUUID } from '@server/helpers/uuid' | 7 | import { wait } from '@shared/core-utils' |
8 | import { buildUUID } from '@shared/extra-utils' | ||
9 | import { HttpStatusCode, VideoPlaylistPrivacy } from '@shared/models' | ||
8 | import { | 10 | import { |
9 | cleanupTests, | 11 | cleanupTests, |
10 | CLICommand, | 12 | CLICommand, |
@@ -15,10 +17,8 @@ import { | |||
15 | PeerTubeServer, | 17 | PeerTubeServer, |
16 | setAccessTokensToServers, | 18 | setAccessTokensToServers, |
17 | setDefaultVideoChannel, | 19 | setDefaultVideoChannel, |
18 | wait, | ||
19 | waitJobs | 20 | waitJobs |
20 | } from '@shared/extra-utils' | 21 | } from '@shared/server-commands' |
21 | import { HttpStatusCode, VideoPlaylistPrivacy } from '@shared/models' | ||
22 | 22 | ||
23 | const expect = chai.expect | 23 | const expect = chai.expect |
24 | 24 | ||
@@ -36,7 +36,7 @@ async function assertNotExists (server: PeerTubeServer, directory: string, subst | |||
36 | } | 36 | } |
37 | } | 37 | } |
38 | 38 | ||
39 | async function assertCountAreOkay (servers: PeerTubeServer[], videoServer2UUID: string) { | 39 | async function assertCountAreOkay (servers: PeerTubeServer[]) { |
40 | for (const server of servers) { | 40 | for (const server of servers) { |
41 | const videosCount = await countFiles(server, 'videos') | 41 | const videosCount = await countFiles(server, 'videos') |
42 | expect(videosCount).to.equal(8) | 42 | expect(videosCount).to.equal(8) |
@@ -52,22 +52,16 @@ async function assertCountAreOkay (servers: PeerTubeServer[], videoServer2UUID: | |||
52 | 52 | ||
53 | const avatarsCount = await countFiles(server, 'avatars') | 53 | const avatarsCount = await countFiles(server, 'avatars') |
54 | expect(avatarsCount).to.equal(2) | 54 | expect(avatarsCount).to.equal(2) |
55 | } | ||
56 | |||
57 | // When we'll prune HLS directories too | ||
58 | // const hlsRootCount = await countFiles(servers[1], 'streaming-playlists/hls/') | ||
59 | // expect(hlsRootCount).to.equal(2) | ||
60 | 55 | ||
61 | // const hlsCount = await countFiles(servers[1], 'streaming-playlists/hls/' + videoServer2UUID) | 56 | const hlsRootCount = await countFiles(server, 'streaming-playlists/hls') |
62 | // expect(hlsCount).to.equal(10) | 57 | expect(hlsRootCount).to.equal(2) |
58 | } | ||
63 | } | 59 | } |
64 | 60 | ||
65 | describe('Test prune storage scripts', function () { | 61 | describe('Test prune storage scripts', function () { |
66 | let servers: PeerTubeServer[] | 62 | let servers: PeerTubeServer[] |
67 | const badNames: { [directory: string]: string[] } = {} | 63 | const badNames: { [directory: string]: string[] } = {} |
68 | 64 | ||
69 | let videoServer2UUID: string | ||
70 | |||
71 | before(async function () { | 65 | before(async function () { |
72 | this.timeout(120000) | 66 | this.timeout(120000) |
73 | 67 | ||
@@ -77,9 +71,7 @@ describe('Test prune storage scripts', function () { | |||
77 | 71 | ||
78 | for (const server of servers) { | 72 | for (const server of servers) { |
79 | await server.videos.upload({ attributes: { name: 'video 1' } }) | 73 | await server.videos.upload({ attributes: { name: 'video 1' } }) |
80 | 74 | await server.videos.upload({ attributes: { name: 'video 2' } }) | |
81 | const { uuid } = await server.videos.upload({ attributes: { name: 'video 2' } }) | ||
82 | if (server.serverNumber === 2) videoServer2UUID = uuid | ||
83 | 75 | ||
84 | await server.users.updateMyAvatar({ fixture: 'avatar.png' }) | 76 | await server.users.updateMyAvatar({ fixture: 'avatar.png' }) |
85 | 77 | ||
@@ -123,7 +115,7 @@ describe('Test prune storage scripts', function () { | |||
123 | }) | 115 | }) |
124 | 116 | ||
125 | it('Should have the files on the disk', async function () { | 117 | it('Should have the files on the disk', async function () { |
126 | await assertCountAreOkay(servers, videoServer2UUID) | 118 | await assertCountAreOkay(servers) |
127 | }) | 119 | }) |
128 | 120 | ||
129 | it('Should create some dirty files', async function () { | 121 | it('Should create some dirty files', async function () { |
@@ -188,27 +180,14 @@ describe('Test prune storage scripts', function () { | |||
188 | badNames['avatars'] = [ n1, n2 ] | 180 | badNames['avatars'] = [ n1, n2 ] |
189 | } | 181 | } |
190 | 182 | ||
191 | // When we'll prune HLS directories too | 183 | { |
192 | // { | 184 | const directory = join('streaming-playlists', 'hls') |
193 | // const directory = join('streaming-playlists', 'hls') | 185 | const base = servers[0].servers.buildDirectory(directory) |
194 | // const base = servers[1].servers.buildDirectory(directory) | ||
195 | |||
196 | // const n1 = buildUUID() | ||
197 | // await createFile(join(base, n1)) | ||
198 | // badNames[directory] = [ n1 ] | ||
199 | // } | ||
200 | |||
201 | // { | ||
202 | // const directory = join('streaming-playlists', 'hls', videoServer2UUID) | ||
203 | // const base = servers[1].servers.buildDirectory(directory) | ||
204 | // const n1 = buildUUID() + '-240-fragmented-.mp4' | ||
205 | // const n2 = buildUUID() + '-master.m3u8' | ||
206 | |||
207 | // await createFile(join(base, n1)) | ||
208 | // await createFile(join(base, n2)) | ||
209 | 186 | ||
210 | // badNames[directory] = [ n1, n2 ] | 187 | const n1 = buildUUID() |
211 | // } | 188 | await createFile(join(base, n1)) |
189 | badNames[directory] = [ n1 ] | ||
190 | } | ||
212 | } | 191 | } |
213 | }) | 192 | }) |
214 | 193 | ||
@@ -220,7 +199,7 @@ describe('Test prune storage scripts', function () { | |||
220 | }) | 199 | }) |
221 | 200 | ||
222 | it('Should have removed files', async function () { | 201 | it('Should have removed files', async function () { |
223 | await assertCountAreOkay(servers, videoServer2UUID) | 202 | await assertCountAreOkay(servers) |
224 | 203 | ||
225 | for (const directory of Object.keys(badNames)) { | 204 | for (const directory of Object.keys(badNames)) { |
226 | for (const name of badNames[directory]) { | 205 | for (const name of badNames[directory]) { |
diff --git a/server/tests/cli/regenerate-thumbnails.ts b/server/tests/cli/regenerate-thumbnails.ts index 780c9b4bd..98d15272a 100644 --- a/server/tests/cli/regenerate-thumbnails.ts +++ b/server/tests/cli/regenerate-thumbnails.ts | |||
@@ -11,7 +11,7 @@ import { | |||
11 | PeerTubeServer, | 11 | PeerTubeServer, |
12 | setAccessTokensToServers, | 12 | setAccessTokensToServers, |
13 | waitJobs | 13 | waitJobs |
14 | } from '../../../shared/extra-utils' | 14 | } from '../../../shared/server-commands' |
15 | 15 | ||
16 | async function testThumbnail (server: PeerTubeServer, videoId: number | string) { | 16 | async function testThumbnail (server: PeerTubeServer, videoId: number | string) { |
17 | const video = await server.videos.get({ id: videoId }) | 17 | const video = await server.videos.get({ id: videoId }) |
diff --git a/server/tests/cli/reset-password.ts b/server/tests/cli/reset-password.ts index 4a02db35d..018e9d788 100644 --- a/server/tests/cli/reset-password.ts +++ b/server/tests/cli/reset-password.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import 'mocha' | 1 | import 'mocha' |
2 | import { cleanupTests, CLICommand, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '../../../shared/extra-utils' | 2 | import { cleanupTests, CLICommand, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands' |
3 | 3 | ||
4 | describe('Test reset password scripts', function () { | 4 | describe('Test reset password scripts', function () { |
5 | let server: PeerTubeServer | 5 | let server: PeerTubeServer |
diff --git a/server/tests/cli/update-host.ts b/server/tests/cli/update-host.ts index 43fbaec30..da89ff153 100644 --- a/server/tests/cli/update-host.ts +++ b/server/tests/cli/update-host.ts | |||
@@ -11,7 +11,7 @@ import { | |||
11 | PeerTubeServer, | 11 | PeerTubeServer, |
12 | setAccessTokensToServers, | 12 | setAccessTokensToServers, |
13 | waitJobs | 13 | waitJobs |
14 | } from '@shared/extra-utils' | 14 | } from '@shared/server-commands' |
15 | 15 | ||
16 | describe('Test update host scripts', function () { | 16 | describe('Test update host scripts', function () { |
17 | let server: PeerTubeServer | 17 | let server: PeerTubeServer |