diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-09 15:37:43 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-20 15:27:18 +0200 |
commit | 9293139fde7091e9badcafa9b570b83cea9a10ad (patch) | |
tree | 9728412f02af4aa59d2c016db47624251e8f6be6 /server/tests | |
parent | 078f17e6d90376050f43ce639e88e11869b49ee7 (diff) | |
download | PeerTube-9293139fde7091e9badcafa9b570b83cea9a10ad.tar.gz PeerTube-9293139fde7091e9badcafa9b570b83cea9a10ad.tar.zst PeerTube-9293139fde7091e9badcafa9b570b83cea9a10ad.zip |
Introduce sql command
Diffstat (limited to 'server/tests')
27 files changed, 75 insertions, 118 deletions
diff --git a/server/tests/api/activitypub/cleaner.ts b/server/tests/api/activitypub/cleaner.ts index 27f17b4d6..5b08880bf 100644 --- a/server/tests/api/activitypub/cleaner.ts +++ b/server/tests/api/activitypub/cleaner.ts | |||
@@ -4,18 +4,12 @@ import 'mocha' | |||
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { | 5 | import { |
6 | cleanupTests, | 6 | cleanupTests, |
7 | closeAllSequelize, | ||
8 | deleteAll, | ||
9 | doubleFollow, | 7 | doubleFollow, |
10 | flushAndRunMultipleServers, | 8 | flushAndRunMultipleServers, |
11 | getCount, | ||
12 | getVideo, | 9 | getVideo, |
13 | rateVideo, | 10 | rateVideo, |
14 | selectQuery, | ||
15 | ServerInfo, | 11 | ServerInfo, |
16 | setAccessTokensToServers, | 12 | setAccessTokensToServers, |
17 | setVideoField, | ||
18 | updateQuery, | ||
19 | uploadVideoAndGetId, | 13 | uploadVideoAndGetId, |
20 | wait, | 14 | wait, |
21 | waitJobs | 15 | waitJobs |
@@ -86,9 +80,9 @@ describe('Test AP cleaner', function () { | |||
86 | it('Should destroy server 3 internal likes and correctly clean them', async function () { | 80 | it('Should destroy server 3 internal likes and correctly clean them', async function () { |
87 | this.timeout(20000) | 81 | this.timeout(20000) |
88 | 82 | ||
89 | await deleteAll(servers[2].internalServerNumber, 'accountVideoRate') | 83 | await servers[2].sqlCommand.deleteAll('accountVideoRate') |
90 | for (const uuid of videoUUIDs) { | 84 | for (const uuid of videoUUIDs) { |
91 | await setVideoField(servers[2].internalServerNumber, uuid, 'likes', '0') | 85 | await servers[2].sqlCommand.setVideoField(uuid, 'likes', '0') |
92 | } | 86 | } |
93 | 87 | ||
94 | await wait(5000) | 88 | await wait(5000) |
@@ -132,10 +126,10 @@ describe('Test AP cleaner', function () { | |||
132 | it('Should destroy server 3 internal dislikes and correctly clean them', async function () { | 126 | it('Should destroy server 3 internal dislikes and correctly clean them', async function () { |
133 | this.timeout(20000) | 127 | this.timeout(20000) |
134 | 128 | ||
135 | await deleteAll(servers[2].internalServerNumber, 'accountVideoRate') | 129 | await servers[2].sqlCommand.deleteAll('accountVideoRate') |
136 | 130 | ||
137 | for (const uuid of videoUUIDs) { | 131 | for (const uuid of videoUUIDs) { |
138 | await setVideoField(servers[2].internalServerNumber, uuid, 'dislikes', '0') | 132 | await servers[2].sqlCommand.setVideoField(uuid, 'dislikes', '0') |
139 | } | 133 | } |
140 | 134 | ||
141 | await wait(5000) | 135 | await wait(5000) |
@@ -159,15 +153,15 @@ describe('Test AP cleaner', function () { | |||
159 | it('Should destroy server 3 internal shares and correctly clean them', async function () { | 153 | it('Should destroy server 3 internal shares and correctly clean them', async function () { |
160 | this.timeout(20000) | 154 | this.timeout(20000) |
161 | 155 | ||
162 | const preCount = await getCount(servers[0].internalServerNumber, 'videoShare') | 156 | const preCount = await servers[0].sqlCommand.getCount('videoShare') |
163 | expect(preCount).to.equal(6) | 157 | expect(preCount).to.equal(6) |
164 | 158 | ||
165 | await deleteAll(servers[2].internalServerNumber, 'videoShare') | 159 | await servers[2].sqlCommand.deleteAll('videoShare') |
166 | await wait(5000) | 160 | await wait(5000) |
167 | await waitJobs(servers) | 161 | await waitJobs(servers) |
168 | 162 | ||
169 | // Still 6 because we don't have remote shares on local videos | 163 | // Still 6 because we don't have remote shares on local videos |
170 | const postCount = await getCount(servers[0].internalServerNumber, 'videoShare') | 164 | const postCount = await servers[0].sqlCommand.getCount('videoShare') |
171 | expect(postCount).to.equal(6) | 165 | expect(postCount).to.equal(6) |
172 | }) | 166 | }) |
173 | 167 | ||
@@ -179,7 +173,7 @@ describe('Test AP cleaner', function () { | |||
179 | expect(total).to.equal(3) | 173 | expect(total).to.equal(3) |
180 | } | 174 | } |
181 | 175 | ||
182 | await deleteAll(servers[2].internalServerNumber, 'videoComment') | 176 | await servers[2].sqlCommand.deleteAll('videoComment') |
183 | 177 | ||
184 | await wait(5000) | 178 | await wait(5000) |
185 | await waitJobs(servers) | 179 | await waitJobs(servers) |
@@ -196,7 +190,7 @@ describe('Test AP cleaner', function () { | |||
196 | async function check (like: string, ofServerUrl: string, urlSuffix: string, remote: 'true' | 'false') { | 190 | async function check (like: string, ofServerUrl: string, urlSuffix: string, remote: 'true' | 'false') { |
197 | const query = `SELECT "videoId", "accountVideoRate".url FROM "accountVideoRate" ` + | 191 | const query = `SELECT "videoId", "accountVideoRate".url FROM "accountVideoRate" ` + |
198 | `INNER JOIN video ON "accountVideoRate"."videoId" = video.id AND remote IS ${remote} WHERE "accountVideoRate"."url" LIKE '${like}'` | 192 | `INNER JOIN video ON "accountVideoRate"."videoId" = video.id AND remote IS ${remote} WHERE "accountVideoRate"."url" LIKE '${like}'` |
199 | const res = await selectQuery(servers[0].internalServerNumber, query) | 193 | const res = await servers[0].sqlCommand.selectQuery(query) |
200 | 194 | ||
201 | for (const rate of res) { | 195 | for (const rate of res) { |
202 | const matcher = new RegExp(`^${ofServerUrl}/accounts/root/dislikes/\\d+${urlSuffix}$`) | 196 | const matcher = new RegExp(`^${ofServerUrl}/accounts/root/dislikes/\\d+${urlSuffix}$`) |
@@ -225,7 +219,7 @@ describe('Test AP cleaner', function () { | |||
225 | 219 | ||
226 | { | 220 | { |
227 | const query = `UPDATE "accountVideoRate" SET url = url || 'stan'` | 221 | const query = `UPDATE "accountVideoRate" SET url = url || 'stan'` |
228 | await updateQuery(servers[1].internalServerNumber, query) | 222 | await servers[1].sqlCommand.updateQuery(query) |
229 | 223 | ||
230 | await wait(5000) | 224 | await wait(5000) |
231 | await waitJobs(servers) | 225 | await waitJobs(servers) |
@@ -242,7 +236,7 @@ describe('Test AP cleaner', function () { | |||
242 | const query = `SELECT "videoId", "videoComment".url, uuid as "videoUUID" FROM "videoComment" ` + | 236 | const query = `SELECT "videoId", "videoComment".url, uuid as "videoUUID" FROM "videoComment" ` + |
243 | `INNER JOIN video ON "videoComment"."videoId" = video.id AND remote IS ${remote} WHERE "videoComment"."url" LIKE '${like}'` | 237 | `INNER JOIN video ON "videoComment"."videoId" = video.id AND remote IS ${remote} WHERE "videoComment"."url" LIKE '${like}'` |
244 | 238 | ||
245 | const res = await selectQuery(servers[0].internalServerNumber, query) | 239 | const res = await servers[0].sqlCommand.selectQuery(query) |
246 | 240 | ||
247 | for (const comment of res) { | 241 | for (const comment of res) { |
248 | const matcher = new RegExp(`${ofServerUrl}/videos/watch/${comment.videoUUID}/comments/\\d+${urlSuffix}`) | 242 | const matcher = new RegExp(`${ofServerUrl}/videos/watch/${comment.videoUUID}/comments/\\d+${urlSuffix}`) |
@@ -268,7 +262,7 @@ describe('Test AP cleaner', function () { | |||
268 | 262 | ||
269 | { | 263 | { |
270 | const query = `UPDATE "videoComment" SET url = url || 'kyle'` | 264 | const query = `UPDATE "videoComment" SET url = url || 'kyle'` |
271 | await updateQuery(servers[1].internalServerNumber, query) | 265 | await servers[1].sqlCommand.updateQuery(query) |
272 | 266 | ||
273 | await wait(5000) | 267 | await wait(5000) |
274 | await waitJobs(servers) | 268 | await waitJobs(servers) |
@@ -280,7 +274,5 @@ describe('Test AP cleaner', function () { | |||
280 | 274 | ||
281 | after(async function () { | 275 | after(async function () { |
282 | await cleanupTests(servers) | 276 | await cleanupTests(servers) |
283 | |||
284 | await closeAllSequelize(servers) | ||
285 | }) | 277 | }) |
286 | }) | 278 | }) |
diff --git a/server/tests/api/activitypub/fetch.ts b/server/tests/api/activitypub/fetch.ts index 35fd94eed..d5e21404c 100644 --- a/server/tests/api/activitypub/fetch.ts +++ b/server/tests/api/activitypub/fetch.ts | |||
@@ -1,23 +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 * as chai from 'chai' | |
5 | import { | 5 | import { |
6 | cleanupTests, | 6 | cleanupTests, |
7 | closeAllSequelize, | ||
8 | createUser, | 7 | createUser, |
9 | doubleFollow, | 8 | doubleFollow, |
10 | flushAndRunMultipleServers, | 9 | flushAndRunMultipleServers, |
11 | getVideosListSort, | 10 | getVideosListSort, |
12 | ServerInfo, | 11 | ServerInfo, |
13 | setAccessTokensToServers, | 12 | setAccessTokensToServers, |
14 | setActorField, | ||
15 | setVideoField, | ||
16 | uploadVideo, | 13 | uploadVideo, |
17 | userLogin, | 14 | userLogin, |
18 | waitJobs | 15 | waitJobs |
19 | } from '../../../../shared/extra-utils' | 16 | } from '../../../../shared/extra-utils' |
20 | import * as chai from 'chai' | ||
21 | import { Video } from '../../../../shared/models/videos' | 17 | import { Video } from '../../../../shared/models/videos' |
22 | 18 | ||
23 | const expect = chai.expect | 19 | const expect = chai.expect |
@@ -50,12 +46,12 @@ describe('Test ActivityPub fetcher', function () { | |||
50 | { | 46 | { |
51 | const to = 'http://localhost:' + servers[0].port + '/accounts/user1' | 47 | const to = 'http://localhost:' + servers[0].port + '/accounts/user1' |
52 | const value = 'http://localhost:' + servers[1].port + '/accounts/user1' | 48 | const value = 'http://localhost:' + servers[1].port + '/accounts/user1' |
53 | await setActorField(servers[0].internalServerNumber, to, 'url', value) | 49 | await servers[0].sqlCommand.setActorField(to, 'url', value) |
54 | } | 50 | } |
55 | 51 | ||
56 | { | 52 | { |
57 | const value = 'http://localhost:' + servers[2].port + '/videos/watch/' + badVideoUUID | 53 | const value = 'http://localhost:' + servers[2].port + '/videos/watch/' + badVideoUUID |
58 | await setVideoField(servers[0].internalServerNumber, badVideoUUID, 'url', value) | 54 | await servers[0].sqlCommand.setVideoField(badVideoUUID, 'url', value) |
59 | } | 55 | } |
60 | }) | 56 | }) |
61 | 57 | ||
@@ -88,7 +84,5 @@ describe('Test ActivityPub fetcher', function () { | |||
88 | this.timeout(20000) | 84 | this.timeout(20000) |
89 | 85 | ||
90 | await cleanupTests(servers) | 86 | await cleanupTests(servers) |
91 | |||
92 | await closeAllSequelize(servers) | ||
93 | }) | 87 | }) |
94 | }) | 88 | }) |
diff --git a/server/tests/api/activitypub/refresher.ts b/server/tests/api/activitypub/refresher.ts index f295dfab7..af919f2f3 100644 --- a/server/tests/api/activitypub/refresher.ts +++ b/server/tests/api/activitypub/refresher.ts | |||
@@ -4,7 +4,6 @@ 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 | closeAllSequelize, | ||
8 | doubleFollow, | 7 | doubleFollow, |
9 | flushAndRunMultipleServers, | 8 | flushAndRunMultipleServers, |
10 | generateUserAccessToken, | 9 | generateUserAccessToken, |
@@ -13,10 +12,7 @@ import { | |||
13 | reRunServer, | 12 | reRunServer, |
14 | ServerInfo, | 13 | ServerInfo, |
15 | setAccessTokensToServers, | 14 | setAccessTokensToServers, |
16 | setActorField, | ||
17 | setDefaultVideoChannel, | 15 | setDefaultVideoChannel, |
18 | setPlaylistField, | ||
19 | setVideoField, | ||
20 | uploadVideo, | 16 | uploadVideo, |
21 | uploadVideoAndGetId, | 17 | uploadVideoAndGetId, |
22 | wait, | 18 | wait, |
@@ -78,7 +74,7 @@ describe('Test AP refresher', function () { | |||
78 | await wait(10000) | 74 | await wait(10000) |
79 | 75 | ||
80 | // Change UUID so the remote server returns a 404 | 76 | // Change UUID so the remote server returns a 404 |
81 | await setVideoField(servers[1].internalServerNumber, videoUUID1, 'uuid', '304afe4f-39f9-4d49-8ed7-ac57b86b174f') | 77 | await servers[1].sqlCommand.setVideoField(videoUUID1, 'uuid', '304afe4f-39f9-4d49-8ed7-ac57b86b174f') |
82 | 78 | ||
83 | await getVideo(servers[0].url, videoUUID1) | 79 | await getVideo(servers[0].url, videoUUID1) |
84 | await getVideo(servers[0].url, videoUUID2) | 80 | await getVideo(servers[0].url, videoUUID2) |
@@ -92,9 +88,9 @@ describe('Test AP refresher', function () { | |||
92 | it('Should not update a remote video if the remote instance is down', async function () { | 88 | it('Should not update a remote video if the remote instance is down', async function () { |
93 | this.timeout(70000) | 89 | this.timeout(70000) |
94 | 90 | ||
95 | killallServers([ servers[1] ]) | 91 | await killallServers([ servers[1] ]) |
96 | 92 | ||
97 | await setVideoField(servers[1].internalServerNumber, videoUUID3, 'uuid', '304afe4f-39f9-4d49-8ed7-ac57b86b174e') | 93 | await servers[1].sqlCommand.setVideoField(videoUUID3, 'uuid', '304afe4f-39f9-4d49-8ed7-ac57b86b174e') |
98 | 94 | ||
99 | // Video will need a refresh | 95 | // Video will need a refresh |
100 | await wait(10000) | 96 | await wait(10000) |
@@ -120,7 +116,7 @@ describe('Test AP refresher', function () { | |||
120 | 116 | ||
121 | // Change actor name so the remote server returns a 404 | 117 | // Change actor name so the remote server returns a 404 |
122 | const to = 'http://localhost:' + servers[1].port + '/accounts/user2' | 118 | const to = 'http://localhost:' + servers[1].port + '/accounts/user2' |
123 | await setActorField(servers[1].internalServerNumber, to, 'preferredUsername', 'toto') | 119 | await servers[1].sqlCommand.setActorField(to, 'preferredUsername', 'toto') |
124 | 120 | ||
125 | await command.get({ accountName: 'user1@localhost:' + servers[1].port }) | 121 | await command.get({ accountName: 'user1@localhost:' + servers[1].port }) |
126 | await command.get({ accountName: 'user2@localhost:' + servers[1].port }) | 122 | await command.get({ accountName: 'user2@localhost:' + servers[1].port }) |
@@ -140,7 +136,7 @@ describe('Test AP refresher', function () { | |||
140 | await wait(10000) | 136 | await wait(10000) |
141 | 137 | ||
142 | // Change UUID so the remote server returns a 404 | 138 | // Change UUID so the remote server returns a 404 |
143 | await setPlaylistField(servers[1].internalServerNumber, playlistUUID2, 'uuid', '304afe4f-39f9-4d49-8ed7-ac57b86b178e') | 139 | await servers[1].sqlCommand.setPlaylistField(playlistUUID2, 'uuid', '304afe4f-39f9-4d49-8ed7-ac57b86b178e') |
144 | 140 | ||
145 | await servers[0].playlistsCommand.get({ playlistId: playlistUUID1 }) | 141 | await servers[0].playlistsCommand.get({ playlistId: playlistUUID1 }) |
146 | await servers[0].playlistsCommand.get({ playlistId: playlistUUID2 }) | 142 | await servers[0].playlistsCommand.get({ playlistId: playlistUUID2 }) |
@@ -156,7 +152,5 @@ describe('Test AP refresher', function () { | |||
156 | this.timeout(10000) | 152 | this.timeout(10000) |
157 | 153 | ||
158 | await cleanupTests(servers) | 154 | await cleanupTests(servers) |
159 | |||
160 | await closeAllSequelize(servers) | ||
161 | }) | 155 | }) |
162 | }) | 156 | }) |
diff --git a/server/tests/api/activitypub/security.ts b/server/tests/api/activitypub/security.ts index 61db272f6..c32940070 100644 --- a/server/tests/api/activitypub/security.ts +++ b/server/tests/api/activitypub/security.ts | |||
@@ -7,12 +7,10 @@ import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-c | |||
7 | import { | 7 | import { |
8 | buildAbsoluteFixturePath, | 8 | buildAbsoluteFixturePath, |
9 | cleanupTests, | 9 | cleanupTests, |
10 | closeAllSequelize, | ||
11 | flushAndRunMultipleServers, | 10 | flushAndRunMultipleServers, |
12 | killallServers, | 11 | killallServers, |
13 | reRunServer, | 12 | reRunServer, |
14 | ServerInfo, | 13 | ServerInfo, |
15 | setActorField, | ||
16 | wait | 14 | wait |
17 | } from '../../../../shared/extra-utils' | 15 | } from '../../../../shared/extra-utils' |
18 | import { makeFollowRequest, makePOSTAPRequest } from '../../../../shared/extra-utils/requests/activitypub' | 16 | import { makeFollowRequest, makePOSTAPRequest } from '../../../../shared/extra-utils/requests/activitypub' |
@@ -26,8 +24,8 @@ function setKeysOfServer (onServer: ServerInfo, ofServer: ServerInfo, publicKey: | |||
26 | const url = 'http://localhost:' + ofServer.port + '/accounts/peertube' | 24 | const url = 'http://localhost:' + ofServer.port + '/accounts/peertube' |
27 | 25 | ||
28 | return Promise.all([ | 26 | return Promise.all([ |
29 | setActorField(onServer.internalServerNumber, url, 'publicKey', publicKey), | 27 | onServer.sqlCommand.setActorField(url, 'publicKey', publicKey), |
30 | setActorField(onServer.internalServerNumber, url, 'privateKey', privateKey) | 28 | onServer.sqlCommand.setActorField(url, 'privateKey', privateKey) |
31 | ]) | 29 | ]) |
32 | } | 30 | } |
33 | 31 | ||
@@ -35,8 +33,8 @@ function setUpdatedAtOfServer (onServer: ServerInfo, ofServer: ServerInfo, updat | |||
35 | const url = 'http://localhost:' + ofServer.port + '/accounts/peertube' | 33 | const url = 'http://localhost:' + ofServer.port + '/accounts/peertube' |
36 | 34 | ||
37 | return Promise.all([ | 35 | return Promise.all([ |
38 | setActorField(onServer.internalServerNumber, url, 'createdAt', updatedAt), | 36 | onServer.sqlCommand.setActorField(url, 'createdAt', updatedAt), |
39 | setActorField(onServer.internalServerNumber, url, 'updatedAt', updatedAt) | 37 | onServer.sqlCommand.setActorField(url, 'updatedAt', updatedAt) |
40 | ]) | 38 | ]) |
41 | } | 39 | } |
42 | 40 | ||
@@ -173,7 +171,7 @@ describe('Test ActivityPub security', function () { | |||
173 | await setUpdatedAtOfServer(servers[0], servers[1], '2015-07-17 22:00:00+00') | 171 | await setUpdatedAtOfServer(servers[0], servers[1], '2015-07-17 22:00:00+00') |
174 | 172 | ||
175 | // Invalid peertube actor cache | 173 | // Invalid peertube actor cache |
176 | killallServers([ servers[1] ]) | 174 | await killallServers([ servers[1] ]) |
177 | await reRunServer(servers[1]) | 175 | await reRunServer(servers[1]) |
178 | 176 | ||
179 | const body = activityPubContextify(getAnnounceWithoutContext(servers[1])) | 177 | const body = activityPubContextify(getAnnounceWithoutContext(servers[1])) |
@@ -294,7 +292,5 @@ describe('Test ActivityPub security', function () { | |||
294 | this.timeout(10000) | 292 | this.timeout(10000) |
295 | 293 | ||
296 | await cleanupTests(servers) | 294 | await cleanupTests(servers) |
297 | |||
298 | await closeAllSequelize(servers) | ||
299 | }) | 295 | }) |
300 | }) | 296 | }) |
diff --git a/server/tests/api/check-params/contact-form.ts b/server/tests/api/check-params/contact-form.ts index fb30766d9..5539266b8 100644 --- a/server/tests/api/check-params/contact-form.ts +++ b/server/tests/api/check-params/contact-form.ts | |||
@@ -36,7 +36,7 @@ describe('Test contact form API validators', function () { | |||
36 | it('Should not accept a contact form if it is disabled in the configuration', async function () { | 36 | it('Should not accept a contact form if it is disabled in the configuration', async function () { |
37 | this.timeout(10000) | 37 | this.timeout(10000) |
38 | 38 | ||
39 | 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 reRunServer(server, { smtp: { hostname: 'localhost', port: emailPort }, contact_form: { enabled: false } }) |
@@ -46,7 +46,7 @@ describe('Test contact form API validators', function () { | |||
46 | it('Should not accept a contact form if from email is invalid', async function () { | 46 | it('Should not accept a contact form if from email is invalid', async function () { |
47 | this.timeout(10000) | 47 | this.timeout(10000) |
48 | 48 | ||
49 | 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 reRunServer(server, { smtp: { hostname: 'localhost', port: emailPort } }) |
diff --git a/server/tests/api/check-params/users.ts b/server/tests/api/check-params/users.ts index 88fc8e8b1..bffe29bce 100644 --- a/server/tests/api/check-params/users.ts +++ b/server/tests/api/check-params/users.ts | |||
@@ -237,7 +237,7 @@ describe('Test users API validators', function () { | |||
237 | it('Should succeed with no password on a server with smtp enabled', async function () { | 237 | it('Should succeed with no password on a server with smtp enabled', async function () { |
238 | this.timeout(20000) | 238 | this.timeout(20000) |
239 | 239 | ||
240 | killallServers([ server ]) | 240 | await killallServers([ server ]) |
241 | 241 | ||
242 | const config = immutableAssign(overrideConfig, { | 242 | const config = immutableAssign(overrideConfig, { |
243 | smtp: { | 243 | smtp: { |
diff --git a/server/tests/api/live/live.ts b/server/tests/api/live/live.ts index 0b06df44c..f9a162df6 100644 --- a/server/tests/api/live/live.ts +++ b/server/tests/api/live/live.ts | |||
@@ -587,7 +587,7 @@ describe('Test live', function () { | |||
587 | await commands[0].waitUntilSegmentGeneration({ videoUUID: liveVideoId, resolution: 0, segment: 2 }) | 587 | await commands[0].waitUntilSegmentGeneration({ videoUUID: liveVideoId, resolution: 0, segment: 2 }) |
588 | await commands[0].waitUntilSegmentGeneration({ videoUUID: liveVideoReplayId, resolution: 0, segment: 2 }) | 588 | await commands[0].waitUntilSegmentGeneration({ videoUUID: liveVideoReplayId, resolution: 0, segment: 2 }) |
589 | 589 | ||
590 | killallServers([ servers[0] ]) | 590 | await killallServers([ servers[0] ]) |
591 | await reRunServer(servers[0]) | 591 | await reRunServer(servers[0]) |
592 | 592 | ||
593 | await wait(5000) | 593 | await wait(5000) |
diff --git a/server/tests/api/moderation/video-blacklist.ts b/server/tests/api/moderation/video-blacklist.ts index c72ebc16b..8b4723a2b 100644 --- a/server/tests/api/moderation/video-blacklist.ts +++ b/server/tests/api/moderation/video-blacklist.ts | |||
@@ -342,7 +342,7 @@ describe('Test video blacklist', function () { | |||
342 | before(async function () { | 342 | before(async function () { |
343 | this.timeout(20000) | 343 | this.timeout(20000) |
344 | 344 | ||
345 | killallServers([ servers[0] ]) | 345 | await killallServers([ servers[0] ]) |
346 | 346 | ||
347 | const config = { | 347 | const config = { |
348 | auto_blacklist: { | 348 | auto_blacklist: { |
diff --git a/server/tests/api/notifications/admin-notifications.ts b/server/tests/api/notifications/admin-notifications.ts index da9767b74..03fbe0b70 100644 --- a/server/tests/api/notifications/admin-notifications.ts +++ b/server/tests/api/notifications/admin-notifications.ts | |||
@@ -11,8 +11,6 @@ import { | |||
11 | MockSmtpServer, | 11 | MockSmtpServer, |
12 | prepareNotificationsTest, | 12 | prepareNotificationsTest, |
13 | ServerInfo, | 13 | ServerInfo, |
14 | setPluginLatestVersion, | ||
15 | setPluginVersion, | ||
16 | wait | 14 | wait |
17 | } from '@shared/extra-utils' | 15 | } from '@shared/extra-utils' |
18 | import { PluginType, UserNotification, UserNotificationType } from '@shared/models' | 16 | import { PluginType, UserNotification, UserNotificationType } from '@shared/models' |
@@ -120,8 +118,8 @@ describe('Test admin notifications', function () { | |||
120 | it('Should send a notification to admins on new plugin version', async function () { | 118 | it('Should send a notification to admins on new plugin version', async function () { |
121 | this.timeout(30000) | 119 | this.timeout(30000) |
122 | 120 | ||
123 | await setPluginVersion(server.internalServerNumber, 'hello-world', '0.0.1') | 121 | await server.sqlCommand.setPluginVersion('hello-world', '0.0.1') |
124 | await setPluginLatestVersion(server.internalServerNumber, 'hello-world', '0.0.1') | 122 | await server.sqlCommand.setPluginLatestVersion('hello-world', '0.0.1') |
125 | await wait(6000) | 123 | await wait(6000) |
126 | 124 | ||
127 | await checkNewPluginVersion(baseParams, PluginType.PLUGIN, 'hello-world', 'presence') | 125 | await checkNewPluginVersion(baseParams, PluginType.PLUGIN, 'hello-world', 'presence') |
@@ -142,8 +140,8 @@ describe('Test admin notifications', function () { | |||
142 | it('Should send a new notification after a new plugin release', async function () { | 140 | it('Should send a new notification after a new plugin release', async function () { |
143 | this.timeout(30000) | 141 | this.timeout(30000) |
144 | 142 | ||
145 | await setPluginVersion(server.internalServerNumber, 'hello-world', '0.0.1') | 143 | await server.sqlCommand.setPluginVersion('hello-world', '0.0.1') |
146 | await setPluginLatestVersion(server.internalServerNumber, 'hello-world', '0.0.1') | 144 | await server.sqlCommand.setPluginLatestVersion('hello-world', '0.0.1') |
147 | await wait(6000) | 145 | await wait(6000) |
148 | 146 | ||
149 | expect(adminNotifications.filter(n => n.type === UserNotificationType.NEW_PEERTUBE_VERSION)).to.have.lengthOf(2) | 147 | expect(adminNotifications.filter(n => n.type === UserNotificationType.NEW_PEERTUBE_VERSION)).to.have.lengthOf(2) |
diff --git a/server/tests/api/redundancy/redundancy-constraints.ts b/server/tests/api/redundancy/redundancy-constraints.ts index 500b96747..82d952471 100644 --- a/server/tests/api/redundancy/redundancy-constraints.ts +++ b/server/tests/api/redundancy/redundancy-constraints.ts | |||
@@ -121,7 +121,7 @@ describe('Test redundancy constraints', function () { | |||
121 | } | 121 | } |
122 | } | 122 | } |
123 | } | 123 | } |
124 | await killallServers([ localServer ]) | 124 | await await killallServers([ localServer ]) |
125 | await reRunServer(localServer, config) | 125 | await reRunServer(localServer, config) |
126 | 126 | ||
127 | await uploadWrapper('video 2 server 2') | 127 | await uploadWrapper('video 2 server 2') |
@@ -150,7 +150,7 @@ describe('Test redundancy constraints', function () { | |||
150 | } | 150 | } |
151 | } | 151 | } |
152 | } | 152 | } |
153 | killallServers([ localServer ]) | 153 | await killallServers([ localServer ]) |
154 | await reRunServer(localServer, config) | 154 | await reRunServer(localServer, config) |
155 | 155 | ||
156 | await uploadWrapper('video 3 server 2') | 156 | await uploadWrapper('video 3 server 2') |
diff --git a/server/tests/api/redundancy/redundancy.ts b/server/tests/api/redundancy/redundancy.ts index d20cb80f1..56a2af395 100644 --- a/server/tests/api/redundancy/redundancy.ts +++ b/server/tests/api/redundancy/redundancy.ts | |||
@@ -634,7 +634,7 @@ describe('Test videos redundancy', function () { | |||
634 | it('Should stop server 1 and expire video redundancy', async function () { | 634 | it('Should stop server 1 and expire video redundancy', async function () { |
635 | this.timeout(80000) | 635 | this.timeout(80000) |
636 | 636 | ||
637 | killallServers([ servers[0] ]) | 637 | await killallServers([ servers[0] ]) |
638 | 638 | ||
639 | await wait(15000) | 639 | await wait(15000) |
640 | 640 | ||
@@ -703,7 +703,7 @@ describe('Test videos redundancy', function () { | |||
703 | 703 | ||
704 | await waitJobs(servers) | 704 | await waitJobs(servers) |
705 | 705 | ||
706 | killallServers([ servers[0] ]) | 706 | await killallServers([ servers[0] ]) |
707 | await reRunServer(servers[0], { | 707 | await reRunServer(servers[0], { |
708 | redundancy: { | 708 | redundancy: { |
709 | videos: { | 709 | videos: { |
diff --git a/server/tests/api/server/config.ts b/server/tests/api/server/config.ts index 037628c9d..55cf2a1b8 100644 --- a/server/tests/api/server/config.ts +++ b/server/tests/api/server/config.ts | |||
@@ -456,7 +456,7 @@ describe('Test config', function () { | |||
456 | it('Should have the configuration updated after a restart', async function () { | 456 | it('Should have the configuration updated after a restart', async function () { |
457 | this.timeout(10000) | 457 | this.timeout(10000) |
458 | 458 | ||
459 | killallServers([ server ]) | 459 | await killallServers([ server ]) |
460 | 460 | ||
461 | await reRunServer(server) | 461 | await reRunServer(server) |
462 | 462 | ||
@@ -507,7 +507,7 @@ describe('Test config', function () { | |||
507 | expect(res.headers['x-frame-options']).to.exist | 507 | expect(res.headers['x-frame-options']).to.exist |
508 | } | 508 | } |
509 | 509 | ||
510 | killallServers([ server ]) | 510 | await killallServers([ server ]) |
511 | 511 | ||
512 | const config = { | 512 | const config = { |
513 | security: { | 513 | security: { |
diff --git a/server/tests/api/server/handle-down.ts b/server/tests/api/server/handle-down.ts index 94496a159..dd06acb5e 100644 --- a/server/tests/api/server/handle-down.ts +++ b/server/tests/api/server/handle-down.ts | |||
@@ -5,7 +5,6 @@ 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 | closeAllSequelize, | ||
9 | CommentsCommand, | 8 | CommentsCommand, |
10 | completeVideoCheck, | 9 | completeVideoCheck, |
11 | flushAndRunMultipleServers, | 10 | flushAndRunMultipleServers, |
@@ -16,7 +15,6 @@ import { | |||
16 | reRunServer, | 15 | reRunServer, |
17 | ServerInfo, | 16 | ServerInfo, |
18 | setAccessTokensToServers, | 17 | setAccessTokensToServers, |
19 | setActorFollowScores, | ||
20 | updateVideo, | 18 | updateVideo, |
21 | uploadVideo, | 19 | uploadVideo, |
22 | uploadVideoAndGetId, | 20 | uploadVideoAndGetId, |
@@ -129,7 +127,7 @@ describe('Test handle downs', function () { | |||
129 | } | 127 | } |
130 | 128 | ||
131 | // Kill server 2 | 129 | // Kill server 2 |
132 | killallServers([ servers[1] ]) | 130 | await killallServers([ servers[1] ]) |
133 | 131 | ||
134 | // Remove server 2 follower | 132 | // Remove server 2 follower |
135 | for (let i = 0; i < 10; i++) { | 133 | for (let i = 0; i < 10; i++) { |
@@ -139,7 +137,7 @@ describe('Test handle downs', function () { | |||
139 | await waitJobs([ servers[0], servers[2] ]) | 137 | await waitJobs([ servers[0], servers[2] ]) |
140 | 138 | ||
141 | // Kill server 3 | 139 | // Kill server 3 |
142 | killallServers([ servers[2] ]) | 140 | await killallServers([ servers[2] ]) |
143 | 141 | ||
144 | const resLastVideo1 = await uploadVideo(servers[0].url, servers[0].accessToken, videoAttributes) | 142 | const resLastVideo1 = await uploadVideo(servers[0].url, servers[0].accessToken, videoAttributes) |
145 | missedVideo1 = resLastVideo1.body.video | 143 | missedVideo1 = resLastVideo1.body.video |
@@ -311,7 +309,7 @@ describe('Test handle downs', function () { | |||
311 | } | 309 | } |
312 | 310 | ||
313 | await waitJobs(servers) | 311 | await waitJobs(servers) |
314 | await setActorFollowScores(servers[1].internalServerNumber, 20) | 312 | await servers[1].sqlCommand.setActorFollowScores(20) |
315 | 313 | ||
316 | // Wait video expiration | 314 | // Wait video expiration |
317 | await wait(11000) | 315 | await wait(11000) |
@@ -325,7 +323,7 @@ describe('Test handle downs', function () { | |||
325 | it('Should remove followings that are down', async function () { | 323 | it('Should remove followings that are down', async function () { |
326 | this.timeout(120000) | 324 | this.timeout(120000) |
327 | 325 | ||
328 | killallServers([ servers[0] ]) | 326 | await killallServers([ servers[0] ]) |
329 | 327 | ||
330 | // Wait video expiration | 328 | // Wait video expiration |
331 | await wait(11000) | 329 | await wait(11000) |
@@ -344,8 +342,6 @@ describe('Test handle downs', function () { | |||
344 | }) | 342 | }) |
345 | 343 | ||
346 | after(async function () { | 344 | after(async function () { |
347 | await closeAllSequelize([ servers[1] ]) | ||
348 | |||
349 | await cleanupTests(servers) | 345 | await cleanupTests(servers) |
350 | }) | 346 | }) |
351 | }) | 347 | }) |
diff --git a/server/tests/api/server/homepage.ts b/server/tests/api/server/homepage.ts index c08067f3c..18b9edc31 100644 --- a/server/tests/api/server/homepage.ts +++ b/server/tests/api/server/homepage.ts | |||
@@ -54,7 +54,7 @@ describe('Test instance homepage actions', function () { | |||
54 | it('Should have the same homepage after a restart', async function () { | 54 | it('Should have the same homepage after a restart', async function () { |
55 | this.timeout(30000) | 55 | this.timeout(30000) |
56 | 56 | ||
57 | killallServers([ server ]) | 57 | await killallServers([ server ]) |
58 | 58 | ||
59 | await reRunServer(server) | 59 | await reRunServer(server) |
60 | 60 | ||
diff --git a/server/tests/api/server/logs.ts b/server/tests/api/server/logs.ts index ab83a329f..365f6cc2b 100644 --- a/server/tests/api/server/logs.ts +++ b/server/tests/api/server/logs.ts | |||
@@ -113,7 +113,7 @@ describe('Test logs', function () { | |||
113 | it('Should not log ping requests', async function () { | 113 | it('Should not log ping requests', async function () { |
114 | this.timeout(30000) | 114 | this.timeout(30000) |
115 | 115 | ||
116 | killallServers([ server ]) | 116 | await killallServers([ server ]) |
117 | 117 | ||
118 | await reRunServer(server, { log: { log_ping_requests: false } }) | 118 | await reRunServer(server, { log: { log_ping_requests: false } }) |
119 | 119 | ||
diff --git a/server/tests/api/server/plugins.ts b/server/tests/api/server/plugins.ts index e22ecfad9..655cf00fa 100644 --- a/server/tests/api/server/plugins.ts +++ b/server/tests/api/server/plugins.ts | |||
@@ -5,7 +5,6 @@ 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 | closeAllSequelize, | ||
9 | flushAndRunServer, | 8 | flushAndRunServer, |
10 | getMyUserInformation, | 9 | getMyUserInformation, |
11 | killallServers, | 10 | killallServers, |
@@ -13,7 +12,6 @@ import { | |||
13 | reRunServer, | 12 | reRunServer, |
14 | ServerInfo, | 13 | ServerInfo, |
15 | setAccessTokensToServers, | 14 | setAccessTokensToServers, |
16 | setPluginVersion, | ||
17 | testHelloWorldRegisteredSettings, | 15 | testHelloWorldRegisteredSettings, |
18 | updateMyUser, | 16 | updateMyUser, |
19 | wait, | 17 | wait, |
@@ -244,7 +242,7 @@ describe('Test plugins', function () { | |||
244 | await wait(6000) | 242 | await wait(6000) |
245 | 243 | ||
246 | // Fake update our plugin version | 244 | // Fake update our plugin version |
247 | await setPluginVersion(server.internalServerNumber, 'hello-world', '0.0.1') | 245 | await server.sqlCommand.setPluginVersion('hello-world', '0.0.1') |
248 | 246 | ||
249 | // Fake update package.json | 247 | // Fake update package.json |
250 | const packageJSON = await command.getPackageJSON('peertube-plugin-hello-world') | 248 | const packageJSON = await command.getPackageJSON('peertube-plugin-hello-world') |
@@ -254,7 +252,7 @@ describe('Test plugins', function () { | |||
254 | await command.updatePackageJSON('peertube-plugin-hello-world', packageJSON) | 252 | await command.updatePackageJSON('peertube-plugin-hello-world', packageJSON) |
255 | 253 | ||
256 | // Restart the server to take into account this change | 254 | // Restart the server to take into account this change |
257 | killallServers([ server ]) | 255 | await killallServers([ server ]) |
258 | await reRunServer(server) | 256 | await reRunServer(server) |
259 | 257 | ||
260 | { | 258 | { |
@@ -335,14 +333,13 @@ describe('Test plugins', function () { | |||
335 | 333 | ||
336 | await check() | 334 | await check() |
337 | 335 | ||
338 | killallServers([ server ]) | 336 | await killallServers([ server ]) |
339 | await reRunServer(server) | 337 | await reRunServer(server) |
340 | 338 | ||
341 | await check() | 339 | await check() |
342 | }) | 340 | }) |
343 | 341 | ||
344 | after(async function () { | 342 | after(async function () { |
345 | await closeAllSequelize([ server ]) | ||
346 | await cleanupTests([ server ]) | 343 | await cleanupTests([ server ]) |
347 | }) | 344 | }) |
348 | }) | 345 | }) |
diff --git a/server/tests/api/server/tracker.ts b/server/tests/api/server/tracker.ts index 4b86e0b90..868dc8977 100644 --- a/server/tests/api/server/tracker.ts +++ b/server/tests/api/server/tracker.ts | |||
@@ -61,8 +61,7 @@ describe('Test tracker', function () { | |||
61 | const errCb = () => done(new Error('Tracker is enabled')) | 61 | const errCb = () => done(new Error('Tracker is enabled')) |
62 | 62 | ||
63 | killallServers([ server ]) | 63 | killallServers([ server ]) |
64 | 64 | .then(() => reRunServer(server, { tracker: { enabled: false } })) | |
65 | reRunServer(server, { tracker: { enabled: false } }) | ||
66 | .then(() => { | 65 | .then(() => { |
67 | const webtorrent = new WebTorrent() | 66 | const webtorrent = new WebTorrent() |
68 | 67 | ||
@@ -86,8 +85,7 @@ describe('Test tracker', function () { | |||
86 | this.timeout(20000) | 85 | this.timeout(20000) |
87 | 86 | ||
88 | killallServers([ server ]) | 87 | killallServers([ server ]) |
89 | 88 | .then(() => reRunServer(server)) | |
90 | reRunServer(server) | ||
91 | .then(() => { | 89 | .then(() => { |
92 | const webtorrent = new WebTorrent() | 90 | const webtorrent = new WebTorrent() |
93 | 91 | ||
diff --git a/server/tests/api/users/users.ts b/server/tests/api/users/users.ts index 4d255f340..69a8dba34 100644 --- a/server/tests/api/users/users.ts +++ b/server/tests/api/users/users.ts | |||
@@ -6,7 +6,6 @@ import { HttpStatusCode } from '@shared/core-utils' | |||
6 | import { | 6 | import { |
7 | blockUser, | 7 | blockUser, |
8 | cleanupTests, | 8 | cleanupTests, |
9 | closeAllSequelize, | ||
10 | createUser, | 9 | createUser, |
11 | deleteMe, | 10 | deleteMe, |
12 | flushAndRunServer, | 11 | flushAndRunServer, |
@@ -30,7 +29,6 @@ import { | |||
30 | reRunServer, | 29 | reRunServer, |
31 | ServerInfo, | 30 | ServerInfo, |
32 | setAccessTokensToServers, | 31 | setAccessTokensToServers, |
33 | setTokenField, | ||
34 | testImage, | 32 | testImage, |
35 | unblockUser, | 33 | unblockUser, |
36 | updateMyAvatar, | 34 | updateMyAvatar, |
@@ -264,10 +262,10 @@ describe('Test users', function () { | |||
264 | it('Should have an expired access token', async function () { | 262 | it('Should have an expired access token', async function () { |
265 | this.timeout(15000) | 263 | this.timeout(15000) |
266 | 264 | ||
267 | await setTokenField(server.internalServerNumber, server.accessToken, 'accessTokenExpiresAt', new Date().toISOString()) | 265 | await server.sqlCommand.setTokenField(server.accessToken, 'accessTokenExpiresAt', new Date().toISOString()) |
268 | await setTokenField(server.internalServerNumber, server.accessToken, 'refreshTokenExpiresAt', new Date().toISOString()) | 266 | await server.sqlCommand.setTokenField(server.accessToken, 'refreshTokenExpiresAt', new Date().toISOString()) |
269 | 267 | ||
270 | killallServers([ server ]) | 268 | await killallServers([ server ]) |
271 | await reRunServer(server) | 269 | await reRunServer(server) |
272 | 270 | ||
273 | await getMyUserInformation(server.url, server.accessToken, 401) | 271 | await getMyUserInformation(server.url, server.accessToken, 401) |
@@ -281,9 +279,9 @@ describe('Test users', function () { | |||
281 | this.timeout(15000) | 279 | this.timeout(15000) |
282 | 280 | ||
283 | const futureDate = new Date(new Date().getTime() + 1000 * 60).toISOString() | 281 | const futureDate = new Date(new Date().getTime() + 1000 * 60).toISOString() |
284 | await setTokenField(server.internalServerNumber, server.accessToken, 'refreshTokenExpiresAt', futureDate) | 282 | await server.sqlCommand.setTokenField(server.accessToken, 'refreshTokenExpiresAt', futureDate) |
285 | 283 | ||
286 | killallServers([ server ]) | 284 | await killallServers([ server ]) |
287 | await reRunServer(server) | 285 | await reRunServer(server) |
288 | 286 | ||
289 | const res = await refreshToken(server, server.refreshToken) | 287 | const res = await refreshToken(server, server.refreshToken) |
@@ -1013,7 +1011,6 @@ describe('Test users', function () { | |||
1013 | }) | 1011 | }) |
1014 | 1012 | ||
1015 | after(async function () { | 1013 | after(async function () { |
1016 | await closeAllSequelize([ server ]) | ||
1017 | await cleanupTests([ server ]) | 1014 | await cleanupTests([ server ]) |
1018 | }) | 1015 | }) |
1019 | }) | 1016 | }) |
diff --git a/server/tests/api/videos/video-channels.ts b/server/tests/api/videos/video-channels.ts index daf066eb1..e441ebbd4 100644 --- a/server/tests/api/videos/video-channels.ts +++ b/server/tests/api/videos/video-channels.ts | |||
@@ -9,7 +9,6 @@ import { | |||
9 | createUser, | 9 | createUser, |
10 | doubleFollow, | 10 | doubleFollow, |
11 | flushAndRunMultipleServers, | 11 | flushAndRunMultipleServers, |
12 | getActorImage, | ||
13 | getVideo, | 12 | getVideo, |
14 | getVideoChannelVideos, | 13 | getVideoChannelVideos, |
15 | setDefaultVideoChannel, | 14 | setDefaultVideoChannel, |
@@ -268,7 +267,7 @@ describe('Test video channels', function () { | |||
268 | await testImage(server.url, 'avatar-resized', avatarPaths[server.port], '.png') | 267 | await testImage(server.url, 'avatar-resized', avatarPaths[server.port], '.png') |
269 | await testFileExistsOrNot(server, 'avatars', basename(avatarPaths[server.port]), true) | 268 | await testFileExistsOrNot(server, 'avatars', basename(avatarPaths[server.port]), true) |
270 | 269 | ||
271 | const row = await getActorImage(server.internalServerNumber, basename(avatarPaths[server.port])) | 270 | const row = await server.sqlCommand.getActorImage(basename(avatarPaths[server.port])) |
272 | expect(row.height).to.equal(ACTOR_IMAGES_SIZE.AVATARS.height) | 271 | expect(row.height).to.equal(ACTOR_IMAGES_SIZE.AVATARS.height) |
273 | expect(row.width).to.equal(ACTOR_IMAGES_SIZE.AVATARS.width) | 272 | expect(row.width).to.equal(ACTOR_IMAGES_SIZE.AVATARS.width) |
274 | } | 273 | } |
@@ -294,7 +293,7 @@ describe('Test video channels', function () { | |||
294 | await testImage(server.url, 'banner-resized', bannerPaths[server.port]) | 293 | await testImage(server.url, 'banner-resized', bannerPaths[server.port]) |
295 | await testFileExistsOrNot(server, 'avatars', basename(bannerPaths[server.port]), true) | 294 | await testFileExistsOrNot(server, 'avatars', basename(bannerPaths[server.port]), true) |
296 | 295 | ||
297 | const row = await getActorImage(server.internalServerNumber, basename(bannerPaths[server.port])) | 296 | const row = await server.sqlCommand.getActorImage(basename(bannerPaths[server.port])) |
298 | expect(row.height).to.equal(ACTOR_IMAGES_SIZE.BANNERS.height) | 297 | expect(row.height).to.equal(ACTOR_IMAGES_SIZE.BANNERS.height) |
299 | expect(row.width).to.equal(ACTOR_IMAGES_SIZE.BANNERS.width) | 298 | expect(row.width).to.equal(ACTOR_IMAGES_SIZE.BANNERS.width) |
300 | } | 299 | } |
diff --git a/server/tests/api/videos/videos-history.ts b/server/tests/api/videos/videos-history.ts index 731447135..9a7635c35 100644 --- a/server/tests/api/videos/videos-history.ts +++ b/server/tests/api/videos/videos-history.ts | |||
@@ -204,7 +204,7 @@ describe('Test videos history', function () { | |||
204 | it('Should not clean old history', async function () { | 204 | it('Should not clean old history', async function () { |
205 | this.timeout(50000) | 205 | this.timeout(50000) |
206 | 206 | ||
207 | killallServers([ server ]) | 207 | await killallServers([ server ]) |
208 | 208 | ||
209 | await reRunServer(server, { history: { videos: { max_age: '10 days' } } }) | 209 | await reRunServer(server, { history: { videos: { max_age: '10 days' } } }) |
210 | 210 | ||
@@ -219,7 +219,7 @@ describe('Test videos history', function () { | |||
219 | it('Should clean old history', async function () { | 219 | it('Should clean old history', async function () { |
220 | this.timeout(50000) | 220 | this.timeout(50000) |
221 | 221 | ||
222 | killallServers([ server ]) | 222 | await killallServers([ server ]) |
223 | 223 | ||
224 | await reRunServer(server, { history: { videos: { max_age: '5 seconds' } } }) | 224 | await reRunServer(server, { history: { videos: { max_age: '5 seconds' } } }) |
225 | 225 | ||
diff --git a/server/tests/api/videos/videos-views-cleaner.ts b/server/tests/api/videos/videos-views-cleaner.ts index b89f33217..b6cde6b50 100644 --- a/server/tests/api/videos/videos-views-cleaner.ts +++ b/server/tests/api/videos/videos-views-cleaner.ts | |||
@@ -1,11 +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 * as chai from 'chai' | ||
4 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | ||
5 | import { | 5 | import { |
6 | cleanupTests, | 6 | cleanupTests, |
7 | closeAllSequelize, | ||
8 | countVideoViewsOf, | ||
9 | doubleFollow, | 7 | doubleFollow, |
10 | flushAndRunMultipleServers, | 8 | flushAndRunMultipleServers, |
11 | killallServers, | 9 | killallServers, |
@@ -50,7 +48,7 @@ describe('Test video views cleaner', function () { | |||
50 | it('Should not clean old video views', async function () { | 48 | it('Should not clean old video views', async function () { |
51 | this.timeout(50000) | 49 | this.timeout(50000) |
52 | 50 | ||
53 | killallServers([ servers[0] ]) | 51 | await killallServers([ servers[0] ]) |
54 | 52 | ||
55 | await reRunServer(servers[0], { views: { videos: { remote: { max_age: '10 days' } } } }) | 53 | await reRunServer(servers[0], { views: { videos: { remote: { max_age: '10 days' } } } }) |
56 | 54 | ||
@@ -60,14 +58,14 @@ describe('Test video views cleaner', function () { | |||
60 | 58 | ||
61 | { | 59 | { |
62 | for (const server of servers) { | 60 | for (const server of servers) { |
63 | const total = await countVideoViewsOf(server.internalServerNumber, videoIdServer1) | 61 | const total = await server.sqlCommand.countVideoViewsOf(videoIdServer1) |
64 | expect(total).to.equal(2, 'Server ' + server.serverNumber + ' does not have the correct amount of views') | 62 | expect(total).to.equal(2, 'Server ' + server.serverNumber + ' does not have the correct amount of views') |
65 | } | 63 | } |
66 | } | 64 | } |
67 | 65 | ||
68 | { | 66 | { |
69 | for (const server of servers) { | 67 | for (const server of servers) { |
70 | const total = await countVideoViewsOf(server.internalServerNumber, videoIdServer2) | 68 | const total = await server.sqlCommand.countVideoViewsOf(videoIdServer2) |
71 | expect(total).to.equal(2, 'Server ' + server.serverNumber + ' does not have the correct amount of views') | 69 | expect(total).to.equal(2, 'Server ' + server.serverNumber + ' does not have the correct amount of views') |
72 | } | 70 | } |
73 | } | 71 | } |
@@ -76,7 +74,7 @@ describe('Test video views cleaner', function () { | |||
76 | it('Should clean old video views', async function () { | 74 | it('Should clean old video views', async function () { |
77 | this.timeout(50000) | 75 | this.timeout(50000) |
78 | 76 | ||
79 | killallServers([ servers[0] ]) | 77 | await killallServers([ servers[0] ]) |
80 | 78 | ||
81 | await reRunServer(servers[0], { views: { videos: { remote: { max_age: '5 seconds' } } } }) | 79 | await reRunServer(servers[0], { views: { videos: { remote: { max_age: '5 seconds' } } } }) |
82 | 80 | ||
@@ -86,23 +84,21 @@ describe('Test video views cleaner', function () { | |||
86 | 84 | ||
87 | { | 85 | { |
88 | for (const server of servers) { | 86 | for (const server of servers) { |
89 | const total = await countVideoViewsOf(server.internalServerNumber, videoIdServer1) | 87 | const total = await server.sqlCommand.countVideoViewsOf(videoIdServer1) |
90 | expect(total).to.equal(2) | 88 | expect(total).to.equal(2) |
91 | } | 89 | } |
92 | } | 90 | } |
93 | 91 | ||
94 | { | 92 | { |
95 | const totalServer1 = await countVideoViewsOf(servers[0].internalServerNumber, videoIdServer2) | 93 | const totalServer1 = await servers[0].sqlCommand.countVideoViewsOf(videoIdServer2) |
96 | expect(totalServer1).to.equal(0) | 94 | expect(totalServer1).to.equal(0) |
97 | 95 | ||
98 | const totalServer2 = await countVideoViewsOf(servers[1].internalServerNumber, videoIdServer2) | 96 | const totalServer2 = await servers[1].sqlCommand.countVideoViewsOf(videoIdServer2) |
99 | expect(totalServer2).to.equal(2) | 97 | expect(totalServer2).to.equal(2) |
100 | } | 98 | } |
101 | }) | 99 | }) |
102 | 100 | ||
103 | after(async function () { | 101 | after(async function () { |
104 | await closeAllSequelize(servers) | ||
105 | |||
106 | await cleanupTests(servers) | 102 | await cleanupTests(servers) |
107 | }) | 103 | }) |
108 | }) | 104 | }) |
diff --git a/server/tests/cli/plugins.ts b/server/tests/cli/plugins.ts index e5efae36b..5344bfc96 100644 --- a/server/tests/cli/plugins.ts +++ b/server/tests/cli/plugins.ts | |||
@@ -39,7 +39,7 @@ describe('Test plugin scripts', function () { | |||
39 | it('Should have the theme and the plugin registered when we restart peertube', async function () { | 39 | it('Should have the theme and the plugin registered when we restart peertube', async function () { |
40 | this.timeout(30000) | 40 | this.timeout(30000) |
41 | 41 | ||
42 | killallServers([ server ]) | 42 | await killallServers([ server ]) |
43 | await reRunServer(server) | 43 | await reRunServer(server) |
44 | 44 | ||
45 | const config = await server.configCommand.getConfig() | 45 | const config = await server.configCommand.getConfig() |
@@ -62,7 +62,7 @@ describe('Test plugin scripts', function () { | |||
62 | it('Should have removed the plugin on another peertube restart', async function () { | 62 | it('Should have removed the plugin on another peertube restart', async function () { |
63 | this.timeout(30000) | 63 | this.timeout(30000) |
64 | 64 | ||
65 | killallServers([ server ]) | 65 | await killallServers([ server ]) |
66 | await reRunServer(server) | 66 | await reRunServer(server) |
67 | 67 | ||
68 | const config = await server.configCommand.getConfig() | 68 | const config = await server.configCommand.getConfig() |
diff --git a/server/tests/cli/prune-storage.ts b/server/tests/cli/prune-storage.ts index fa1df65a9..d4dbee682 100644 --- a/server/tests/cli/prune-storage.ts +++ b/server/tests/cli/prune-storage.ts | |||
@@ -110,7 +110,7 @@ describe('Test prune storage scripts', function () { | |||
110 | await wait(1000) | 110 | await wait(1000) |
111 | 111 | ||
112 | await waitJobs(servers) | 112 | await waitJobs(servers) |
113 | killallServers(servers) | 113 | await killallServers(servers) |
114 | 114 | ||
115 | await wait(1000) | 115 | await wait(1000) |
116 | }) | 116 | }) |
diff --git a/server/tests/cli/update-host.ts b/server/tests/cli/update-host.ts index d3a1520cf..e986a04f2 100644 --- a/server/tests/cli/update-host.ts +++ b/server/tests/cli/update-host.ts | |||
@@ -61,7 +61,7 @@ describe('Test update host scripts', function () { | |||
61 | it('Should run update host', async function () { | 61 | it('Should run update host', async function () { |
62 | this.timeout(30000) | 62 | this.timeout(30000) |
63 | 63 | ||
64 | killallServers([ server ]) | 64 | await killallServers([ server ]) |
65 | // Run server with standard configuration | 65 | // Run server with standard configuration |
66 | await reRunServer(server) | 66 | await reRunServer(server) |
67 | 67 | ||
diff --git a/server/tests/external-plugins/auto-block-videos.ts b/server/tests/external-plugins/auto-block-videos.ts index 6659b6f39..f4b55522a 100644 --- a/server/tests/external-plugins/auto-block-videos.ts +++ b/server/tests/external-plugins/auto-block-videos.ts | |||
@@ -164,7 +164,7 @@ describe('Official plugin auto-block videos', function () { | |||
164 | 164 | ||
165 | await check(servers[0], video.uuid, true) | 165 | await check(servers[0], video.uuid, true) |
166 | 166 | ||
167 | killallServers([ servers[0] ]) | 167 | await killallServers([ servers[0] ]) |
168 | await reRunServer(servers[0]) | 168 | await reRunServer(servers[0]) |
169 | await wait(2000) | 169 | await wait(2000) |
170 | 170 | ||
diff --git a/server/tests/external-plugins/auto-mute.ts b/server/tests/external-plugins/auto-mute.ts index f86c83808..844023b83 100644 --- a/server/tests/external-plugins/auto-mute.ts +++ b/server/tests/external-plugins/auto-mute.ts | |||
@@ -151,7 +151,7 @@ describe('Official plugin auto-mute', function () { | |||
151 | expect(res.body.total).to.equal(2) | 151 | expect(res.body.total).to.equal(2) |
152 | } | 152 | } |
153 | 153 | ||
154 | killallServers([ servers[0] ]) | 154 | await killallServers([ servers[0] ]) |
155 | await reRunServer(servers[0]) | 155 | await reRunServer(servers[0]) |
156 | await wait(2000) | 156 | await wait(2000) |
157 | 157 | ||
diff --git a/server/tests/plugins/action-hooks.ts b/server/tests/plugins/action-hooks.ts index 6975ca4bb..bcf773854 100644 --- a/server/tests/plugins/action-hooks.ts +++ b/server/tests/plugins/action-hooks.ts | |||
@@ -44,7 +44,7 @@ describe('Test plugin action hooks', function () { | |||
44 | 44 | ||
45 | await servers[0].pluginsCommand.install({ path: PluginsCommand.getPluginTestPath() }) | 45 | await servers[0].pluginsCommand.install({ path: PluginsCommand.getPluginTestPath() }) |
46 | 46 | ||
47 | killallServers([ servers[0] ]) | 47 | await killallServers([ servers[0] ]) |
48 | 48 | ||
49 | await reRunServer(servers[0], { | 49 | await reRunServer(servers[0], { |
50 | live: { | 50 | live: { |