aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-04-24 10:53:40 +0200
committerChocobozzz <me@florianbigard.com>2019-04-24 16:26:23 +0200
commit210feb6cc484a6c5c63c98f770de34e223f944cb (patch)
treed1d841892a7ac87ac0d434194597606a375aaed1 /server
parent9cc8d43e37a61709e7275c2a799bdf976dd940ca (diff)
downloadPeerTube-210feb6cc484a6c5c63c98f770de34e223f944cb.tar.gz
PeerTube-210feb6cc484a6c5c63c98f770de34e223f944cb.tar.zst
PeerTube-210feb6cc484a6c5c63c98f770de34e223f944cb.zip
Cleanup tests
Diffstat (limited to 'server')
-rw-r--r--server/tests/api/activitypub/client.ts4
-rw-r--r--server/tests/api/activitypub/fetch.ts5
-rw-r--r--server/tests/api/activitypub/refresher.ts2
-rw-r--r--server/tests/api/activitypub/security.ts5
-rw-r--r--server/tests/api/check-params/accounts.ts13
-rw-r--r--server/tests/api/check-params/blocklist.ts9
-rw-r--r--server/tests/api/check-params/config.ts12
-rw-r--r--server/tests/api/check-params/contact-form.ts12
-rw-r--r--server/tests/api/check-params/debug.ts13
-rw-r--r--server/tests/api/check-params/follows.ts12
-rw-r--r--server/tests/api/check-params/jobs.ts13
-rw-r--r--server/tests/api/check-params/logs.ts13
-rw-r--r--server/tests/api/check-params/redundancy.ts8
-rw-r--r--server/tests/api/check-params/search.ts13
-rw-r--r--server/tests/api/check-params/services.ts13
-rw-r--r--server/tests/api/check-params/user-notifications.ts13
-rw-r--r--server/tests/api/check-params/user-subscriptions.ts13
-rw-r--r--server/tests/api/check-params/users.ts15
-rw-r--r--server/tests/api/check-params/video-abuses.ts13
-rw-r--r--server/tests/api/check-params/video-blacklist.ts8
-rw-r--r--server/tests/api/check-params/video-captions.ts13
-rw-r--r--server/tests/api/check-params/video-channels.ts13
-rw-r--r--server/tests/api/check-params/video-comments.ts13
-rw-r--r--server/tests/api/check-params/video-imports.ts13
-rw-r--r--server/tests/api/check-params/video-playlists.ts13
-rw-r--r--server/tests/api/check-params/videos-filter.ts13
-rw-r--r--server/tests/api/check-params/videos-history.ts13
-rw-r--r--server/tests/api/check-params/videos.ts13
-rw-r--r--server/tests/api/notifications/user-notifications.ts4
-rw-r--r--server/tests/api/search/search-activitypub-video-channels.ts9
-rw-r--r--server/tests/api/search/search-activitypub-videos.ts9
-rw-r--r--server/tests/api/search/search-videos.ts13
-rw-r--r--server/tests/api/server/config.ts8
-rw-r--r--server/tests/api/server/contact-form.ts8
-rw-r--r--server/tests/api/server/email.ts8
-rw-r--r--server/tests/api/server/follow-constraints.ts2
-rw-r--r--server/tests/api/server/follows-moderation.ts2
-rw-r--r--server/tests/api/server/follows.ts2
-rw-r--r--server/tests/api/server/handle-down.ts2
-rw-r--r--server/tests/api/server/jobs.ts2
-rw-r--r--server/tests/api/server/logs.ts8
-rw-r--r--server/tests/api/server/no-client.ts13
-rw-r--r--server/tests/api/server/reverse-proxy.ts8
-rw-r--r--server/tests/api/server/stats.ts4
-rw-r--r--server/tests/api/server/tracker.ts8
-rw-r--r--server/tests/api/users/blocklist.ts9
-rw-r--r--server/tests/api/users/user-subscriptions.ts2
-rw-r--r--server/tests/api/users/users-multiple-servers.ts2
-rw-r--r--server/tests/api/users/users-verification.ts13
-rw-r--r--server/tests/api/users/users.ts13
-rw-r--r--server/tests/api/videos/multiple-servers.ts7
-rw-r--r--server/tests/api/videos/services.ts8
-rw-r--r--server/tests/api/videos/single-server.ts13
-rw-r--r--server/tests/api/videos/video-abuse.ts2
-rw-r--r--server/tests/api/videos/video-blacklist.ts2
-rw-r--r--server/tests/api/videos/video-captions.ts4
-rw-r--r--server/tests/api/videos/video-change-ownership.ts18
-rw-r--r--server/tests/api/videos/video-channels.ts4
-rw-r--r--server/tests/api/videos/video-comments.ts8
-rw-r--r--server/tests/api/videos/video-description.ts2
-rw-r--r--server/tests/api/videos/video-hls.ts7
-rw-r--r--server/tests/api/videos/video-imports.ts2
-rw-r--r--server/tests/api/videos/video-nsfw.ts8
-rw-r--r--server/tests/api/videos/video-playlists.ts7
-rw-r--r--server/tests/api/videos/video-privacy.ts2
-rw-r--r--server/tests/api/videos/video-schedule-update.ts2
-rw-r--r--server/tests/api/videos/video-transcoder.ts2
-rw-r--r--server/tests/api/videos/videos-filter.ts9
-rw-r--r--server/tests/api/videos/videos-history.ts13
-rw-r--r--server/tests/api/videos/videos-overview.ts13
-rw-r--r--server/tests/api/videos/videos-views-cleaner.ts11
-rw-r--r--server/tests/cli/create-import-video-file-job.ts3
-rw-r--r--server/tests/cli/create-transcoding-job.ts4
-rw-r--r--server/tests/cli/optimize-old-videos.ts4
-rw-r--r--server/tests/cli/peertube.ts6
-rw-r--r--server/tests/cli/reset-password.ts8
-rw-r--r--server/tests/cli/update-host.ts10
-rw-r--r--server/tests/client.ts8
-rw-r--r--server/tests/feeds/feeds.ts7
-rw-r--r--server/tests/misc-endpoints.ts8
-rw-r--r--server/tests/real-world/populate-database.ts5
81 files changed, 174 insertions, 495 deletions
diff --git a/server/tests/api/activitypub/client.ts b/server/tests/api/activitypub/client.ts
index 52e7e27f8..edf588c16 100644
--- a/server/tests/api/activitypub/client.ts
+++ b/server/tests/api/activitypub/client.ts
@@ -22,8 +22,6 @@ describe('Test activitypub', function () {
22 before(async function () { 22 before(async function () {
23 this.timeout(30000) 23 this.timeout(30000)
24 24
25 await flushTests()
26
27 servers = await flushAndRunMultipleServers(2) 25 servers = await flushAndRunMultipleServers(2)
28 26
29 await setAccessTokensToServers(servers) 27 await setAccessTokensToServers(servers)
@@ -61,7 +59,7 @@ describe('Test activitypub', function () {
61 expect(res.header.location).to.equal('http://localhost:9001/videos/watch/' + videoUUID) 59 expect(res.header.location).to.equal('http://localhost:9001/videos/watch/' + videoUUID)
62 }) 60 })
63 61
64 after(async function () { 62 after(function () {
65 killallServers(servers) 63 killallServers(servers)
66 }) 64 })
67}) 65})
diff --git a/server/tests/api/activitypub/fetch.ts b/server/tests/api/activitypub/fetch.ts
index f9dba3418..7240bb0fb 100644
--- a/server/tests/api/activitypub/fetch.ts
+++ b/server/tests/api/activitypub/fetch.ts
@@ -81,10 +81,5 @@ describe('Test ActivityPub fetcher', function () {
81 killallServers(servers) 81 killallServers(servers)
82 82
83 await closeAllSequelize(servers) 83 await closeAllSequelize(servers)
84
85 // Keep the logs if the test failed
86 if (this['ok']) {
87 await flushTests()
88 }
89 }) 84 })
90}) 85})
diff --git a/server/tests/api/activitypub/refresher.ts b/server/tests/api/activitypub/refresher.ts
index 7b08b1dab..9be9aa495 100644
--- a/server/tests/api/activitypub/refresher.ts
+++ b/server/tests/api/activitypub/refresher.ts
@@ -153,7 +153,7 @@ describe('Test AP refresher', function () {
153 }) 153 })
154 }) 154 })
155 155
156 after(async function () { 156 after(function () {
157 killallServers(servers) 157 killallServers(servers)
158 }) 158 })
159}) 159})
diff --git a/server/tests/api/activitypub/security.ts b/server/tests/api/activitypub/security.ts
index 2346e9c8e..11e6859bf 100644
--- a/server/tests/api/activitypub/security.ts
+++ b/server/tests/api/activitypub/security.ts
@@ -180,10 +180,5 @@ describe('Test ActivityPub security', function () {
180 killallServers(servers) 180 killallServers(servers)
181 181
182 await closeAllSequelize(servers) 182 await closeAllSequelize(servers)
183
184 // Keep the logs if the test failed
185 if (this['ok']) {
186 await flushTests()
187 }
188 }) 183 })
189}) 184})
diff --git a/server/tests/api/check-params/accounts.ts b/server/tests/api/check-params/accounts.ts
index 4c145c41d..086090533 100644
--- a/server/tests/api/check-params/accounts.ts
+++ b/server/tests/api/check-params/accounts.ts
@@ -2,7 +2,7 @@
2 2
3import 'mocha' 3import 'mocha'
4 4
5import { flushTests, killallServers, runServer, ServerInfo } from '../../../../shared/extra-utils' 5import { flushTests, killallServers, flushAndRunServer, ServerInfo } from '../../../../shared/extra-utils'
6import { 6import {
7 checkBadCountPagination, 7 checkBadCountPagination,
8 checkBadSortPagination, 8 checkBadSortPagination,
@@ -19,9 +19,7 @@ describe('Test accounts API validators', function () {
19 before(async function () { 19 before(async function () {
20 this.timeout(30000) 20 this.timeout(30000)
21 21
22 await flushTests() 22 server = await flushAndRunServer(1)
23
24 server = await runServer(1)
25 }) 23 })
26 24
27 describe('When listing accounts', function () { 25 describe('When listing accounts', function () {
@@ -44,12 +42,7 @@ describe('Test accounts API validators', function () {
44 }) 42 })
45 }) 43 })
46 44
47 after(async function () { 45 after(function () {
48 killallServers([ server ]) 46 killallServers([ server ])
49
50 // Keep the logs if the test failed
51 if (this['ok']) {
52 await flushTests()
53 }
54 }) 47 })
55}) 48})
diff --git a/server/tests/api/check-params/blocklist.ts b/server/tests/api/check-params/blocklist.ts
index 6c7351d38..d815a8363 100644
--- a/server/tests/api/check-params/blocklist.ts
+++ b/server/tests/api/check-params/blocklist.ts
@@ -28,8 +28,6 @@ describe('Test blocklist API validators', function () {
28 before(async function () { 28 before(async function () {
29 this.timeout(60000) 29 this.timeout(60000)
30 30
31 await flushTests()
32
33 servers = await flushAndRunMultipleServers(2) 31 servers = await flushAndRunMultipleServers(2)
34 await setAccessTokensToServers(servers) 32 await setAccessTokensToServers(servers)
35 33
@@ -487,12 +485,7 @@ describe('Test blocklist API validators', function () {
487 }) 485 })
488 }) 486 })
489 487
490 after(async function () { 488 after(function () {
491 killallServers(servers) 489 killallServers(servers)
492
493 // Keep the logs if the test failed
494 if (this['ok']) {
495 await flushTests()
496 }
497 }) 490 })
498}) 491})
diff --git a/server/tests/api/check-params/config.ts b/server/tests/api/check-params/config.ts
index ba07552cf..3d80c629e 100644
--- a/server/tests/api/check-params/config.ts
+++ b/server/tests/api/check-params/config.ts
@@ -5,7 +5,7 @@ import 'mocha'
5import { CustomConfig } from '../../../../shared/models/server/custom-config.model' 5import { CustomConfig } from '../../../../shared/models/server/custom-config.model'
6 6
7import { 7import {
8 createUser, flushTests, killallServers, makeDeleteRequest, makeGetRequest, makePutBodyRequest, runServer, ServerInfo, 8 createUser, flushTests, killallServers, makeDeleteRequest, makeGetRequest, makePutBodyRequest, flushAndRunServer, ServerInfo,
9 setAccessTokensToServers, userLogin, immutableAssign 9 setAccessTokensToServers, userLogin, immutableAssign
10} from '../../../../shared/extra-utils' 10} from '../../../../shared/extra-utils'
11 11
@@ -101,8 +101,7 @@ describe('Test config API validators', function () {
101 before(async function () { 101 before(async function () {
102 this.timeout(30000) 102 this.timeout(30000)
103 103
104 await flushTests() 104 server = await flushAndRunServer(1)
105 server = await runServer(1)
106 105
107 await setAccessTokensToServers([ server ]) 106 await setAccessTokensToServers([ server ])
108 107
@@ -230,12 +229,7 @@ describe('Test config API validators', function () {
230 }) 229 })
231 }) 230 })
232 231
233 after(async function () { 232 after(function () {
234 killallServers([ server ]) 233 killallServers([ server ])
235
236 // Keep the logs if the test failed
237 if (this['ok']) {
238 await flushTests()
239 }
240 }) 234 })
241}) 235})
diff --git a/server/tests/api/check-params/contact-form.ts b/server/tests/api/check-params/contact-form.ts
index 9ba6136aa..6c7781f13 100644
--- a/server/tests/api/check-params/contact-form.ts
+++ b/server/tests/api/check-params/contact-form.ts
@@ -7,7 +7,7 @@ import {
7 immutableAssign, 7 immutableAssign,
8 killallServers, 8 killallServers,
9 reRunServer, 9 reRunServer,
10 runServer, 10 flushAndRunServer,
11 ServerInfo, 11 ServerInfo,
12 setAccessTokensToServers 12 setAccessTokensToServers
13} from '../../../../shared/extra-utils' 13} from '../../../../shared/extra-utils'
@@ -34,11 +34,10 @@ describe('Test contact form API validators', function () {
34 before(async function () { 34 before(async function () {
35 this.timeout(60000) 35 this.timeout(60000)
36 36
37 await flushTests()
38 await MockSmtpServer.Instance.collectEmails(emails) 37 await MockSmtpServer.Instance.collectEmails(emails)
39 38
40 // Email is disabled 39 // Email is disabled
41 server = await runServer(1) 40 server = await flushAndRunServer(1)
42 }) 41 })
43 42
44 it('Should not accept a contact form if emails are disabled', async function () { 43 it('Should not accept a contact form if emails are disabled', async function () {
@@ -84,13 +83,8 @@ describe('Test contact form API validators', function () {
84 await sendContactForm(immutableAssign(defaultBody, { url: server.url })) 83 await sendContactForm(immutableAssign(defaultBody, { url: server.url }))
85 }) 84 })
86 85
87 after(async function () { 86 after(function () {
88 MockSmtpServer.Instance.kill() 87 MockSmtpServer.Instance.kill()
89 killallServers([ server ]) 88 killallServers([ server ])
90
91 // Keep the logs if the test failed
92 if (this['ok']) {
93 await flushTests()
94 }
95 }) 89 })
96}) 90})
diff --git a/server/tests/api/check-params/debug.ts b/server/tests/api/check-params/debug.ts
index 8ba7e0430..dd00ed9e1 100644
--- a/server/tests/api/check-params/debug.ts
+++ b/server/tests/api/check-params/debug.ts
@@ -6,7 +6,7 @@ import {
6 createUser, 6 createUser,
7 flushTests, 7 flushTests,
8 killallServers, 8 killallServers,
9 runServer, 9 flushAndRunServer,
10 ServerInfo, 10 ServerInfo,
11 setAccessTokensToServers, 11 setAccessTokensToServers,
12 userLogin 12 userLogin
@@ -23,9 +23,7 @@ describe('Test debug API validators', function () {
23 before(async function () { 23 before(async function () {
24 this.timeout(120000) 24 this.timeout(120000)
25 25
26 await flushTests() 26 server = await flushAndRunServer(1)
27
28 server = await runServer(1)
29 27
30 await setAccessTokensToServers([ server ]) 28 await setAccessTokensToServers([ server ])
31 29
@@ -67,12 +65,7 @@ describe('Test debug API validators', function () {
67 }) 65 })
68 }) 66 })
69 67
70 after(async function () { 68 after(function () {
71 killallServers([ server ]) 69 killallServers([ server ])
72
73 // Keep the logs if the test failed
74 if (this['ok']) {
75 await flushTests()
76 }
77 }) 70 })
78}) 71})
diff --git a/server/tests/api/check-params/follows.ts b/server/tests/api/check-params/follows.ts
index e75631312..02f47c2bb 100644
--- a/server/tests/api/check-params/follows.ts
+++ b/server/tests/api/check-params/follows.ts
@@ -3,7 +3,7 @@
3import 'mocha' 3import 'mocha'
4 4
5import { 5import {
6 createUser, flushTests, killallServers, makeDeleteRequest, makePostBodyRequest, runServer, ServerInfo, setAccessTokensToServers, 6 createUser, flushTests, killallServers, makeDeleteRequest, makePostBodyRequest, flushAndRunServer, ServerInfo, setAccessTokensToServers,
7 userLogin 7 userLogin
8} from '../../../../shared/extra-utils' 8} from '../../../../shared/extra-utils'
9import { 9import {
@@ -20,8 +20,7 @@ describe('Test server follows API validators', function () {
20 before(async function () { 20 before(async function () {
21 this.timeout(30000) 21 this.timeout(30000)
22 22
23 await flushTests() 23 server = await flushAndRunServer(1)
24 server = await runServer(1)
25 24
26 await setAccessTokensToServers([ server ]) 25 await setAccessTokensToServers([ server ])
27 }) 26 })
@@ -296,12 +295,7 @@ describe('Test server follows API validators', function () {
296 }) 295 })
297 }) 296 })
298 297
299 after(async function () { 298 after(function () {
300 killallServers([ server ]) 299 killallServers([ server ])
301
302 // Keep the logs if the test failed
303 if (this['ok']) {
304 await flushTests()
305 }
306 }) 300 })
307}) 301})
diff --git a/server/tests/api/check-params/jobs.ts b/server/tests/api/check-params/jobs.ts
index 682406e87..ec2be0b9f 100644
--- a/server/tests/api/check-params/jobs.ts
+++ b/server/tests/api/check-params/jobs.ts
@@ -6,7 +6,7 @@ import {
6 createUser, 6 createUser,
7 flushTests, 7 flushTests,
8 killallServers, 8 killallServers,
9 runServer, 9 flushAndRunServer,
10 ServerInfo, 10 ServerInfo,
11 setAccessTokensToServers, 11 setAccessTokensToServers,
12 userLogin 12 userLogin
@@ -28,9 +28,7 @@ describe('Test jobs API validators', function () {
28 before(async function () { 28 before(async function () {
29 this.timeout(120000) 29 this.timeout(120000)
30 30
31 await flushTests() 31 server = await flushAndRunServer(1)
32
33 server = await runServer(1)
34 32
35 await setAccessTokensToServers([ server ]) 33 await setAccessTokensToServers([ server ])
36 34
@@ -82,12 +80,7 @@ describe('Test jobs API validators', function () {
82 }) 80 })
83 }) 81 })
84 82
85 after(async function () { 83 after(function () {
86 killallServers([ server ]) 84 killallServers([ server ])
87
88 // Keep the logs if the test failed
89 if (this['ok']) {
90 await flushTests()
91 }
92 }) 85 })
93}) 86})
diff --git a/server/tests/api/check-params/logs.ts b/server/tests/api/check-params/logs.ts
index 0948f7c5e..46cb2392d 100644
--- a/server/tests/api/check-params/logs.ts
+++ b/server/tests/api/check-params/logs.ts
@@ -6,7 +6,7 @@ import {
6 createUser, 6 createUser,
7 flushTests, 7 flushTests,
8 killallServers, 8 killallServers,
9 runServer, 9 flushAndRunServer,
10 ServerInfo, 10 ServerInfo,
11 setAccessTokensToServers, 11 setAccessTokensToServers,
12 userLogin 12 userLogin
@@ -23,9 +23,7 @@ describe('Test logs API validators', function () {
23 before(async function () { 23 before(async function () {
24 this.timeout(120000) 24 this.timeout(120000)
25 25
26 await flushTests() 26 server = await flushAndRunServer(1)
27
28 server = await runServer(1)
29 27
30 await setAccessTokensToServers([ server ]) 28 await setAccessTokensToServers([ server ])
31 29
@@ -106,12 +104,7 @@ describe('Test logs API validators', function () {
106 }) 104 })
107 }) 105 })
108 106
109 after(async function () { 107 after(function () {
110 killallServers([ server ]) 108 killallServers([ server ])
111
112 // Keep the logs if the test failed
113 if (this['ok']) {
114 await flushTests()
115 }
116 }) 109 })
117}) 110})
diff --git a/server/tests/api/check-params/redundancy.ts b/server/tests/api/check-params/redundancy.ts
index 93b905fea..8f930fbbc 100644
--- a/server/tests/api/check-params/redundancy.ts
+++ b/server/tests/api/check-params/redundancy.ts
@@ -23,7 +23,6 @@ describe('Test server redundancy API validators', function () {
23 before(async function () { 23 before(async function () {
24 this.timeout(30000) 24 this.timeout(30000)
25 25
26 await flushTests()
27 servers = await flushAndRunMultipleServers(2) 26 servers = await flushAndRunMultipleServers(2)
28 27
29 await setAccessTokensToServers(servers) 28 await setAccessTokensToServers(servers)
@@ -92,12 +91,7 @@ describe('Test server redundancy API validators', function () {
92 }) 91 })
93 }) 92 })
94 93
95 after(async function () { 94 after(function () {
96 killallServers(servers) 95 killallServers(servers)
97
98 // Keep the logs if the test failed
99 if (this['ok']) {
100 await flushTests()
101 }
102 }) 96 })
103}) 97})
diff --git a/server/tests/api/check-params/search.ts b/server/tests/api/check-params/search.ts
index 1fcdedd90..816719779 100644
--- a/server/tests/api/check-params/search.ts
+++ b/server/tests/api/check-params/search.ts
@@ -2,7 +2,7 @@
2 2
3import 'mocha' 3import 'mocha'
4 4
5import { flushTests, immutableAssign, killallServers, makeGetRequest, runServer, ServerInfo } from '../../../../shared/extra-utils' 5import { flushTests, immutableAssign, killallServers, makeGetRequest, flushAndRunServer, ServerInfo } from '../../../../shared/extra-utils'
6import { 6import {
7 checkBadCountPagination, 7 checkBadCountPagination,
8 checkBadSortPagination, 8 checkBadSortPagination,
@@ -17,9 +17,7 @@ describe('Test videos API validator', function () {
17 before(async function () { 17 before(async function () {
18 this.timeout(30000) 18 this.timeout(30000)
19 19
20 await flushTests() 20 server = await flushAndRunServer(1)
21
22 server = await runServer(1)
23 }) 21 })
24 22
25 describe('When searching videos', function () { 23 describe('When searching videos', function () {
@@ -146,12 +144,7 @@ describe('Test videos API validator', function () {
146 }) 144 })
147 }) 145 })
148 146
149 after(async function () { 147 after(function () {
150 killallServers([ server ]) 148 killallServers([ server ])
151
152 // Keep the logs if the test failed
153 if (this['ok']) {
154 await flushTests()
155 }
156 }) 149 })
157}) 150})
diff --git a/server/tests/api/check-params/services.ts b/server/tests/api/check-params/services.ts
index 813bc7e36..33580ddb1 100644
--- a/server/tests/api/check-params/services.ts
+++ b/server/tests/api/check-params/services.ts
@@ -6,7 +6,7 @@ import {
6 flushTests, 6 flushTests,
7 killallServers, 7 killallServers,
8 makeGetRequest, 8 makeGetRequest,
9 runServer, 9 flushAndRunServer,
10 ServerInfo, 10 ServerInfo,
11 setAccessTokensToServers, 11 setAccessTokensToServers,
12 uploadVideo 12 uploadVideo
@@ -20,9 +20,7 @@ describe('Test services API validators', function () {
20 before(async function () { 20 before(async function () {
21 this.timeout(60000) 21 this.timeout(60000)
22 22
23 await flushTests() 23 server = await flushAndRunServer(1)
24
25 server = await runServer(1)
26 await setAccessTokensToServers([ server ]) 24 await setAccessTokensToServers([ server ])
27 25
28 const res = await uploadVideo(server.url, server.accessToken, { name: 'my super name' }) 26 const res = await uploadVideo(server.url, server.accessToken, { name: 'my super name' })
@@ -93,13 +91,8 @@ describe('Test services API validators', function () {
93 }) 91 })
94 }) 92 })
95 93
96 after(async function () { 94 after(function () {
97 killallServers([ server ]) 95 killallServers([ server ])
98
99 // Keep the logs if the test failed
100 if (this['ok']) {
101 await flushTests()
102 }
103 }) 96 })
104}) 97})
105 98
diff --git a/server/tests/api/check-params/user-notifications.ts b/server/tests/api/check-params/user-notifications.ts
index c56328406..32619d7e1 100644
--- a/server/tests/api/check-params/user-notifications.ts
+++ b/server/tests/api/check-params/user-notifications.ts
@@ -10,7 +10,7 @@ import {
10 makeGetRequest, 10 makeGetRequest,
11 makePostBodyRequest, 11 makePostBodyRequest,
12 makePutBodyRequest, 12 makePutBodyRequest,
13 runServer, 13 flushAndRunServer,
14 ServerInfo, 14 ServerInfo,
15 setAccessTokensToServers, 15 setAccessTokensToServers,
16 wait 16 wait
@@ -30,9 +30,7 @@ describe('Test user notifications API validators', function () {
30 before(async function () { 30 before(async function () {
31 this.timeout(30000) 31 this.timeout(30000)
32 32
33 await flushTests() 33 server = await flushAndRunServer(1)
34
35 server = await runServer(1)
36 34
37 await setAccessTokensToServers([ server ]) 35 await setAccessTokensToServers([ server ])
38 }) 36 })
@@ -288,12 +286,7 @@ describe('Test user notifications API validators', function () {
288 }) 286 })
289 }) 287 })
290 288
291 after(async function () { 289 after(function () {
292 killallServers([ server ]) 290 killallServers([ server ])
293
294 // Keep the logs if the test failed
295 if (this['ok']) {
296 await flushTests()
297 }
298 }) 291 })
299}) 292})
diff --git a/server/tests/api/check-params/user-subscriptions.ts b/server/tests/api/check-params/user-subscriptions.ts
index d33b3bca6..1fe67fa7c 100644
--- a/server/tests/api/check-params/user-subscriptions.ts
+++ b/server/tests/api/check-params/user-subscriptions.ts
@@ -9,7 +9,7 @@ import {
9 makeDeleteRequest, 9 makeDeleteRequest,
10 makeGetRequest, 10 makeGetRequest,
11 makePostBodyRequest, 11 makePostBodyRequest,
12 runServer, 12 flushAndRunServer,
13 ServerInfo, 13 ServerInfo,
14 setAccessTokensToServers, 14 setAccessTokensToServers,
15 userLogin 15 userLogin
@@ -32,9 +32,7 @@ describe('Test user subscriptions API validators', function () {
32 before(async function () { 32 before(async function () {
33 this.timeout(30000) 33 this.timeout(30000)
34 34
35 await flushTests() 35 server = await flushAndRunServer(1)
36
37 server = await runServer(1)
38 36
39 await setAccessTokensToServers([ server ]) 37 await setAccessTokensToServers([ server ])
40 38
@@ -303,12 +301,7 @@ describe('Test user subscriptions API validators', function () {
303 }) 301 })
304 }) 302 })
305 303
306 after(async function () { 304 after(function () {
307 killallServers([ server ]) 305 killallServers([ server ])
308
309 // Keep the logs if the test failed
310 if (this['ok']) {
311 await flushTests()
312 }
313 }) 306 })
314}) 307})
diff --git a/server/tests/api/check-params/users.ts b/server/tests/api/check-params/users.ts
index b62806554..00d0a7e2b 100644
--- a/server/tests/api/check-params/users.ts
+++ b/server/tests/api/check-params/users.ts
@@ -7,7 +7,7 @@ import { UserRole, VideoImport, VideoImportState } from '../../../../shared'
7 7
8import { 8import {
9 createUser, flushTests, getMyUserInformation, getMyUserVideoRating, getUsersList, immutableAssign, killallServers, makeGetRequest, 9 createUser, flushTests, getMyUserInformation, getMyUserVideoRating, getUsersList, immutableAssign, killallServers, makeGetRequest,
10 makePostBodyRequest, makeUploadRequest, makePutBodyRequest, registerUser, removeUser, runServer, ServerInfo, setAccessTokensToServers, 10 makePostBodyRequest, makeUploadRequest, makePutBodyRequest, registerUser, removeUser, flushAndRunServer, ServerInfo, setAccessTokensToServers,
11 updateUser, uploadVideo, userLogin, deleteMe, unblockUser, blockUser 11 updateUser, uploadVideo, userLogin, deleteMe, unblockUser, blockUser
12} from '../../../../shared/extra-utils' 12} from '../../../../shared/extra-utils'
13import { 13import {
@@ -40,10 +40,8 @@ describe('Test users API validators', function () {
40 before(async function () { 40 before(async function () {
41 this.timeout(30000) 41 this.timeout(30000)
42 42
43 await flushTests() 43 server = await flushAndRunServer(1)
44 44 serverWithRegistrationDisabled = await flushAndRunServer(2)
45 server = await runServer(1)
46 serverWithRegistrationDisabled = await runServer(2)
47 45
48 await setAccessTokensToServers([ server ]) 46 await setAccessTokensToServers([ server ])
49 47
@@ -881,12 +879,7 @@ describe('Test users API validators', function () {
881 }) 879 })
882 }) 880 })
883 881
884 after(async function () { 882 after(function () {
885 killallServers([ server, serverWithRegistrationDisabled ]) 883 killallServers([ server, serverWithRegistrationDisabled ])
886
887 // Keep the logs if the test failed
888 if (this['ok']) {
889 await flushTests()
890 }
891 }) 884 })
892}) 885})
diff --git a/server/tests/api/check-params/video-abuses.ts b/server/tests/api/check-params/video-abuses.ts
index 78e4acf2f..e2813d470 100644
--- a/server/tests/api/check-params/video-abuses.ts
+++ b/server/tests/api/check-params/video-abuses.ts
@@ -9,7 +9,7 @@ import {
9 killallServers, 9 killallServers,
10 makeGetRequest, 10 makeGetRequest,
11 makePostBodyRequest, 11 makePostBodyRequest,
12 runServer, 12 flushAndRunServer,
13 ServerInfo, 13 ServerInfo,
14 setAccessTokensToServers, 14 setAccessTokensToServers,
15 updateVideoAbuse, 15 updateVideoAbuse,
@@ -33,9 +33,7 @@ describe('Test video abuses API validators', function () {
33 before(async function () { 33 before(async function () {
34 this.timeout(30000) 34 this.timeout(30000)
35 35
36 await flushTests() 36 server = await flushAndRunServer(1)
37
38 server = await runServer(1)
39 37
40 await setAccessTokensToServers([ server ]) 38 await setAccessTokensToServers([ server ])
41 39
@@ -190,12 +188,7 @@ describe('Test video abuses API validators', function () {
190 }) 188 })
191 }) 189 })
192 190
193 after(async function () { 191 after(function () {
194 killallServers([ server ]) 192 killallServers([ server ])
195
196 // Keep the logs if the test failed
197 if (this['ok']) {
198 await flushTests()
199 }
200 }) 193 })
201}) 194})
diff --git a/server/tests/api/check-params/video-blacklist.ts b/server/tests/api/check-params/video-blacklist.ts
index c2e9622cc..f9c7d9e9a 100644
--- a/server/tests/api/check-params/video-blacklist.ts
+++ b/server/tests/api/check-params/video-blacklist.ts
@@ -39,7 +39,6 @@ describe('Test video blacklist API validators', function () {
39 before(async function () { 39 before(async function () {
40 this.timeout(120000) 40 this.timeout(120000)
41 41
42 await flushTests()
43 servers = await flushAndRunMultipleServers(2) 42 servers = await flushAndRunMultipleServers(2)
44 43
45 await setAccessTokensToServers(servers) 44 await setAccessTokensToServers(servers)
@@ -248,12 +247,7 @@ describe('Test video blacklist API validators', function () {
248 }) 247 })
249 }) 248 })
250 249
251 after(async function () { 250 after(function () {
252 killallServers(servers) 251 killallServers(servers)
253
254 // Keep the logs if the test failed
255 if (this['ok']) {
256 await flushTests()
257 }
258 }) 252 })
259}) 253})
diff --git a/server/tests/api/check-params/video-captions.ts b/server/tests/api/check-params/video-captions.ts
index 4ef5e03ed..64265865a 100644
--- a/server/tests/api/check-params/video-captions.ts
+++ b/server/tests/api/check-params/video-captions.ts
@@ -8,7 +8,7 @@ import {
8 makeDeleteRequest, 8 makeDeleteRequest,
9 makeGetRequest, 9 makeGetRequest,
10 makeUploadRequest, 10 makeUploadRequest,
11 runServer, 11 flushAndRunServer,
12 ServerInfo, 12 ServerInfo,
13 setAccessTokensToServers, 13 setAccessTokensToServers,
14 uploadVideo, 14 uploadVideo,
@@ -29,9 +29,7 @@ describe('Test video captions API validator', function () {
29 before(async function () { 29 before(async function () {
30 this.timeout(30000) 30 this.timeout(30000)
31 31
32 await flushTests() 32 server = await flushAndRunServer(1)
33
34 server = await runServer(1)
35 33
36 await setAccessTokensToServers([ server ]) 34 await setAccessTokensToServers([ server ])
37 35
@@ -271,12 +269,7 @@ describe('Test video captions API validator', function () {
271 }) 269 })
272 }) 270 })
273 271
274 after(async function () { 272 after(function () {
275 killallServers([ server ]) 273 killallServers([ server ])
276
277 // Keep the logs if the test failed
278 if (this['ok']) {
279 await flushTests()
280 }
281 }) 274 })
282}) 275})
diff --git a/server/tests/api/check-params/video-channels.ts b/server/tests/api/check-params/video-channels.ts
index b6aa745ab..06da4f541 100644
--- a/server/tests/api/check-params/video-channels.ts
+++ b/server/tests/api/check-params/video-channels.ts
@@ -16,7 +16,7 @@ import {
16 makePostBodyRequest, 16 makePostBodyRequest,
17 makePutBodyRequest, 17 makePutBodyRequest,
18 makeUploadRequest, 18 makeUploadRequest,
19 runServer, 19 flushAndRunServer,
20 ServerInfo, 20 ServerInfo,
21 setAccessTokensToServers, 21 setAccessTokensToServers,
22 userLogin 22 userLogin
@@ -41,9 +41,7 @@ describe('Test video channels API validator', function () {
41 before(async function () { 41 before(async function () {
42 this.timeout(30000) 42 this.timeout(30000)
43 43
44 await flushTests() 44 server = await flushAndRunServer(1)
45
46 server = await runServer(1)
47 45
48 await setAccessTokensToServers([ server ]) 46 await setAccessTokensToServers([ server ])
49 47
@@ -312,12 +310,7 @@ describe('Test video channels API validator', function () {
312 }) 310 })
313 }) 311 })
314 312
315 after(async function () { 313 after(function () {
316 killallServers([ server ]) 314 killallServers([ server ])
317
318 // Keep the logs if the test failed
319 if (this['ok']) {
320 await flushTests()
321 }
322 }) 315 })
323}) 316})
diff --git a/server/tests/api/check-params/video-comments.ts b/server/tests/api/check-params/video-comments.ts
index b80d91279..bb14abbfd 100644
--- a/server/tests/api/check-params/video-comments.ts
+++ b/server/tests/api/check-params/video-comments.ts
@@ -4,7 +4,7 @@ import * as chai from 'chai'
4import 'mocha' 4import 'mocha'
5import { 5import {
6 createUser, 6 createUser,
7 flushTests, killallServers, makeDeleteRequest, makeGetRequest, makePostBodyRequest, runServer, ServerInfo, setAccessTokensToServers, 7 flushTests, killallServers, makeDeleteRequest, makeGetRequest, makePostBodyRequest, flushAndRunServer, ServerInfo, setAccessTokensToServers,
8 uploadVideo, userLogin 8 uploadVideo, userLogin
9} from '../../../../shared/extra-utils' 9} from '../../../../shared/extra-utils'
10import { 10import {
@@ -29,9 +29,7 @@ describe('Test video comments API validator', function () {
29 before(async function () { 29 before(async function () {
30 this.timeout(30000) 30 this.timeout(30000)
31 31
32 await flushTests() 32 server = await flushAndRunServer(1)
33
34 server = await runServer(1)
35 33
36 await setAccessTokensToServers([ server ]) 34 await setAccessTokensToServers([ server ])
37 35
@@ -253,12 +251,7 @@ describe('Test video comments API validator', function () {
253 it('Should return conflict on comment thread add') 251 it('Should return conflict on comment thread add')
254 }) 252 })
255 253
256 after(async function () { 254 after(function () {
257 killallServers([ server ]) 255 killallServers([ server ])
258
259 // Keep the logs if the test failed
260 if (this['ok']) {
261 await flushTests()
262 }
263 }) 256 })
264}) 257})
diff --git a/server/tests/api/check-params/video-imports.ts b/server/tests/api/check-params/video-imports.ts
index ad4c4def0..82fdc0667 100644
--- a/server/tests/api/check-params/video-imports.ts
+++ b/server/tests/api/check-params/video-imports.ts
@@ -13,7 +13,7 @@ import {
13 makeGetRequest, 13 makeGetRequest,
14 makePostBodyRequest, 14 makePostBodyRequest,
15 makeUploadRequest, 15 makeUploadRequest,
16 runServer, 16 flushAndRunServer,
17 ServerInfo, 17 ServerInfo,
18 setAccessTokensToServers, 18 setAccessTokensToServers,
19 updateCustomSubConfig, 19 updateCustomSubConfig,
@@ -38,9 +38,7 @@ describe('Test video imports API validator', function () {
38 before(async function () { 38 before(async function () {
39 this.timeout(30000) 39 this.timeout(30000)
40 40
41 await flushTests() 41 server = await flushAndRunServer(1)
42
43 server = await runServer(1)
44 42
45 await setAccessTokensToServers([ server ]) 43 await setAccessTokensToServers([ server ])
46 44
@@ -313,12 +311,7 @@ describe('Test video imports API validator', function () {
313 }) 311 })
314 }) 312 })
315 313
316 after(async function () { 314 after(function () {
317 killallServers([ server ]) 315 killallServers([ server ])
318
319 // Keep the logs if the test failed
320 if (this['ok']) {
321 await flushTests()
322 }
323 }) 316 })
324}) 317})
diff --git a/server/tests/api/check-params/video-playlists.ts b/server/tests/api/check-params/video-playlists.ts
index 0f3484763..0edb51682 100644
--- a/server/tests/api/check-params/video-playlists.ts
+++ b/server/tests/api/check-params/video-playlists.ts
@@ -14,7 +14,7 @@ import {
14 makeGetRequest, 14 makeGetRequest,
15 removeVideoFromPlaylist, 15 removeVideoFromPlaylist,
16 reorderVideosPlaylist, 16 reorderVideosPlaylist,
17 runServer, 17 flushAndRunServer,
18 ServerInfo, 18 ServerInfo,
19 setAccessTokensToServers, setDefaultVideoChannel, 19 setAccessTokensToServers, setDefaultVideoChannel,
20 updateVideoPlaylist, 20 updateVideoPlaylist,
@@ -43,9 +43,7 @@ describe('Test video playlists API validator', function () {
43 before(async function () { 43 before(async function () {
44 this.timeout(30000) 44 this.timeout(30000)
45 45
46 await flushTests() 46 server = await flushAndRunServer(1)
47
48 server = await runServer(1)
49 47
50 await setAccessTokensToServers([ server ]) 48 await setAccessTokensToServers([ server ])
51 await setDefaultVideoChannel([ server ]) 49 await setDefaultVideoChannel([ server ])
@@ -670,12 +668,7 @@ describe('Test video playlists API validator', function () {
670 }) 668 })
671 }) 669 })
672 670
673 after(async function () { 671 after(function () {
674 killallServers([ server ]) 672 killallServers([ server ])
675
676 // Keep the logs if the test failed
677 if (this['ok']) {
678 await flushTests()
679 }
680 }) 673 })
681}) 674})
diff --git a/server/tests/api/check-params/videos-filter.ts b/server/tests/api/check-params/videos-filter.ts
index 971867b27..82cc0f638 100644
--- a/server/tests/api/check-params/videos-filter.ts
+++ b/server/tests/api/check-params/videos-filter.ts
@@ -7,7 +7,7 @@ import {
7 flushTests, 7 flushTests,
8 killallServers, 8 killallServers,
9 makeGetRequest, 9 makeGetRequest,
10 runServer, 10 flushAndRunServer,
11 ServerInfo, 11 ServerInfo,
12 setAccessTokensToServers, setDefaultVideoChannel, 12 setAccessTokensToServers, setDefaultVideoChannel,
13 userLogin 13 userLogin
@@ -48,9 +48,7 @@ describe('Test videos filters', function () {
48 before(async function () { 48 before(async function () {
49 this.timeout(30000) 49 this.timeout(30000)
50 50
51 await flushTests() 51 server = await flushAndRunServer(1)
52
53 server = await runServer(1)
54 52
55 await setAccessTokensToServers([ server ]) 53 await setAccessTokensToServers([ server ])
56 await setDefaultVideoChannel([ server ]) 54 await setDefaultVideoChannel([ server ])
@@ -131,12 +129,7 @@ describe('Test videos filters', function () {
131 }) 129 })
132 }) 130 })
133 131
134 after(async function () { 132 after(function () {
135 killallServers([ server ]) 133 killallServers([ server ])
136
137 // Keep the logs if the test failed
138 if (this['ok']) {
139 await flushTests()
140 }
141 }) 134 })
142}) 135})
diff --git a/server/tests/api/check-params/videos-history.ts b/server/tests/api/check-params/videos-history.ts
index 11e277644..32f65f510 100644
--- a/server/tests/api/check-params/videos-history.ts
+++ b/server/tests/api/check-params/videos-history.ts
@@ -10,7 +10,7 @@ import {
10 makeGetRequest, 10 makeGetRequest,
11 makePostBodyRequest, 11 makePostBodyRequest,
12 makePutBodyRequest, 12 makePutBodyRequest,
13 runServer, 13 flushAndRunServer,
14 ServerInfo, 14 ServerInfo,
15 setAccessTokensToServers, 15 setAccessTokensToServers,
16 uploadVideo 16 uploadVideo
@@ -29,9 +29,7 @@ describe('Test videos history API validator', function () {
29 before(async function () { 29 before(async function () {
30 this.timeout(30000) 30 this.timeout(30000)
31 31
32 await flushTests() 32 server = await flushAndRunServer(1)
33
34 server = await runServer(1)
35 33
36 await setAccessTokensToServers([ server ]) 34 await setAccessTokensToServers([ server ])
37 35
@@ -128,12 +126,7 @@ describe('Test videos history API validator', function () {
128 }) 126 })
129 }) 127 })
130 128
131 after(async function () { 129 after(function () {
132 killallServers([ server ]) 130 killallServers([ server ])
133
134 // Keep the logs if the test failed
135 if (this['ok']) {
136 await flushTests()
137 }
138 }) 131 })
139}) 132})
diff --git a/server/tests/api/check-params/videos.ts b/server/tests/api/check-params/videos.ts
index e96f324cc..bc321e91f 100644
--- a/server/tests/api/check-params/videos.ts
+++ b/server/tests/api/check-params/videos.ts
@@ -8,7 +8,7 @@ import { VideoPrivacy } from '../../../../shared/models/videos/video-privacy.enu
8import { 8import {
9 createUser, flushTests, getMyUserInformation, getVideo, getVideosList, immutableAssign, killallServers, makeDeleteRequest, 9 createUser, flushTests, getMyUserInformation, getVideo, getVideosList, immutableAssign, killallServers, makeDeleteRequest,
10 makeGetRequest, makeUploadRequest, makePutBodyRequest, removeVideo, uploadVideo, 10 makeGetRequest, makeUploadRequest, makePutBodyRequest, removeVideo, uploadVideo,
11 runServer, ServerInfo, setAccessTokensToServers, userLogin, updateCustomSubConfig 11 flushAndRunServer, ServerInfo, setAccessTokensToServers, userLogin, updateCustomSubConfig
12} from '../../../../shared/extra-utils' 12} from '../../../../shared/extra-utils'
13import { 13import {
14 checkBadCountPagination, 14 checkBadCountPagination,
@@ -33,9 +33,7 @@ describe('Test videos API validator', function () {
33 before(async function () { 33 before(async function () {
34 this.timeout(30000) 34 this.timeout(30000)
35 35
36 await flushTests() 36 server = await flushAndRunServer(1)
37
38 server = await runServer(1)
39 37
40 await setAccessTokensToServers([ server ]) 38 await setAccessTokensToServers([ server ])
41 39
@@ -730,12 +728,7 @@ describe('Test videos API validator', function () {
730 }) 728 })
731 }) 729 })
732 730
733 after(async function () { 731 after(function () {
734 killallServers([ server ]) 732 killallServers([ server ])
735
736 // Keep the logs if the test failed
737 if (this['ok']) {
738 await flushTests()
739 }
740 }) 733 })
741}) 734})
diff --git a/server/tests/api/notifications/user-notifications.ts b/server/tests/api/notifications/user-notifications.ts
index 8f7ce82a4..eb4fdb87c 100644
--- a/server/tests/api/notifications/user-notifications.ts
+++ b/server/tests/api/notifications/user-notifications.ts
@@ -112,8 +112,6 @@ describe('Test users notifications', function () {
112 112
113 await MockSmtpServer.Instance.collectEmails(emails) 113 await MockSmtpServer.Instance.collectEmails(emails)
114 114
115 await flushTests()
116
117 const overrideConfig = { 115 const overrideConfig = {
118 smtp: { 116 smtp: {
119 hostname: 'localhost' 117 hostname: 'localhost'
@@ -1297,7 +1295,7 @@ describe('Test users notifications', function () {
1297 }) 1295 })
1298 }) 1296 })
1299 1297
1300 after(async function () { 1298 after(function () {
1301 MockSmtpServer.Instance.kill() 1299 MockSmtpServer.Instance.kill()
1302 1300
1303 killallServers(servers) 1301 killallServers(servers)
diff --git a/server/tests/api/search/search-activitypub-video-channels.ts b/server/tests/api/search/search-activitypub-video-channels.ts
index 1f59a951b..c5662f049 100644
--- a/server/tests/api/search/search-activitypub-video-channels.ts
+++ b/server/tests/api/search/search-activitypub-video-channels.ts
@@ -33,8 +33,6 @@ describe('Test a ActivityPub video channels search', function () {
33 before(async function () { 33 before(async function () {
34 this.timeout(120000) 34 this.timeout(120000)
35 35
36 await flushTests()
37
38 servers = await flushAndRunMultipleServers(2) 36 servers = await flushAndRunMultipleServers(2)
39 37
40 await setAccessTokensToServers(servers) 38 await setAccessTokensToServers(servers)
@@ -207,12 +205,7 @@ describe('Test a ActivityPub video channels search', function () {
207 expect(res.body.data).to.have.lengthOf(0) 205 expect(res.body.data).to.have.lengthOf(0)
208 }) 206 })
209 207
210 after(async function () { 208 after(function () {
211 killallServers(servers) 209 killallServers(servers)
212
213 // Keep the logs if the test failed
214 if (this['ok']) {
215 await flushTests()
216 }
217 }) 210 })
218}) 211})
diff --git a/server/tests/api/search/search-activitypub-videos.ts b/server/tests/api/search/search-activitypub-videos.ts
index d984c696c..5c2a44ad5 100644
--- a/server/tests/api/search/search-activitypub-videos.ts
+++ b/server/tests/api/search/search-activitypub-videos.ts
@@ -30,8 +30,6 @@ describe('Test a ActivityPub videos search', function () {
30 before(async function () { 30 before(async function () {
31 this.timeout(120000) 31 this.timeout(120000)
32 32
33 await flushTests()
34
35 servers = await flushAndRunMultipleServers(2) 33 servers = await flushAndRunMultipleServers(2)
36 34
37 await setAccessTokensToServers(servers) 35 await setAccessTokensToServers(servers)
@@ -151,12 +149,7 @@ describe('Test a ActivityPub videos search', function () {
151 expect(res.body.data).to.have.lengthOf(0) 149 expect(res.body.data).to.have.lengthOf(0)
152 }) 150 })
153 151
154 after(async function () { 152 after(function () {
155 killallServers(servers) 153 killallServers(servers)
156
157 // Keep the logs if the test failed
158 if (this['ok']) {
159 await flushTests()
160 }
161 }) 154 })
162}) 155})
diff --git a/server/tests/api/search/search-videos.ts b/server/tests/api/search/search-videos.ts
index 65f3c9186..d1520a9aa 100644
--- a/server/tests/api/search/search-videos.ts
+++ b/server/tests/api/search/search-videos.ts
@@ -6,7 +6,7 @@ import {
6 advancedVideosSearch, 6 advancedVideosSearch,
7 flushTests, 7 flushTests,
8 killallServers, 8 killallServers,
9 runServer, 9 flushAndRunServer,
10 searchVideo, 10 searchVideo,
11 ServerInfo, 11 ServerInfo,
12 setAccessTokensToServers, 12 setAccessTokensToServers,
@@ -24,9 +24,7 @@ describe('Test a videos search', function () {
24 before(async function () { 24 before(async function () {
25 this.timeout(30000) 25 this.timeout(30000)
26 26
27 await flushTests() 27 server = await flushAndRunServer(1)
28
29 server = await runServer(1)
30 28
31 await setAccessTokensToServers([ server ]) 29 await setAccessTokensToServers([ server ])
32 30
@@ -407,12 +405,7 @@ describe('Test a videos search', function () {
407 } 405 }
408 }) 406 })
409 407
410 after(async function () { 408 after(function () {
411 killallServers([ server ]) 409 killallServers([ server ])
412
413 // Keep the logs if the test failed
414 if (this['ok']) {
415 await flushTests()
416 }
417 }) 410 })
418}) 411})
diff --git a/server/tests/api/server/config.ts b/server/tests/api/server/config.ts
index a99916627..d8137b339 100644
--- a/server/tests/api/server/config.ts
+++ b/server/tests/api/server/config.ts
@@ -13,7 +13,7 @@ import {
13 getConfig, 13 getConfig,
14 getCustomConfig, 14 getCustomConfig,
15 registerUser, 15 registerUser,
16 runServer, 16 flushAndRunServer,
17 setAccessTokensToServers, 17 setAccessTokensToServers,
18 updateCustomConfig 18 updateCustomConfig
19} from '../../../../shared/extra-utils' 19} from '../../../../shared/extra-utils'
@@ -118,9 +118,7 @@ describe('Test config', function () {
118 118
119 before(async function () { 119 before(async function () {
120 this.timeout(30000) 120 this.timeout(30000)
121 121 server = await flushAndRunServer(1)
122 await flushTests()
123 server = await runServer(1)
124 await setAccessTokensToServers([ server ]) 122 await setAccessTokensToServers([ server ])
125 }) 123 })
126 124
@@ -302,7 +300,7 @@ describe('Test config', function () {
302 checkInitialConfig(data) 300 checkInitialConfig(data)
303 }) 301 })
304 302
305 after(async function () { 303 after(function () {
306 killallServers([ server ]) 304 killallServers([ server ])
307 }) 305 })
308}) 306})
diff --git a/server/tests/api/server/contact-form.ts b/server/tests/api/server/contact-form.ts
index fdd5e9730..26ebb4ed7 100644
--- a/server/tests/api/server/contact-form.ts
+++ b/server/tests/api/server/contact-form.ts
@@ -2,7 +2,7 @@
2 2
3import * as chai from 'chai' 3import * as chai from 'chai'
4import 'mocha' 4import 'mocha'
5import { flushTests, killallServers, runServer, ServerInfo, setAccessTokensToServers, wait } from '../../../../shared/extra-utils' 5import { flushTests, killallServers, flushAndRunServer, ServerInfo, setAccessTokensToServers, wait } from '../../../../shared/extra-utils'
6import { MockSmtpServer } from '../../../../shared/extra-utils/miscs/email' 6import { MockSmtpServer } from '../../../../shared/extra-utils/miscs/email'
7import { waitJobs } from '../../../../shared/extra-utils/server/jobs' 7import { waitJobs } from '../../../../shared/extra-utils/server/jobs'
8import { sendContactForm } from '../../../../shared/extra-utils/server/contact-form' 8import { sendContactForm } from '../../../../shared/extra-utils/server/contact-form'
@@ -18,14 +18,12 @@ describe('Test contact form', function () {
18 18
19 await MockSmtpServer.Instance.collectEmails(emails) 19 await MockSmtpServer.Instance.collectEmails(emails)
20 20
21 await flushTests()
22
23 const overrideConfig = { 21 const overrideConfig = {
24 smtp: { 22 smtp: {
25 hostname: 'localhost' 23 hostname: 'localhost'
26 } 24 }
27 } 25 }
28 server = await runServer(1, overrideConfig) 26 server = await flushAndRunServer(1, overrideConfig)
29 await setAccessTokensToServers([ server ]) 27 await setAccessTokensToServers([ server ])
30 }) 28 })
31 29
@@ -80,7 +78,7 @@ describe('Test contact form', function () {
80 }) 78 })
81 }) 79 })
82 80
83 after(async function () { 81 after(function () {
84 MockSmtpServer.Instance.kill() 82 MockSmtpServer.Instance.kill()
85 killallServers([ server ]) 83 killallServers([ server ])
86 }) 84 })
diff --git a/server/tests/api/server/email.ts b/server/tests/api/server/email.ts
index a40a281f8..1158ceb0e 100644
--- a/server/tests/api/server/email.ts
+++ b/server/tests/api/server/email.ts
@@ -10,7 +10,7 @@ import {
10 createUser, removeVideoFromBlacklist, 10 createUser, removeVideoFromBlacklist,
11 reportVideoAbuse, 11 reportVideoAbuse,
12 resetPassword, 12 resetPassword,
13 runServer, 13 flushAndRunServer,
14 unblockUser, 14 unblockUser,
15 uploadVideo, 15 uploadVideo,
16 userLogin, 16 userLogin,
@@ -43,14 +43,12 @@ describe('Test emails', function () {
43 43
44 await MockSmtpServer.Instance.collectEmails(emails) 44 await MockSmtpServer.Instance.collectEmails(emails)
45 45
46 await flushTests()
47
48 const overrideConfig = { 46 const overrideConfig = {
49 smtp: { 47 smtp: {
50 hostname: 'localhost' 48 hostname: 'localhost'
51 } 49 }
52 } 50 }
53 server = await runServer(1, overrideConfig) 51 server = await flushAndRunServer(1, overrideConfig)
54 await setAccessTokensToServers([ server ]) 52 await setAccessTokensToServers([ server ])
55 53
56 { 54 {
@@ -258,7 +256,7 @@ describe('Test emails', function () {
258 }) 256 })
259 }) 257 })
260 258
261 after(async function () { 259 after(function () {
262 MockSmtpServer.Instance.kill() 260 MockSmtpServer.Instance.kill()
263 killallServers([ server ]) 261 killallServers([ server ])
264 }) 262 })
diff --git a/server/tests/api/server/follow-constraints.ts b/server/tests/api/server/follow-constraints.ts
index bdd8b1c70..cf40018b3 100644
--- a/server/tests/api/server/follow-constraints.ts
+++ b/server/tests/api/server/follow-constraints.ts
@@ -219,7 +219,7 @@ describe('Test follow constraints', function () {
219 }) 219 })
220 }) 220 })
221 221
222 after(async function () { 222 after(function () {
223 killallServers(servers) 223 killallServers(servers)
224 }) 224 })
225}) 225})
diff --git a/server/tests/api/server/follows-moderation.ts b/server/tests/api/server/follows-moderation.ts
index f4a826ea8..ae8716184 100644
--- a/server/tests/api/server/follows-moderation.ts
+++ b/server/tests/api/server/follows-moderation.ts
@@ -189,7 +189,7 @@ describe('Test follows moderation', function () {
189 } 189 }
190 }) 190 })
191 191
192 after(async function () { 192 after(function () {
193 killallServers(servers) 193 killallServers(servers)
194 }) 194 })
195}) 195})
diff --git a/server/tests/api/server/follows.ts b/server/tests/api/server/follows.ts
index 527b54e1e..f1b4a450e 100644
--- a/server/tests/api/server/follows.ts
+++ b/server/tests/api/server/follows.ts
@@ -435,7 +435,7 @@ describe('Test follows', function () {
435 435
436 }) 436 })
437 437
438 after(async function () { 438 after(function () {
439 killallServers(servers) 439 killallServers(servers)
440 }) 440 })
441}) 441})
diff --git a/server/tests/api/server/handle-down.ts b/server/tests/api/server/handle-down.ts
index 8c49541ee..d0f700bda 100644
--- a/server/tests/api/server/handle-down.ts
+++ b/server/tests/api/server/handle-down.ts
@@ -296,7 +296,7 @@ describe('Test handle downs', function () {
296 } 296 }
297 }) 297 })
298 298
299 after(async function () { 299 after(function () {
300 killallServers(servers) 300 killallServers(servers)
301 }) 301 })
302}) 302})
diff --git a/server/tests/api/server/jobs.ts b/server/tests/api/server/jobs.ts
index 1d7429873..01f561b0d 100644
--- a/server/tests/api/server/jobs.ts
+++ b/server/tests/api/server/jobs.ts
@@ -56,7 +56,7 @@ describe('Test jobs', function () {
56 expect(dateIsValid(job.finishedOn)).to.be.true 56 expect(dateIsValid(job.finishedOn)).to.be.true
57 }) 57 })
58 58
59 after(async function () { 59 after(function () {
60 killallServers(servers) 60 killallServers(servers)
61 }) 61 })
62}) 62})
diff --git a/server/tests/api/server/logs.ts b/server/tests/api/server/logs.ts
index f55e12407..5ca352205 100644
--- a/server/tests/api/server/logs.ts
+++ b/server/tests/api/server/logs.ts
@@ -2,7 +2,7 @@
2 2
3import * as chai from 'chai' 3import * as chai from 'chai'
4import 'mocha' 4import 'mocha'
5import { flushTests, killallServers, runServer, ServerInfo, setAccessTokensToServers } from '../../../../shared/extra-utils/index' 5import { flushTests, killallServers, flushAndRunServer, ServerInfo, setAccessTokensToServers } from '../../../../shared/extra-utils/index'
6import { waitJobs } from '../../../../shared/extra-utils/server/jobs' 6import { waitJobs } from '../../../../shared/extra-utils/server/jobs'
7import { uploadVideo } from '../../../../shared/extra-utils/videos/videos' 7import { uploadVideo } from '../../../../shared/extra-utils/videos/videos'
8import { getLogs } from '../../../../shared/extra-utils/logs/logs' 8import { getLogs } from '../../../../shared/extra-utils/logs/logs'
@@ -15,9 +15,7 @@ describe('Test logs', function () {
15 before(async function () { 15 before(async function () {
16 this.timeout(30000) 16 this.timeout(30000)
17 17
18 await flushTests() 18 server = await flushAndRunServer(1)
19
20 server = await runServer(1)
21 await setAccessTokensToServers([ server ]) 19 await setAccessTokensToServers([ server ])
22 }) 20 })
23 21
@@ -86,7 +84,7 @@ describe('Test logs', function () {
86 } 84 }
87 }) 85 })
88 86
89 after(async function () { 87 after(function () {
90 killallServers([ server ]) 88 killallServers([ server ])
91 }) 89 })
92}) 90})
diff --git a/server/tests/api/server/no-client.ts b/server/tests/api/server/no-client.ts
index 88d34063c..226fbfda4 100644
--- a/server/tests/api/server/no-client.ts
+++ b/server/tests/api/server/no-client.ts
@@ -5,7 +5,7 @@ import {
5 killallServers, 5 killallServers,
6 ServerInfo 6 ServerInfo
7} from '../../../../shared/extra-utils' 7} from '../../../../shared/extra-utils'
8import { runServer } from '../../../../shared/extra-utils/server/servers' 8import { flushAndRunServer } from '../../../../shared/extra-utils/server/servers'
9 9
10describe('Start and stop server without web client routes', function () { 10describe('Start and stop server without web client routes', function () {
11 let server: ServerInfo 11 let server: ServerInfo
@@ -13,9 +13,7 @@ describe('Start and stop server without web client routes', function () {
13 before(async function () { 13 before(async function () {
14 this.timeout(30000) 14 this.timeout(30000)
15 15
16 await flushTests() 16 server = await flushAndRunServer(1, {}, ['--no-client'])
17
18 server = await runServer(1, {}, ['--no-client'])
19 }) 17 })
20 18
21 it('Should fail getting the client', function () { 19 it('Should fail getting the client', function () {
@@ -25,12 +23,7 @@ describe('Start and stop server without web client routes', function () {
25 return req.expect(404) 23 return req.expect(404)
26 }) 24 })
27 25
28 after(async function () { 26 after(function () {
29 killallServers([ server ]) 27 killallServers([ server ])
30
31 // Keep the logs if the test failed
32 if (this['ok']) {
33 await flushTests()
34 }
35 }) 28 })
36}) 29})
diff --git a/server/tests/api/server/reverse-proxy.ts b/server/tests/api/server/reverse-proxy.ts
index e7dc16531..e55b12bfc 100644
--- a/server/tests/api/server/reverse-proxy.ts
+++ b/server/tests/api/server/reverse-proxy.ts
@@ -21,7 +21,7 @@ const expect = chai.expect
21import { 21import {
22 getConfig, 22 getConfig,
23 flushTests, 23 flushTests,
24 runServer, 24 flushAndRunServer,
25 registerUser, getCustomConfig, setAccessTokensToServers, updateCustomConfig 25 registerUser, getCustomConfig, setAccessTokensToServers, updateCustomConfig
26} from '../../../../shared/extra-utils/index' 26} from '../../../../shared/extra-utils/index'
27 27
@@ -31,9 +31,7 @@ describe('Test application behind a reverse proxy', function () {
31 31
32 before(async function () { 32 before(async function () {
33 this.timeout(30000) 33 this.timeout(30000)
34 34 server = await flushAndRunServer(1)
35 await flushTests()
36 server = await runServer(1)
37 await setAccessTokensToServers([ server ]) 35 await setAccessTokensToServers([ server ])
38 36
39 const { body } = await uploadVideo(server.url, server.accessToken, {}) 37 const { body } = await uploadVideo(server.url, server.accessToken, {})
@@ -102,7 +100,7 @@ describe('Test application behind a reverse proxy', function () {
102 await userLogin(server, user, 429) 100 await userLogin(server, user, 429)
103 }) 101 })
104 102
105 after(async function () { 103 after(function () {
106 killallServers([ server ]) 104 killallServers([ server ])
107 }) 105 })
108}) 106})
diff --git a/server/tests/api/server/stats.ts b/server/tests/api/server/stats.ts
index 48addad22..bd3d2155c 100644
--- a/server/tests/api/server/stats.ts
+++ b/server/tests/api/server/stats.ts
@@ -26,8 +26,6 @@ describe('Test stats (excluding redundancy)', function () {
26 26
27 before(async function () { 27 before(async function () {
28 this.timeout(60000) 28 this.timeout(60000)
29
30 await flushTests()
31 servers = await flushAndRunMultipleServers(3) 29 servers = await flushAndRunMultipleServers(3)
32 await setAccessTokensToServers(servers) 30 await setAccessTokensToServers(servers)
33 31
@@ -97,7 +95,7 @@ describe('Test stats (excluding redundancy)', function () {
97 expect(data.totalInstanceFollowers).to.equal(0) 95 expect(data.totalInstanceFollowers).to.equal(0)
98 }) 96 })
99 97
100 after(async function () { 98 after(function () {
101 killallServers(servers) 99 killallServers(servers)
102 }) 100 })
103}) 101})
diff --git a/server/tests/api/server/tracker.ts b/server/tests/api/server/tracker.ts
index 4f7cc05a7..1b4e190f1 100644
--- a/server/tests/api/server/tracker.ts
+++ b/server/tests/api/server/tracker.ts
@@ -2,7 +2,7 @@
2 2
3import * as magnetUtil from 'magnet-uri' 3import * as magnetUtil from 'magnet-uri'
4import 'mocha' 4import 'mocha'
5import { getVideo, killallServers, reRunServer, runServer, ServerInfo, uploadVideo } from '../../../../shared/extra-utils' 5import { getVideo, killallServers, reRunServer, flushAndRunServer, ServerInfo, uploadVideo } from '../../../../shared/extra-utils'
6import { flushTests, setAccessTokensToServers } from '../../../../shared/extra-utils/index' 6import { flushTests, setAccessTokensToServers } from '../../../../shared/extra-utils/index'
7import { VideoDetails } from '../../../../shared/models/videos' 7import { VideoDetails } from '../../../../shared/models/videos'
8import * as WebTorrent from 'webtorrent' 8import * as WebTorrent from 'webtorrent'
@@ -14,9 +14,7 @@ describe('Test tracker', function () {
14 14
15 before(async function () { 15 before(async function () {
16 this.timeout(60000) 16 this.timeout(60000)
17 17 server = await flushAndRunServer(1)
18 await flushTests()
19 server = await runServer(1)
20 await setAccessTokensToServers([ server ]) 18 await setAccessTokensToServers([ server ])
21 19
22 { 20 {
@@ -84,7 +82,7 @@ describe('Test tracker', function () {
84 }) 82 })
85 }) 83 })
86 84
87 after(async function () { 85 after(function () {
88 killallServers([ server ]) 86 killallServers([ server ])
89 }) 87 })
90}) 88})
diff --git a/server/tests/api/users/blocklist.ts b/server/tests/api/users/blocklist.ts
index cd96ffe2a..34eabf2e6 100644
--- a/server/tests/api/users/blocklist.ts
+++ b/server/tests/api/users/blocklist.ts
@@ -79,8 +79,6 @@ describe('Test blocklist', function () {
79 before(async function () { 79 before(async function () {
80 this.timeout(60000) 80 this.timeout(60000)
81 81
82 await flushTests()
83
84 servers = await flushAndRunMultipleServers(2) 82 servers = await flushAndRunMultipleServers(2)
85 await setAccessTokensToServers(servers) 83 await setAccessTokensToServers(servers)
86 84
@@ -500,12 +498,7 @@ describe('Test blocklist', function () {
500 }) 498 })
501 }) 499 })
502 500
503 after(async function () { 501 after(function () {
504 killallServers(servers) 502 killallServers(servers)
505
506 // Keep the logs if the test failed
507 if (this[ 'ok' ]) {
508 await flushTests()
509 }
510 }) 503 })
511}) 504})
diff --git a/server/tests/api/users/user-subscriptions.ts b/server/tests/api/users/user-subscriptions.ts
index 5be185678..ee5abd6b7 100644
--- a/server/tests/api/users/user-subscriptions.ts
+++ b/server/tests/api/users/user-subscriptions.ts
@@ -368,7 +368,7 @@ describe('Test users subscriptions', function () {
368 } 368 }
369 }) 369 })
370 370
371 after(async function () { 371 after(function () {
372 killallServers(servers) 372 killallServers(servers)
373 }) 373 })
374}) 374})
diff --git a/server/tests/api/users/users-multiple-servers.ts b/server/tests/api/users/users-multiple-servers.ts
index 9b8db0072..7097d90d1 100644
--- a/server/tests/api/users/users-multiple-servers.ts
+++ b/server/tests/api/users/users-multiple-servers.ts
@@ -235,7 +235,7 @@ describe('Test users with multiple servers', function () {
235 } 235 }
236 }) 236 })
237 237
238 after(async function () { 238 after(function () {
239 killallServers(servers) 239 killallServers(servers)
240 }) 240 })
241}) 241})
diff --git a/server/tests/api/users/users-verification.ts b/server/tests/api/users/users-verification.ts
index 7fcd3e50b..295caae97 100644
--- a/server/tests/api/users/users-verification.ts
+++ b/server/tests/api/users/users-verification.ts
@@ -4,7 +4,7 @@ import * as chai from 'chai'
4import 'mocha' 4import 'mocha'
5import { 5import {
6 registerUser, flushTests, getUserInformation, getMyUserInformation, killallServers, 6 registerUser, flushTests, getUserInformation, getMyUserInformation, killallServers,
7 userLogin, login, runServer, ServerInfo, verifyEmail, updateCustomSubConfig, wait 7 userLogin, login, flushAndRunServer, ServerInfo, verifyEmail, updateCustomSubConfig, wait
8} from '../../../../shared/extra-utils' 8} from '../../../../shared/extra-utils'
9import { setAccessTokensToServers } from '../../../../shared/extra-utils/users/login' 9import { setAccessTokensToServers } from '../../../../shared/extra-utils/users/login'
10import { MockSmtpServer } from '../../../../shared/extra-utils/miscs/email' 10import { MockSmtpServer } from '../../../../shared/extra-utils/miscs/email'
@@ -32,14 +32,12 @@ describe('Test users account verification', function () {
32 32
33 await MockSmtpServer.Instance.collectEmails(emails) 33 await MockSmtpServer.Instance.collectEmails(emails)
34 34
35 await flushTests()
36
37 const overrideConfig = { 35 const overrideConfig = {
38 smtp: { 36 smtp: {
39 hostname: 'localhost' 37 hostname: 'localhost'
40 } 38 }
41 } 39 }
42 server = await runServer(1, overrideConfig) 40 server = await flushAndRunServer(1, overrideConfig)
43 41
44 await setAccessTokensToServers([ server ]) 42 await setAccessTokensToServers([ server ])
45 }) 43 })
@@ -122,13 +120,8 @@ describe('Test users account verification', function () {
122 await userLogin(server, user2) 120 await userLogin(server, user2)
123 }) 121 })
124 122
125 after(async function () { 123 after(function () {
126 MockSmtpServer.Instance.kill() 124 MockSmtpServer.Instance.kill()
127 killallServers([ server ]) 125 killallServers([ server ])
128
129 // Keep the logs if the test failed
130 if (this[ 'ok' ]) {
131 await flushTests()
132 }
133 }) 126 })
134}) 127})
diff --git a/server/tests/api/users/users.ts b/server/tests/api/users/users.ts
index 472ff511c..8efff12ad 100644
--- a/server/tests/api/users/users.ts
+++ b/server/tests/api/users/users.ts
@@ -24,7 +24,7 @@ import {
24 registerUser, 24 registerUser,
25 removeUser, 25 removeUser,
26 removeVideo, 26 removeVideo,
27 runServer, 27 flushAndRunServer,
28 ServerInfo, 28 ServerInfo,
29 testImage, 29 testImage,
30 unblockUser, 30 unblockUser,
@@ -54,9 +54,7 @@ describe('Test users', function () {
54 54
55 before(async function () { 55 before(async function () {
56 this.timeout(30000) 56 this.timeout(30000)
57 57 server = await flushAndRunServer(1)
58 await flushTests()
59 server = await runServer(1)
60 58
61 await setAccessTokensToServers([ server ]) 59 await setAccessTokensToServers([ server ])
62 }) 60 })
@@ -679,12 +677,7 @@ describe('Test users', function () {
679 }) 677 })
680 }) 678 })
681 679
682 after(async function () { 680 after(function () {
683 killallServers([ server ]) 681 killallServers([ server ])
684
685 // Keep the logs if the test failed
686 if (this[ 'ok' ]) {
687 await flushTests()
688 }
689 }) 682 })
690}) 683})
diff --git a/server/tests/api/videos/multiple-servers.ts b/server/tests/api/videos/multiple-servers.ts
index dd50f905d..50b231555 100644
--- a/server/tests/api/videos/multiple-servers.ts
+++ b/server/tests/api/videos/multiple-servers.ts
@@ -1029,12 +1029,7 @@ describe('Test multiple servers', function () {
1029 }) 1029 })
1030 }) 1030 })
1031 1031
1032 after(async function () { 1032 after(function () {
1033 killallServers(servers) 1033 killallServers(servers)
1034
1035 // Keep the logs if the test failed
1036 if (this['ok']) {
1037 await flushTests()
1038 }
1039 }) 1034 })
1040}) 1035})
diff --git a/server/tests/api/videos/services.ts b/server/tests/api/videos/services.ts
index e79ce59a6..1397347d1 100644
--- a/server/tests/api/videos/services.ts
+++ b/server/tests/api/videos/services.ts
@@ -11,7 +11,7 @@ import {
11 setAccessTokensToServers, 11 setAccessTokensToServers,
12 uploadVideo 12 uploadVideo
13} from '../../../../shared/extra-utils/index' 13} from '../../../../shared/extra-utils/index'
14import { runServer } from '../../../../shared/extra-utils/server/servers' 14import { flushAndRunServer } from '../../../../shared/extra-utils/server/servers'
15 15
16const expect = chai.expect 16const expect = chai.expect
17 17
@@ -21,9 +21,7 @@ describe('Test services', function () {
21 before(async function () { 21 before(async function () {
22 this.timeout(30000) 22 this.timeout(30000)
23 23
24 await flushTests() 24 server = await flushAndRunServer(1)
25
26 server = await runServer(1)
27 25
28 await setAccessTokensToServers([ server ]) 26 await setAccessTokensToServers([ server ])
29 27
@@ -76,7 +74,7 @@ describe('Test services', function () {
76 expect(res.body).to.not.have.property('thumbnail_height') 74 expect(res.body).to.not.have.property('thumbnail_height')
77 }) 75 })
78 76
79 after(async function () { 77 after(function () {
80 killallServers([ server ]) 78 killallServers([ server ])
81 }) 79 })
82}) 80})
diff --git a/server/tests/api/videos/single-server.ts b/server/tests/api/videos/single-server.ts
index ea3e7c421..db2a3779f 100644
--- a/server/tests/api/videos/single-server.ts
+++ b/server/tests/api/videos/single-server.ts
@@ -20,7 +20,7 @@ import {
20 killallServers, 20 killallServers,
21 rateVideo, 21 rateVideo,
22 removeVideo, 22 removeVideo,
23 runServer, 23 flushAndRunServer,
24 ServerInfo, 24 ServerInfo,
25 setAccessTokensToServers, 25 setAccessTokensToServers,
26 testImage, 26 testImage,
@@ -107,9 +107,7 @@ describe('Test a single server', function () {
107 before(async function () { 107 before(async function () {
108 this.timeout(30000) 108 this.timeout(30000)
109 109
110 await flushTests() 110 server = await flushAndRunServer(1)
111
112 server = await runServer(1)
113 111
114 await setAccessTokensToServers([ server ]) 112 await setAccessTokensToServers([ server ])
115 }) 113 })
@@ -426,12 +424,7 @@ describe('Test a single server', function () {
426 expect(video.dislikes).to.equal(1) 424 expect(video.dislikes).to.equal(1)
427 }) 425 })
428 426
429 after(async function () { 427 after(function () {
430 killallServers([ server ]) 428 killallServers([ server ])
431
432 // Keep the logs if the test failed
433 if (this['ok']) {
434 await flushTests()
435 }
436 }) 429 })
437}) 430})
diff --git a/server/tests/api/videos/video-abuse.ts b/server/tests/api/videos/video-abuse.ts
index 2ae1bf34d..06bb31348 100644
--- a/server/tests/api/videos/video-abuse.ts
+++ b/server/tests/api/videos/video-abuse.ts
@@ -172,7 +172,7 @@ describe('Test video abuses', function () {
172 expect(res.body.data.length).to.equal(0) 172 expect(res.body.data.length).to.equal(0)
173 }) 173 })
174 174
175 after(async function () { 175 after(function () {
176 killallServers(servers) 176 killallServers(servers)
177 }) 177 })
178}) 178})
diff --git a/server/tests/api/videos/video-blacklist.ts b/server/tests/api/videos/video-blacklist.ts
index 582c82e05..cb15d1a52 100644
--- a/server/tests/api/videos/video-blacklist.ts
+++ b/server/tests/api/videos/video-blacklist.ts
@@ -425,7 +425,7 @@ describe('Test video blacklist', function () {
425 }) 425 })
426 }) 426 })
427 427
428 after(async function () { 428 after(function () {
429 killallServers(servers) 429 killallServers(servers)
430 }) 430 })
431}) 431})
diff --git a/server/tests/api/videos/video-captions.ts b/server/tests/api/videos/video-captions.ts
index da920e00c..c6f59762a 100644
--- a/server/tests/api/videos/video-captions.ts
+++ b/server/tests/api/videos/video-captions.ts
@@ -29,8 +29,6 @@ describe('Test video captions', function () {
29 before(async function () { 29 before(async function () {
30 this.timeout(30000) 30 this.timeout(30000)
31 31
32 await flushTests()
33
34 servers = await flushAndRunMultipleServers(2) 32 servers = await flushAndRunMultipleServers(2)
35 33
36 await setAccessTokensToServers(servers) 34 await setAccessTokensToServers(servers)
@@ -197,7 +195,7 @@ describe('Test video captions', function () {
197 await checkVideoFilesWereRemoved(videoUUID, 1) 195 await checkVideoFilesWereRemoved(videoUUID, 1)
198 }) 196 })
199 197
200 after(async function () { 198 after(function () {
201 killallServers(servers) 199 killallServers(servers)
202 }) 200 })
203}) 201})
diff --git a/server/tests/api/videos/video-change-ownership.ts b/server/tests/api/videos/video-change-ownership.ts
index 9040ac308..db1220677 100644
--- a/server/tests/api/videos/video-change-ownership.ts
+++ b/server/tests/api/videos/video-change-ownership.ts
@@ -5,19 +5,20 @@ import 'mocha'
5import { 5import {
6 acceptChangeOwnership, 6 acceptChangeOwnership,
7 changeVideoOwnership, 7 changeVideoOwnership,
8 createUser, doubleFollow, flushAndRunMultipleServers, 8 createUser,
9 flushTests, 9 doubleFollow,
10 flushAndRunMultipleServers,
11 flushAndRunServer,
10 getMyUserInformation, 12 getMyUserInformation,
13 getVideo,
11 getVideoChangeOwnershipList, 14 getVideoChangeOwnershipList,
12 getVideosList, 15 getVideosList,
13 killallServers, 16 killallServers,
14 refuseChangeOwnership, 17 refuseChangeOwnership,
15 runServer,
16 ServerInfo, 18 ServerInfo,
17 setAccessTokensToServers, 19 setAccessTokensToServers,
18 uploadVideo, 20 uploadVideo,
19 userLogin, 21 userLogin
20 getVideo
21} from '../../../../shared/extra-utils' 22} from '../../../../shared/extra-utils'
22import { waitJobs } from '../../../../shared/extra-utils/server/jobs' 23import { waitJobs } from '../../../../shared/extra-utils/server/jobs'
23import { User } from '../../../../shared/models/users' 24import { User } from '../../../../shared/models/users'
@@ -202,7 +203,7 @@ describe('Test video change ownership - nominal', function () {
202 } 203 }
203 }) 204 })
204 205
205 after(async function () { 206 after(function () {
206 killallServers(servers) 207 killallServers(servers)
207 }) 208 })
208}) 209})
@@ -225,8 +226,7 @@ describe('Test video change ownership - quota too small', function () {
225 this.timeout(50000) 226 this.timeout(50000)
226 227
227 // Run one server 228 // Run one server
228 await flushTests() 229 server = await flushAndRunServer(1)
229 server = await runServer(1)
230 await setAccessTokensToServers([server]) 230 await setAccessTokensToServers([server])
231 231
232 const videoQuota = 42000000 232 const videoQuota = 42000000
@@ -297,7 +297,7 @@ describe('Test video change ownership - quota too small', function () {
297 await acceptChangeOwnership(server.url, secondUserAccessToken, lastRequestChangeOwnershipId, channelId, 403) 297 await acceptChangeOwnership(server.url, secondUserAccessToken, lastRequestChangeOwnershipId, channelId, 403)
298 }) 298 })
299 299
300 after(async function () { 300 after(function () {
301 killallServers([server]) 301 killallServers([server])
302 }) 302 })
303}) 303})
diff --git a/server/tests/api/videos/video-channels.ts b/server/tests/api/videos/video-channels.ts
index e30e6bb4f..60b84e443 100644
--- a/server/tests/api/videos/video-channels.ts
+++ b/server/tests/api/videos/video-channels.ts
@@ -42,8 +42,6 @@ describe('Test video channels', function () {
42 before(async function () { 42 before(async function () {
43 this.timeout(30000) 43 this.timeout(30000)
44 44
45 await flushTests()
46
47 servers = await flushAndRunMultipleServers(2) 45 servers = await flushAndRunMultipleServers(2)
48 46
49 await setAccessTokensToServers(servers) 47 await setAccessTokensToServers(servers)
@@ -279,7 +277,7 @@ describe('Test video channels', function () {
279 } 277 }
280 }) 278 })
281 279
282 after(async function () { 280 after(function () {
283 killallServers(servers) 281 killallServers(servers)
284 }) 282 })
285}) 283})
diff --git a/server/tests/api/videos/video-comments.ts b/server/tests/api/videos/video-comments.ts
index abf4d0c44..50224ee47 100644
--- a/server/tests/api/videos/video-comments.ts
+++ b/server/tests/api/videos/video-comments.ts
@@ -8,7 +8,7 @@ import {
8 dateIsValid, 8 dateIsValid,
9 flushTests, 9 flushTests,
10 killallServers, 10 killallServers,
11 runServer, 11 flushAndRunServer,
12 ServerInfo, 12 ServerInfo,
13 setAccessTokensToServers, 13 setAccessTokensToServers,
14 updateMyAvatar, 14 updateMyAvatar,
@@ -34,9 +34,7 @@ describe('Test video comments', function () {
34 before(async function () { 34 before(async function () {
35 this.timeout(30000) 35 this.timeout(30000)
36 36
37 await flushTests() 37 server = await flushAndRunServer(1)
38
39 server = await runServer(1)
40 38
41 await setAccessTokensToServers([ server ]) 39 await setAccessTokensToServers([ server ])
42 40
@@ -201,7 +199,7 @@ describe('Test video comments', function () {
201 expect(res.body.data[1].totalReplies).to.equal(0) 199 expect(res.body.data[1].totalReplies).to.equal(0)
202 }) 200 })
203 201
204 after(async function () { 202 after(function () {
205 killallServers([ server ]) 203 killallServers([ server ])
206 }) 204 })
207}) 205})
diff --git a/server/tests/api/videos/video-description.ts b/server/tests/api/videos/video-description.ts
index 0c03d17d8..333d539f4 100644
--- a/server/tests/api/videos/video-description.ts
+++ b/server/tests/api/videos/video-description.ts
@@ -99,7 +99,7 @@ describe('Test video description', function () {
99 } 99 }
100 }) 100 })
101 101
102 after(async function () { 102 after(function () {
103 killallServers(servers) 103 killallServers(servers)
104 }) 104 })
105}) 105})
diff --git a/server/tests/api/videos/video-hls.ts b/server/tests/api/videos/video-hls.ts
index a9251406a..0ac84a656 100644
--- a/server/tests/api/videos/video-hls.ts
+++ b/server/tests/api/videos/video-hls.ts
@@ -128,12 +128,7 @@ describe('Test HLS videos', function () {
128 } 128 }
129 }) 129 })
130 130
131 after(async function () { 131 after(function () {
132 killallServers(servers) 132 killallServers(servers)
133
134 // Keep the logs if the test failed
135 if (this['ok']) {
136 await flushTests()
137 }
138 }) 133 })
139}) 134})
diff --git a/server/tests/api/videos/video-imports.ts b/server/tests/api/videos/video-imports.ts
index f8b2c0407..49a28e207 100644
--- a/server/tests/api/videos/video-imports.ts
+++ b/server/tests/api/videos/video-imports.ts
@@ -241,7 +241,7 @@ describe('Test video imports', function () {
241 } 241 }
242 }) 242 })
243 243
244 after(async function () { 244 after(function () {
245 killallServers(servers) 245 killallServers(servers)
246 }) 246 })
247}) 247})
diff --git a/server/tests/api/videos/video-nsfw.ts b/server/tests/api/videos/video-nsfw.ts
index 9f2d99ffe..811705212 100644
--- a/server/tests/api/videos/video-nsfw.ts
+++ b/server/tests/api/videos/video-nsfw.ts
@@ -20,7 +20,7 @@ import {
20 getMyUserInformation, 20 getMyUserInformation,
21 getVideoChannelVideos, 21 getVideoChannelVideos,
22 getVideosListWithToken, 22 getVideosListWithToken,
23 runServer, 23 flushAndRunServer,
24 searchVideo, 24 searchVideo,
25 searchVideoWithToken, 25 searchVideoWithToken,
26 updateCustomConfig, 26 updateCustomConfig,
@@ -64,9 +64,7 @@ describe('Test video NSFW policy', function () {
64 64
65 before(async function () { 65 before(async function () {
66 this.timeout(50000) 66 this.timeout(50000)
67 67 server = await flushAndRunServer(1)
68 await flushTests()
69 server = await runServer(1)
70 68
71 // Get the access tokens 69 // Get the access tokens
72 await setAccessTokensToServers([ server ]) 70 await setAccessTokensToServers([ server ])
@@ -243,7 +241,7 @@ describe('Test video NSFW policy', function () {
243 }) 241 })
244 }) 242 })
245 243
246 after(async function () { 244 after(function () {
247 killallServers([ server ]) 245 killallServers([ server ])
248 }) 246 })
249}) 247})
diff --git a/server/tests/api/videos/video-playlists.ts b/server/tests/api/videos/video-playlists.ts
index 8c3542906..ea349f09b 100644
--- a/server/tests/api/videos/video-playlists.ts
+++ b/server/tests/api/videos/video-playlists.ts
@@ -860,12 +860,7 @@ describe('Test video playlists', function () {
860 } 860 }
861 }) 861 })
862 862
863 after(async function () { 863 after(function () {
864 killallServers(servers) 864 killallServers(servers)
865
866 // Keep the logs if the test failed
867 if (this['ok']) {
868 await flushTests()
869 }
870 }) 865 })
871}) 866})
diff --git a/server/tests/api/videos/video-privacy.ts b/server/tests/api/videos/video-privacy.ts
index ba5e0f044..a823993b2 100644
--- a/server/tests/api/videos/video-privacy.ts
+++ b/server/tests/api/videos/video-privacy.ts
@@ -152,7 +152,7 @@ describe('Test video privacy', function () {
152 } 152 }
153 }) 153 })
154 154
155 after(async function () { 155 after(function () {
156 killallServers(servers) 156 killallServers(servers)
157 }) 157 })
158}) 158})
diff --git a/server/tests/api/videos/video-schedule-update.ts b/server/tests/api/videos/video-schedule-update.ts
index b19a9116a..d7301a137 100644
--- a/server/tests/api/videos/video-schedule-update.ts
+++ b/server/tests/api/videos/video-schedule-update.ts
@@ -165,7 +165,7 @@ describe('Test video update scheduler', function () {
165 } 165 }
166 }) 166 })
167 167
168 after(async function () { 168 after(function () {
169 killallServers(servers) 169 killallServers(servers)
170 }) 170 })
171}) 171})
diff --git a/server/tests/api/videos/video-transcoder.ts b/server/tests/api/videos/video-transcoder.ts
index 3d4739ca9..92888f137 100644
--- a/server/tests/api/videos/video-transcoder.ts
+++ b/server/tests/api/videos/video-transcoder.ts
@@ -349,7 +349,7 @@ describe('Test video transcoding', function () {
349 } 349 }
350 }) 350 })
351 351
352 after(async function () { 352 after(function () {
353 killallServers(servers) 353 killallServers(servers)
354 }) 354 })
355}) 355})
diff --git a/server/tests/api/videos/videos-filter.ts b/server/tests/api/videos/videos-filter.ts
index 36664b17f..179610595 100644
--- a/server/tests/api/videos/videos-filter.ts
+++ b/server/tests/api/videos/videos-filter.ts
@@ -55,8 +55,6 @@ describe('Test videos filter validator', function () {
55 before(async function () { 55 before(async function () {
56 this.timeout(120000) 56 this.timeout(120000)
57 57
58 await flushTests()
59
60 servers = await flushAndRunMultipleServers(2) 58 servers = await flushAndRunMultipleServers(2)
61 59
62 await setAccessTokensToServers(servers) 60 await setAccessTokensToServers(servers)
@@ -121,12 +119,7 @@ describe('Test videos filter validator', function () {
121 }) 119 })
122 }) 120 })
123 121
124 after(async function () { 122 after(function () {
125 killallServers(servers) 123 killallServers(servers)
126
127 // Keep the logs if the test failed
128 if (this['ok']) {
129 await flushTests()
130 }
131 }) 124 })
132}) 125})
diff --git a/server/tests/api/videos/videos-history.ts b/server/tests/api/videos/videos-history.ts
index 6f75ce42c..2a904c659 100644
--- a/server/tests/api/videos/videos-history.ts
+++ b/server/tests/api/videos/videos-history.ts
@@ -8,7 +8,7 @@ import {
8 getVideosListWithToken, 8 getVideosListWithToken,
9 getVideoWithToken, 9 getVideoWithToken,
10 killallServers, reRunServer, 10 killallServers, reRunServer,
11 runServer, 11 flushAndRunServer,
12 searchVideoWithToken, 12 searchVideoWithToken,
13 ServerInfo, 13 ServerInfo,
14 setAccessTokensToServers, 14 setAccessTokensToServers,
@@ -33,9 +33,7 @@ describe('Test videos history', function () {
33 before(async function () { 33 before(async function () {
34 this.timeout(30000) 34 this.timeout(30000)
35 35
36 await flushTests() 36 server = await flushAndRunServer(1)
37
38 server = await runServer(1)
39 37
40 await setAccessTokensToServers([ server ]) 38 await setAccessTokensToServers([ server ])
41 39
@@ -222,12 +220,7 @@ describe('Test videos history', function () {
222 expect(res.body.total).to.equal(0) 220 expect(res.body.total).to.equal(0)
223 }) 221 })
224 222
225 after(async function () { 223 after(function () {
226 killallServers([ server ]) 224 killallServers([ server ])
227
228 // Keep the logs if the test failed
229 if (this['ok']) {
230 await flushTests()
231 }
232 }) 225 })
233}) 226})
diff --git a/server/tests/api/videos/videos-overview.ts b/server/tests/api/videos/videos-overview.ts
index 233ca8a5d..c921eb74d 100644
--- a/server/tests/api/videos/videos-overview.ts
+++ b/server/tests/api/videos/videos-overview.ts
@@ -2,7 +2,7 @@
2 2
3import * as chai from 'chai' 3import * as chai from 'chai'
4import 'mocha' 4import 'mocha'
5import { flushTests, killallServers, runServer, ServerInfo, setAccessTokensToServers, uploadVideo } from '../../../../shared/extra-utils' 5import { flushTests, killallServers, flushAndRunServer, ServerInfo, setAccessTokensToServers, uploadVideo } from '../../../../shared/extra-utils'
6import { getVideosOverview } from '../../../../shared/extra-utils/overviews/overviews' 6import { getVideosOverview } from '../../../../shared/extra-utils/overviews/overviews'
7import { VideosOverview } from '../../../../shared/models/overviews' 7import { VideosOverview } from '../../../../shared/models/overviews'
8 8
@@ -14,9 +14,7 @@ describe('Test a videos overview', function () {
14 before(async function () { 14 before(async function () {
15 this.timeout(30000) 15 this.timeout(30000)
16 16
17 await flushTests() 17 server = await flushAndRunServer(1)
18
19 server = await runServer(1)
20 18
21 await setAccessTokensToServers([ server ]) 19 await setAccessTokensToServers([ server ])
22 }) 20 })
@@ -89,12 +87,7 @@ describe('Test a videos overview', function () {
89 expect(overview.channels[0].channel.name).to.equal('root_channel') 87 expect(overview.channels[0].channel.name).to.equal('root_channel')
90 }) 88 })
91 89
92 after(async function () { 90 after(function () {
93 killallServers([ server ]) 91 killallServers([ server ])
94
95 // Keep the logs if the test failed
96 if (this['ok']) {
97 await flushTests()
98 }
99 }) 92 })
100}) 93})
diff --git a/server/tests/api/videos/videos-views-cleaner.ts b/server/tests/api/videos/videos-views-cleaner.ts
index 4001969c3..80cecdd23 100644
--- a/server/tests/api/videos/videos-views-cleaner.ts
+++ b/server/tests/api/videos/videos-views-cleaner.ts
@@ -7,7 +7,7 @@ import {
7 flushTests, 7 flushTests,
8 killallServers, 8 killallServers,
9 reRunServer, 9 reRunServer,
10 runServer, 10 flushAndRunServer,
11 ServerInfo, 11 ServerInfo,
12 setAccessTokensToServers, 12 setAccessTokensToServers,
13 uploadVideo, uploadVideoAndGetId, viewVideo, wait, countVideoViewsOf, doubleFollow, waitJobs 13 uploadVideo, uploadVideoAndGetId, viewVideo, wait, countVideoViewsOf, doubleFollow, waitJobs
@@ -27,8 +27,6 @@ describe('Test video views cleaner', function () {
27 before(async function () { 27 before(async function () {
28 this.timeout(50000) 28 this.timeout(50000)
29 29
30 await flushTests()
31
32 servers = await flushAndRunMultipleServers(2) 30 servers = await flushAndRunMultipleServers(2)
33 await setAccessTokensToServers(servers) 31 await setAccessTokensToServers(servers)
34 32
@@ -102,12 +100,7 @@ describe('Test video views cleaner', function () {
102 } 100 }
103 }) 101 })
104 102
105 after(async function () { 103 after(function () {
106 killallServers(servers) 104 killallServers(servers)
107
108 // Keep the logs if the test failed
109 if (this['ok']) {
110 await flushTests()
111 }
112 }) 105 })
113}) 106})
diff --git a/server/tests/cli/create-import-video-file-job.ts b/server/tests/cli/create-import-video-file-job.ts
index 4dc12a1c6..191d4b460 100644
--- a/server/tests/cli/create-import-video-file-job.ts
+++ b/server/tests/cli/create-import-video-file-job.ts
@@ -39,7 +39,6 @@ describe('Test create import video jobs', function () {
39 39
40 before(async function () { 40 before(async function () {
41 this.timeout(90000) 41 this.timeout(90000)
42 await flushTests()
43 42
44 // Run server 2 to have transcoding enabled 43 // Run server 2 to have transcoding enabled
45 servers = await flushAndRunMultipleServers(2) 44 servers = await flushAndRunMultipleServers(2)
@@ -131,7 +130,7 @@ describe('Test create import video jobs', function () {
131 } 130 }
132 }) 131 })
133 132
134 after(async function () { 133 after(function () {
135 killallServers(servers) 134 killallServers(servers)
136 }) 135 })
137}) 136})
diff --git a/server/tests/cli/create-transcoding-job.ts b/server/tests/cli/create-transcoding-job.ts
index bd1de2079..61c310bc3 100644
--- a/server/tests/cli/create-transcoding-job.ts
+++ b/server/tests/cli/create-transcoding-job.ts
@@ -28,8 +28,6 @@ describe('Test create transcoding jobs', function () {
28 before(async function () { 28 before(async function () {
29 this.timeout(60000) 29 this.timeout(60000)
30 30
31 await flushTests()
32
33 // Run server 2 to have transcoding enabled 31 // Run server 2 to have transcoding enabled
34 servers = await flushAndRunMultipleServers(2) 32 servers = await flushAndRunMultipleServers(2)
35 await setAccessTokensToServers(servers) 33 await setAccessTokensToServers(servers)
@@ -126,7 +124,7 @@ describe('Test create transcoding jobs', function () {
126 } 124 }
127 }) 125 })
128 126
129 after(async function () { 127 after(function () {
130 killallServers(servers) 128 killallServers(servers)
131 }) 129 })
132}) 130})
diff --git a/server/tests/cli/optimize-old-videos.ts b/server/tests/cli/optimize-old-videos.ts
index b3724476b..14625f8c0 100644
--- a/server/tests/cli/optimize-old-videos.ts
+++ b/server/tests/cli/optimize-old-videos.ts
@@ -31,8 +31,6 @@ describe('Test optimize old videos', function () {
31 before(async function () { 31 before(async function () {
32 this.timeout(200000) 32 this.timeout(200000)
33 33
34 await flushTests()
35
36 // Run server 2 to have transcoding enabled 34 // Run server 2 to have transcoding enabled
37 servers = await flushAndRunMultipleServers(2) 35 servers = await flushAndRunMultipleServers(2)
38 await setAccessTokensToServers(servers) 36 await setAccessTokensToServers(servers)
@@ -114,7 +112,7 @@ describe('Test optimize old videos', function () {
114 } 112 }
115 }) 113 })
116 114
117 after(async function () { 115 after(function () {
118 killallServers(servers) 116 killallServers(servers)
119 }) 117 })
120}) 118})
diff --git a/server/tests/cli/peertube.ts b/server/tests/cli/peertube.ts
index 45411bdbc..0c11945e0 100644
--- a/server/tests/cli/peertube.ts
+++ b/server/tests/cli/peertube.ts
@@ -8,7 +8,7 @@ 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
14} from '../../../shared/extra-utils' 14} from '../../../shared/extra-utils'
@@ -19,9 +19,7 @@ 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({ url: server.url, accessToken: server.accessToken, username: 'user_1', password: 'super password' }) 25 await createUser({ url: server.url, accessToken: server.accessToken, username: 'user_1', password: 'super password' })
diff --git a/server/tests/cli/reset-password.ts b/server/tests/cli/reset-password.ts
index 3c56bf45b..1d6423814 100644
--- a/server/tests/cli/reset-password.ts
+++ b/server/tests/cli/reset-password.ts
@@ -7,7 +7,7 @@ import {
7 getEnvCli, 7 getEnvCli,
8 killallServers, 8 killallServers,
9 login, 9 login,
10 runServer, 10 flushAndRunServer,
11 ServerInfo, 11 ServerInfo,
12 setAccessTokensToServers 12 setAccessTokensToServers
13} from '../../../shared/extra-utils' 13} from '../../../shared/extra-utils'
@@ -17,9 +17,7 @@ describe('Test reset password scripts', function () {
17 17
18 before(async function () { 18 before(async function () {
19 this.timeout(30000) 19 this.timeout(30000)
20 20 server = await flushAndRunServer(1)
21 await flushTests()
22 server = await runServer(1)
23 await setAccessTokensToServers([ server ]) 21 await setAccessTokensToServers([ server ])
24 22
25 await createUser({ url: server.url, accessToken: server.accessToken, username: 'user_1', password: 'super password' }) 23 await createUser({ url: server.url, accessToken: server.accessToken, username: 'user_1', password: 'super password' })
@@ -34,7 +32,7 @@ describe('Test reset password scripts', function () {
34 await login(server.url, server.client, { username: 'user_1', password: 'coucou' }, 200) 32 await login(server.url, server.client, { username: 'user_1', password: 'coucou' }, 200)
35 }) 33 })
36 34
37 after(async function () { 35 after(function () {
38 killallServers([ server ]) 36 killallServers([ server ])
39 }) 37 })
40}) 38})
diff --git a/server/tests/cli/update-host.ts b/server/tests/cli/update-host.ts
index 2270ff494..dd594779b 100644
--- a/server/tests/cli/update-host.ts
+++ b/server/tests/cli/update-host.ts
@@ -17,7 +17,7 @@ import {
17 killallServers, 17 killallServers,
18 makeActivityPubGetRequest, 18 makeActivityPubGetRequest,
19 parseTorrentVideo, 19 parseTorrentVideo,
20 runServer, 20 flushAndRunServer,
21 ServerInfo, 21 ServerInfo,
22 setAccessTokensToServers, 22 setAccessTokensToServers,
23 uploadVideo 23 uploadVideo
@@ -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
@@ -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 server = await flushAndRunServer(2)
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`)
@@ -148,7 +146,7 @@ describe('Test update host scripts', function () {
148 } 146 }
149 }) 147 })
150 148
151 after(async function () { 149 after(function () {
152 killallServers([ server ]) 150 killallServers([ server ])
153 }) 151 })
154}) 152})
diff --git a/server/tests/client.ts b/server/tests/client.ts
index 116189510..cdf0ce2ce 100644
--- a/server/tests/client.ts
+++ b/server/tests/client.ts
@@ -9,7 +9,7 @@ import {
9 getVideosList, 9 getVideosList,
10 killallServers, 10 killallServers,
11 makeHTMLRequest, 11 makeHTMLRequest,
12 runServer, 12 flushAndRunServer,
13 ServerInfo, 13 ServerInfo,
14 serverLogin, 14 serverLogin,
15 updateCustomConfig, 15 updateCustomConfig,
@@ -31,9 +31,7 @@ describe('Test a client controllers', function () {
31 before(async function () { 31 before(async function () {
32 this.timeout(120000) 32 this.timeout(120000)
33 33
34 await flushTests() 34 server = await flushAndRunServer(1)
35
36 server = await runServer(1)
37 server.accessToken = await serverLogin(server) 35 server.accessToken = await serverLogin(server)
38 36
39 const videoAttributes = { 37 const videoAttributes = {
@@ -147,7 +145,7 @@ describe('Test a client controllers', function () {
147 checkIndexTags(res.text, 'PeerTube updated', 'my short description', 'body { background-color: red; }') 145 checkIndexTags(res.text, 'PeerTube updated', 'my short description', 'body { background-color: red; }')
148 }) 146 })
149 147
150 after(async function () { 148 after(function () {
151 killallServers([ server ]) 149 killallServers([ server ])
152 }) 150 })
153}) 151})
diff --git a/server/tests/feeds/feeds.ts b/server/tests/feeds/feeds.ts
index 0e9ea1a18..fc6543474 100644
--- a/server/tests/feeds/feeds.ts
+++ b/server/tests/feeds/feeds.ts
@@ -207,12 +207,7 @@ describe('Test syndication feeds', () => {
207 }) 207 })
208 }) 208 })
209 209
210 after(async function () { 210 after(function () {
211 killallServers(servers) 211 killallServers(servers)
212
213 // Keep the logs if the test failed
214 if (this['ok']) {
215 await flushTests()
216 }
217 }) 212 })
218}) 213})
diff --git a/server/tests/misc-endpoints.ts b/server/tests/misc-endpoints.ts
index d78b62d60..d5c7d9dd4 100644
--- a/server/tests/misc-endpoints.ts
+++ b/server/tests/misc-endpoints.ts
@@ -8,7 +8,7 @@ import {
8 flushTests, 8 flushTests,
9 killallServers, 9 killallServers,
10 makeGetRequest, 10 makeGetRequest,
11 runServer, 11 flushAndRunServer,
12 ServerInfo, 12 ServerInfo,
13 setAccessTokensToServers, 13 setAccessTokensToServers,
14 uploadVideo 14 uploadVideo
@@ -23,9 +23,7 @@ describe('Test misc endpoints', function () {
23 before(async function () { 23 before(async function () {
24 this.timeout(120000) 24 this.timeout(120000)
25 25
26 await flushTests() 26 server = await flushAndRunServer(1)
27
28 server = await runServer(1)
29 await setAccessTokensToServers([ server ]) 27 await setAccessTokensToServers([ server ])
30 }) 28 })
31 29
@@ -173,7 +171,7 @@ describe('Test misc endpoints', function () {
173 }) 171 })
174 }) 172 })
175 173
176 after(async function () { 174 after(function () {
177 killallServers([ server ]) 175 killallServers([ server ])
178 }) 176 })
179}) 177})
diff --git a/server/tests/real-world/populate-database.ts b/server/tests/real-world/populate-database.ts
index 459c9cbd8..b1c1688e7 100644
--- a/server/tests/real-world/populate-database.ts
+++ b/server/tests/real-world/populate-database.ts
@@ -6,7 +6,7 @@ import {
6 getVideosList, 6 getVideosList,
7 killallServers, 7 killallServers,
8 rateVideo, 8 rateVideo,
9 runServer, 9 flushAndRunServer,
10 ServerInfo, 10 ServerInfo,
11 setAccessTokensToServers, 11 setAccessTokensToServers,
12 uploadVideo 12 uploadVideo
@@ -19,11 +19,10 @@ start()
19// ---------------------------------------------------------------------------- 19// ----------------------------------------------------------------------------
20 20
21async function start () { 21async function start () {
22 await flushTests()
23 22
24 console.log('Flushed tests.') 23 console.log('Flushed tests.')
25 24
26 const server = await runServer(6) 25 const server = await flushAndRunServer(6)
27 26
28 process.on('exit', async () => { 27 process.on('exit', async () => {
29 killallServers([ server ]) 28 killallServers([ server ])