From 210feb6cc484a6c5c63c98f770de34e223f944cb Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 24 Apr 2019 10:53:40 +0200 Subject: [PATCH] Cleanup tests --- scripts/clean/server/test.sh | 9 +- server/tests/api/activitypub/client.ts | 4 +- server/tests/api/activitypub/fetch.ts | 5 - server/tests/api/activitypub/refresher.ts | 2 +- server/tests/api/activitypub/security.ts | 5 - server/tests/api/check-params/accounts.ts | 13 +-- server/tests/api/check-params/blocklist.ts | 9 +- server/tests/api/check-params/config.ts | 12 +-- server/tests/api/check-params/contact-form.ts | 12 +-- server/tests/api/check-params/debug.ts | 13 +-- server/tests/api/check-params/follows.ts | 12 +-- server/tests/api/check-params/jobs.ts | 13 +-- server/tests/api/check-params/logs.ts | 13 +-- server/tests/api/check-params/redundancy.ts | 8 +- server/tests/api/check-params/search.ts | 13 +-- server/tests/api/check-params/services.ts | 13 +-- .../api/check-params/user-notifications.ts | 13 +-- .../api/check-params/user-subscriptions.ts | 13 +-- server/tests/api/check-params/users.ts | 15 +-- server/tests/api/check-params/video-abuses.ts | 13 +-- .../tests/api/check-params/video-blacklist.ts | 8 +- .../tests/api/check-params/video-captions.ts | 13 +-- .../tests/api/check-params/video-channels.ts | 13 +-- .../tests/api/check-params/video-comments.ts | 13 +-- .../tests/api/check-params/video-imports.ts | 13 +-- .../tests/api/check-params/video-playlists.ts | 13 +-- .../tests/api/check-params/videos-filter.ts | 13 +-- .../tests/api/check-params/videos-history.ts | 13 +-- server/tests/api/check-params/videos.ts | 13 +-- .../api/notifications/user-notifications.ts | 4 +- .../search-activitypub-video-channels.ts | 9 +- .../api/search/search-activitypub-videos.ts | 9 +- server/tests/api/search/search-videos.ts | 13 +-- server/tests/api/server/config.ts | 8 +- server/tests/api/server/contact-form.ts | 8 +- server/tests/api/server/email.ts | 8 +- server/tests/api/server/follow-constraints.ts | 2 +- server/tests/api/server/follows-moderation.ts | 2 +- server/tests/api/server/follows.ts | 2 +- server/tests/api/server/handle-down.ts | 2 +- server/tests/api/server/jobs.ts | 2 +- server/tests/api/server/logs.ts | 8 +- server/tests/api/server/no-client.ts | 13 +-- server/tests/api/server/reverse-proxy.ts | 8 +- server/tests/api/server/stats.ts | 4 +- server/tests/api/server/tracker.ts | 8 +- server/tests/api/users/blocklist.ts | 9 +- server/tests/api/users/user-subscriptions.ts | 2 +- .../tests/api/users/users-multiple-servers.ts | 2 +- server/tests/api/users/users-verification.ts | 13 +-- server/tests/api/users/users.ts | 13 +-- server/tests/api/videos/multiple-servers.ts | 7 +- server/tests/api/videos/services.ts | 8 +- server/tests/api/videos/single-server.ts | 13 +-- server/tests/api/videos/video-abuse.ts | 2 +- server/tests/api/videos/video-blacklist.ts | 2 +- server/tests/api/videos/video-captions.ts | 4 +- .../api/videos/video-change-ownership.ts | 18 ++-- server/tests/api/videos/video-channels.ts | 4 +- server/tests/api/videos/video-comments.ts | 8 +- server/tests/api/videos/video-description.ts | 2 +- server/tests/api/videos/video-hls.ts | 7 +- server/tests/api/videos/video-imports.ts | 2 +- server/tests/api/videos/video-nsfw.ts | 8 +- server/tests/api/videos/video-playlists.ts | 7 +- server/tests/api/videos/video-privacy.ts | 2 +- .../tests/api/videos/video-schedule-update.ts | 2 +- server/tests/api/videos/video-transcoder.ts | 2 +- server/tests/api/videos/videos-filter.ts | 9 +- server/tests/api/videos/videos-history.ts | 13 +-- server/tests/api/videos/videos-overview.ts | 13 +-- .../tests/api/videos/videos-views-cleaner.ts | 11 +-- .../tests/cli/create-import-video-file-job.ts | 3 +- server/tests/cli/create-transcoding-job.ts | 4 +- server/tests/cli/optimize-old-videos.ts | 4 +- server/tests/cli/peertube.ts | 6 +- server/tests/cli/reset-password.ts | 8 +- server/tests/cli/update-host.ts | 10 +- server/tests/client.ts | 8 +- server/tests/feeds/feeds.ts | 7 +- server/tests/misc-endpoints.ts | 8 +- server/tests/real-world/populate-database.ts | 5 +- shared/extra-utils/server/servers.ts | 93 ++++++++++--------- 83 files changed, 230 insertions(+), 541 deletions(-) diff --git a/scripts/clean/server/test.sh b/scripts/clean/server/test.sh index b897c30ba..5694ac922 100755 --- a/scripts/clean/server/test.sh +++ b/scripts/clean/server/test.sh @@ -21,7 +21,14 @@ dropRedis () { redis-cli KEYS "redis-localhost:900$1*" | grep -v empty | xargs --no-run-if-empty redis-cli DEL } -for i in $(seq 1 6); do +seq=$(seq 1 6) + +if [ ! -z ${1+x} ]; then + seq=$1 +fi + + +for i in $seq; do recreateDB "$i" & dropRedis "$i" & removeFiles "$i" & 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 () { before(async function () { this.timeout(30000) - await flushTests() - servers = await flushAndRunMultipleServers(2) await setAccessTokensToServers(servers) @@ -61,7 +59,7 @@ describe('Test activitypub', function () { expect(res.header.location).to.equal('http://localhost:9001/videos/watch/' + videoUUID) }) - after(async function () { + after(function () { killallServers(servers) }) }) 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 () { killallServers(servers) await closeAllSequelize(servers) - - // Keep the logs if the test failed - if (this['ok']) { - await flushTests() - } }) }) 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 () { }) }) - after(async function () { + after(function () { killallServers(servers) }) }) 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 () { killallServers(servers) await closeAllSequelize(servers) - - // Keep the logs if the test failed - if (this['ok']) { - await flushTests() - } }) }) 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 @@ import 'mocha' -import { flushTests, killallServers, runServer, ServerInfo } from '../../../../shared/extra-utils' +import { flushTests, killallServers, flushAndRunServer, ServerInfo } from '../../../../shared/extra-utils' import { checkBadCountPagination, checkBadSortPagination, @@ -19,9 +19,7 @@ describe('Test accounts API validators', function () { before(async function () { this.timeout(30000) - await flushTests() - - server = await runServer(1) + server = await flushAndRunServer(1) }) describe('When listing accounts', function () { @@ -44,12 +42,7 @@ describe('Test accounts API validators', function () { }) }) - after(async function () { + after(function () { killallServers([ server ]) - - // Keep the logs if the test failed - if (this['ok']) { - await flushTests() - } }) }) 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 () { before(async function () { this.timeout(60000) - await flushTests() - servers = await flushAndRunMultipleServers(2) await setAccessTokensToServers(servers) @@ -487,12 +485,7 @@ describe('Test blocklist API validators', function () { }) }) - after(async function () { + after(function () { killallServers(servers) - - // Keep the logs if the test failed - if (this['ok']) { - await flushTests() - } }) }) 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' import { CustomConfig } from '../../../../shared/models/server/custom-config.model' import { - createUser, flushTests, killallServers, makeDeleteRequest, makeGetRequest, makePutBodyRequest, runServer, ServerInfo, + createUser, flushTests, killallServers, makeDeleteRequest, makeGetRequest, makePutBodyRequest, flushAndRunServer, ServerInfo, setAccessTokensToServers, userLogin, immutableAssign } from '../../../../shared/extra-utils' @@ -101,8 +101,7 @@ describe('Test config API validators', function () { before(async function () { this.timeout(30000) - await flushTests() - server = await runServer(1) + server = await flushAndRunServer(1) await setAccessTokensToServers([ server ]) @@ -230,12 +229,7 @@ describe('Test config API validators', function () { }) }) - after(async function () { + after(function () { killallServers([ server ]) - - // Keep the logs if the test failed - if (this['ok']) { - await flushTests() - } }) }) 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 { immutableAssign, killallServers, reRunServer, - runServer, + flushAndRunServer, ServerInfo, setAccessTokensToServers } from '../../../../shared/extra-utils' @@ -34,11 +34,10 @@ describe('Test contact form API validators', function () { before(async function () { this.timeout(60000) - await flushTests() await MockSmtpServer.Instance.collectEmails(emails) // Email is disabled - server = await runServer(1) + server = await flushAndRunServer(1) }) it('Should not accept a contact form if emails are disabled', async function () { @@ -84,13 +83,8 @@ describe('Test contact form API validators', function () { await sendContactForm(immutableAssign(defaultBody, { url: server.url })) }) - after(async function () { + after(function () { MockSmtpServer.Instance.kill() killallServers([ server ]) - - // Keep the logs if the test failed - if (this['ok']) { - await flushTests() - } }) }) 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 { createUser, flushTests, killallServers, - runServer, + flushAndRunServer, ServerInfo, setAccessTokensToServers, userLogin @@ -23,9 +23,7 @@ describe('Test debug API validators', function () { before(async function () { this.timeout(120000) - await flushTests() - - server = await runServer(1) + server = await flushAndRunServer(1) await setAccessTokensToServers([ server ]) @@ -67,12 +65,7 @@ describe('Test debug API validators', function () { }) }) - after(async function () { + after(function () { killallServers([ server ]) - - // Keep the logs if the test failed - if (this['ok']) { - await flushTests() - } }) }) 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 @@ import 'mocha' import { - createUser, flushTests, killallServers, makeDeleteRequest, makePostBodyRequest, runServer, ServerInfo, setAccessTokensToServers, + createUser, flushTests, killallServers, makeDeleteRequest, makePostBodyRequest, flushAndRunServer, ServerInfo, setAccessTokensToServers, userLogin } from '../../../../shared/extra-utils' import { @@ -20,8 +20,7 @@ describe('Test server follows API validators', function () { before(async function () { this.timeout(30000) - await flushTests() - server = await runServer(1) + server = await flushAndRunServer(1) await setAccessTokensToServers([ server ]) }) @@ -296,12 +295,7 @@ describe('Test server follows API validators', function () { }) }) - after(async function () { + after(function () { killallServers([ server ]) - - // Keep the logs if the test failed - if (this['ok']) { - await flushTests() - } }) }) 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 { createUser, flushTests, killallServers, - runServer, + flushAndRunServer, ServerInfo, setAccessTokensToServers, userLogin @@ -28,9 +28,7 @@ describe('Test jobs API validators', function () { before(async function () { this.timeout(120000) - await flushTests() - - server = await runServer(1) + server = await flushAndRunServer(1) await setAccessTokensToServers([ server ]) @@ -82,12 +80,7 @@ describe('Test jobs API validators', function () { }) }) - after(async function () { + after(function () { killallServers([ server ]) - - // Keep the logs if the test failed - if (this['ok']) { - await flushTests() - } }) }) 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 { createUser, flushTests, killallServers, - runServer, + flushAndRunServer, ServerInfo, setAccessTokensToServers, userLogin @@ -23,9 +23,7 @@ describe('Test logs API validators', function () { before(async function () { this.timeout(120000) - await flushTests() - - server = await runServer(1) + server = await flushAndRunServer(1) await setAccessTokensToServers([ server ]) @@ -106,12 +104,7 @@ describe('Test logs API validators', function () { }) }) - after(async function () { + after(function () { killallServers([ server ]) - - // Keep the logs if the test failed - if (this['ok']) { - await flushTests() - } }) }) 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 () { before(async function () { this.timeout(30000) - await flushTests() servers = await flushAndRunMultipleServers(2) await setAccessTokensToServers(servers) @@ -92,12 +91,7 @@ describe('Test server redundancy API validators', function () { }) }) - after(async function () { + after(function () { killallServers(servers) - - // Keep the logs if the test failed - if (this['ok']) { - await flushTests() - } }) }) 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 @@ import 'mocha' -import { flushTests, immutableAssign, killallServers, makeGetRequest, runServer, ServerInfo } from '../../../../shared/extra-utils' +import { flushTests, immutableAssign, killallServers, makeGetRequest, flushAndRunServer, ServerInfo } from '../../../../shared/extra-utils' import { checkBadCountPagination, checkBadSortPagination, @@ -17,9 +17,7 @@ describe('Test videos API validator', function () { before(async function () { this.timeout(30000) - await flushTests() - - server = await runServer(1) + server = await flushAndRunServer(1) }) describe('When searching videos', function () { @@ -146,12 +144,7 @@ describe('Test videos API validator', function () { }) }) - after(async function () { + after(function () { killallServers([ server ]) - - // Keep the logs if the test failed - if (this['ok']) { - await flushTests() - } }) }) 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 { flushTests, killallServers, makeGetRequest, - runServer, + flushAndRunServer, ServerInfo, setAccessTokensToServers, uploadVideo @@ -20,9 +20,7 @@ describe('Test services API validators', function () { before(async function () { this.timeout(60000) - await flushTests() - - server = await runServer(1) + server = await flushAndRunServer(1) await setAccessTokensToServers([ server ]) const res = await uploadVideo(server.url, server.accessToken, { name: 'my super name' }) @@ -93,13 +91,8 @@ describe('Test services API validators', function () { }) }) - after(async function () { + after(function () { killallServers([ server ]) - - // Keep the logs if the test failed - if (this['ok']) { - await flushTests() - } }) }) 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 { makeGetRequest, makePostBodyRequest, makePutBodyRequest, - runServer, + flushAndRunServer, ServerInfo, setAccessTokensToServers, wait @@ -30,9 +30,7 @@ describe('Test user notifications API validators', function () { before(async function () { this.timeout(30000) - await flushTests() - - server = await runServer(1) + server = await flushAndRunServer(1) await setAccessTokensToServers([ server ]) }) @@ -288,12 +286,7 @@ describe('Test user notifications API validators', function () { }) }) - after(async function () { + after(function () { killallServers([ server ]) - - // Keep the logs if the test failed - if (this['ok']) { - await flushTests() - } }) }) 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 { makeDeleteRequest, makeGetRequest, makePostBodyRequest, - runServer, + flushAndRunServer, ServerInfo, setAccessTokensToServers, userLogin @@ -32,9 +32,7 @@ describe('Test user subscriptions API validators', function () { before(async function () { this.timeout(30000) - await flushTests() - - server = await runServer(1) + server = await flushAndRunServer(1) await setAccessTokensToServers([ server ]) @@ -303,12 +301,7 @@ describe('Test user subscriptions API validators', function () { }) }) - after(async function () { + after(function () { killallServers([ server ]) - - // Keep the logs if the test failed - if (this['ok']) { - await flushTests() - } }) }) 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' import { createUser, flushTests, getMyUserInformation, getMyUserVideoRating, getUsersList, immutableAssign, killallServers, makeGetRequest, - makePostBodyRequest, makeUploadRequest, makePutBodyRequest, registerUser, removeUser, runServer, ServerInfo, setAccessTokensToServers, + makePostBodyRequest, makeUploadRequest, makePutBodyRequest, registerUser, removeUser, flushAndRunServer, ServerInfo, setAccessTokensToServers, updateUser, uploadVideo, userLogin, deleteMe, unblockUser, blockUser } from '../../../../shared/extra-utils' import { @@ -40,10 +40,8 @@ describe('Test users API validators', function () { before(async function () { this.timeout(30000) - await flushTests() - - server = await runServer(1) - serverWithRegistrationDisabled = await runServer(2) + server = await flushAndRunServer(1) + serverWithRegistrationDisabled = await flushAndRunServer(2) await setAccessTokensToServers([ server ]) @@ -881,12 +879,7 @@ describe('Test users API validators', function () { }) }) - after(async function () { + after(function () { killallServers([ server, serverWithRegistrationDisabled ]) - - // Keep the logs if the test failed - if (this['ok']) { - await flushTests() - } }) }) 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 { killallServers, makeGetRequest, makePostBodyRequest, - runServer, + flushAndRunServer, ServerInfo, setAccessTokensToServers, updateVideoAbuse, @@ -33,9 +33,7 @@ describe('Test video abuses API validators', function () { before(async function () { this.timeout(30000) - await flushTests() - - server = await runServer(1) + server = await flushAndRunServer(1) await setAccessTokensToServers([ server ]) @@ -190,12 +188,7 @@ describe('Test video abuses API validators', function () { }) }) - after(async function () { + after(function () { killallServers([ server ]) - - // Keep the logs if the test failed - if (this['ok']) { - await flushTests() - } }) }) 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 () { before(async function () { this.timeout(120000) - await flushTests() servers = await flushAndRunMultipleServers(2) await setAccessTokensToServers(servers) @@ -248,12 +247,7 @@ describe('Test video blacklist API validators', function () { }) }) - after(async function () { + after(function () { killallServers(servers) - - // Keep the logs if the test failed - if (this['ok']) { - await flushTests() - } }) }) 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 { makeDeleteRequest, makeGetRequest, makeUploadRequest, - runServer, + flushAndRunServer, ServerInfo, setAccessTokensToServers, uploadVideo, @@ -29,9 +29,7 @@ describe('Test video captions API validator', function () { before(async function () { this.timeout(30000) - await flushTests() - - server = await runServer(1) + server = await flushAndRunServer(1) await setAccessTokensToServers([ server ]) @@ -271,12 +269,7 @@ describe('Test video captions API validator', function () { }) }) - after(async function () { + after(function () { killallServers([ server ]) - - // Keep the logs if the test failed - if (this['ok']) { - await flushTests() - } }) }) 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 { makePostBodyRequest, makePutBodyRequest, makeUploadRequest, - runServer, + flushAndRunServer, ServerInfo, setAccessTokensToServers, userLogin @@ -41,9 +41,7 @@ describe('Test video channels API validator', function () { before(async function () { this.timeout(30000) - await flushTests() - - server = await runServer(1) + server = await flushAndRunServer(1) await setAccessTokensToServers([ server ]) @@ -312,12 +310,7 @@ describe('Test video channels API validator', function () { }) }) - after(async function () { + after(function () { killallServers([ server ]) - - // Keep the logs if the test failed - if (this['ok']) { - await flushTests() - } }) }) 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' import 'mocha' import { createUser, - flushTests, killallServers, makeDeleteRequest, makeGetRequest, makePostBodyRequest, runServer, ServerInfo, setAccessTokensToServers, + flushTests, killallServers, makeDeleteRequest, makeGetRequest, makePostBodyRequest, flushAndRunServer, ServerInfo, setAccessTokensToServers, uploadVideo, userLogin } from '../../../../shared/extra-utils' import { @@ -29,9 +29,7 @@ describe('Test video comments API validator', function () { before(async function () { this.timeout(30000) - await flushTests() - - server = await runServer(1) + server = await flushAndRunServer(1) await setAccessTokensToServers([ server ]) @@ -253,12 +251,7 @@ describe('Test video comments API validator', function () { it('Should return conflict on comment thread add') }) - after(async function () { + after(function () { killallServers([ server ]) - - // Keep the logs if the test failed - if (this['ok']) { - await flushTests() - } }) }) 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 { makeGetRequest, makePostBodyRequest, makeUploadRequest, - runServer, + flushAndRunServer, ServerInfo, setAccessTokensToServers, updateCustomSubConfig, @@ -38,9 +38,7 @@ describe('Test video imports API validator', function () { before(async function () { this.timeout(30000) - await flushTests() - - server = await runServer(1) + server = await flushAndRunServer(1) await setAccessTokensToServers([ server ]) @@ -313,12 +311,7 @@ describe('Test video imports API validator', function () { }) }) - after(async function () { + after(function () { killallServers([ server ]) - - // Keep the logs if the test failed - if (this['ok']) { - await flushTests() - } }) }) 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 { makeGetRequest, removeVideoFromPlaylist, reorderVideosPlaylist, - runServer, + flushAndRunServer, ServerInfo, setAccessTokensToServers, setDefaultVideoChannel, updateVideoPlaylist, @@ -43,9 +43,7 @@ describe('Test video playlists API validator', function () { before(async function () { this.timeout(30000) - await flushTests() - - server = await runServer(1) + server = await flushAndRunServer(1) await setAccessTokensToServers([ server ]) await setDefaultVideoChannel([ server ]) @@ -670,12 +668,7 @@ describe('Test video playlists API validator', function () { }) }) - after(async function () { + after(function () { killallServers([ server ]) - - // Keep the logs if the test failed - if (this['ok']) { - await flushTests() - } }) }) 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 { flushTests, killallServers, makeGetRequest, - runServer, + flushAndRunServer, ServerInfo, setAccessTokensToServers, setDefaultVideoChannel, userLogin @@ -48,9 +48,7 @@ describe('Test videos filters', function () { before(async function () { this.timeout(30000) - await flushTests() - - server = await runServer(1) + server = await flushAndRunServer(1) await setAccessTokensToServers([ server ]) await setDefaultVideoChannel([ server ]) @@ -131,12 +129,7 @@ describe('Test videos filters', function () { }) }) - after(async function () { + after(function () { killallServers([ server ]) - - // Keep the logs if the test failed - if (this['ok']) { - await flushTests() - } }) }) 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 { makeGetRequest, makePostBodyRequest, makePutBodyRequest, - runServer, + flushAndRunServer, ServerInfo, setAccessTokensToServers, uploadVideo @@ -29,9 +29,7 @@ describe('Test videos history API validator', function () { before(async function () { this.timeout(30000) - await flushTests() - - server = await runServer(1) + server = await flushAndRunServer(1) await setAccessTokensToServers([ server ]) @@ -128,12 +126,7 @@ describe('Test videos history API validator', function () { }) }) - after(async function () { + after(function () { killallServers([ server ]) - - // Keep the logs if the test failed - if (this['ok']) { - await flushTests() - } }) }) 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 import { createUser, flushTests, getMyUserInformation, getVideo, getVideosList, immutableAssign, killallServers, makeDeleteRequest, makeGetRequest, makeUploadRequest, makePutBodyRequest, removeVideo, uploadVideo, - runServer, ServerInfo, setAccessTokensToServers, userLogin, updateCustomSubConfig + flushAndRunServer, ServerInfo, setAccessTokensToServers, userLogin, updateCustomSubConfig } from '../../../../shared/extra-utils' import { checkBadCountPagination, @@ -33,9 +33,7 @@ describe('Test videos API validator', function () { before(async function () { this.timeout(30000) - await flushTests() - - server = await runServer(1) + server = await flushAndRunServer(1) await setAccessTokensToServers([ server ]) @@ -730,12 +728,7 @@ describe('Test videos API validator', function () { }) }) - after(async function () { + after(function () { killallServers([ server ]) - - // Keep the logs if the test failed - if (this['ok']) { - await flushTests() - } }) }) 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 () { await MockSmtpServer.Instance.collectEmails(emails) - await flushTests() - const overrideConfig = { smtp: { hostname: 'localhost' @@ -1297,7 +1295,7 @@ describe('Test users notifications', function () { }) }) - after(async function () { + after(function () { MockSmtpServer.Instance.kill() 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 () { before(async function () { this.timeout(120000) - await flushTests() - servers = await flushAndRunMultipleServers(2) await setAccessTokensToServers(servers) @@ -207,12 +205,7 @@ describe('Test a ActivityPub video channels search', function () { expect(res.body.data).to.have.lengthOf(0) }) - after(async function () { + after(function () { killallServers(servers) - - // Keep the logs if the test failed - if (this['ok']) { - await flushTests() - } }) }) 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 () { before(async function () { this.timeout(120000) - await flushTests() - servers = await flushAndRunMultipleServers(2) await setAccessTokensToServers(servers) @@ -151,12 +149,7 @@ describe('Test a ActivityPub videos search', function () { expect(res.body.data).to.have.lengthOf(0) }) - after(async function () { + after(function () { killallServers(servers) - - // Keep the logs if the test failed - if (this['ok']) { - await flushTests() - } }) }) 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 { advancedVideosSearch, flushTests, killallServers, - runServer, + flushAndRunServer, searchVideo, ServerInfo, setAccessTokensToServers, @@ -24,9 +24,7 @@ describe('Test a videos search', function () { before(async function () { this.timeout(30000) - await flushTests() - - server = await runServer(1) + server = await flushAndRunServer(1) await setAccessTokensToServers([ server ]) @@ -407,12 +405,7 @@ describe('Test a videos search', function () { } }) - after(async function () { + after(function () { killallServers([ server ]) - - // Keep the logs if the test failed - if (this['ok']) { - await flushTests() - } }) }) 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 { getConfig, getCustomConfig, registerUser, - runServer, + flushAndRunServer, setAccessTokensToServers, updateCustomConfig } from '../../../../shared/extra-utils' @@ -118,9 +118,7 @@ describe('Test config', function () { before(async function () { this.timeout(30000) - - await flushTests() - server = await runServer(1) + server = await flushAndRunServer(1) await setAccessTokensToServers([ server ]) }) @@ -302,7 +300,7 @@ describe('Test config', function () { checkInitialConfig(data) }) - after(async function () { + after(function () { killallServers([ server ]) }) }) 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 @@ import * as chai from 'chai' import 'mocha' -import { flushTests, killallServers, runServer, ServerInfo, setAccessTokensToServers, wait } from '../../../../shared/extra-utils' +import { flushTests, killallServers, flushAndRunServer, ServerInfo, setAccessTokensToServers, wait } from '../../../../shared/extra-utils' import { MockSmtpServer } from '../../../../shared/extra-utils/miscs/email' import { waitJobs } from '../../../../shared/extra-utils/server/jobs' import { sendContactForm } from '../../../../shared/extra-utils/server/contact-form' @@ -18,14 +18,12 @@ describe('Test contact form', function () { await MockSmtpServer.Instance.collectEmails(emails) - await flushTests() - const overrideConfig = { smtp: { hostname: 'localhost' } } - server = await runServer(1, overrideConfig) + server = await flushAndRunServer(1, overrideConfig) await setAccessTokensToServers([ server ]) }) @@ -80,7 +78,7 @@ describe('Test contact form', function () { }) }) - after(async function () { + after(function () { MockSmtpServer.Instance.kill() killallServers([ server ]) }) 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 { createUser, removeVideoFromBlacklist, reportVideoAbuse, resetPassword, - runServer, + flushAndRunServer, unblockUser, uploadVideo, userLogin, @@ -43,14 +43,12 @@ describe('Test emails', function () { await MockSmtpServer.Instance.collectEmails(emails) - await flushTests() - const overrideConfig = { smtp: { hostname: 'localhost' } } - server = await runServer(1, overrideConfig) + server = await flushAndRunServer(1, overrideConfig) await setAccessTokensToServers([ server ]) { @@ -258,7 +256,7 @@ describe('Test emails', function () { }) }) - after(async function () { + after(function () { MockSmtpServer.Instance.kill() killallServers([ server ]) }) 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 () { }) }) - after(async function () { + after(function () { killallServers(servers) }) }) 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 () { } }) - after(async function () { + after(function () { killallServers(servers) }) }) 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 () { }) - after(async function () { + after(function () { killallServers(servers) }) }) 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 () { } }) - after(async function () { + after(function () { killallServers(servers) }) }) 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 () { expect(dateIsValid(job.finishedOn)).to.be.true }) - after(async function () { + after(function () { killallServers(servers) }) }) 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 @@ import * as chai from 'chai' import 'mocha' -import { flushTests, killallServers, runServer, ServerInfo, setAccessTokensToServers } from '../../../../shared/extra-utils/index' +import { flushTests, killallServers, flushAndRunServer, ServerInfo, setAccessTokensToServers } from '../../../../shared/extra-utils/index' import { waitJobs } from '../../../../shared/extra-utils/server/jobs' import { uploadVideo } from '../../../../shared/extra-utils/videos/videos' import { getLogs } from '../../../../shared/extra-utils/logs/logs' @@ -15,9 +15,7 @@ describe('Test logs', function () { before(async function () { this.timeout(30000) - await flushTests() - - server = await runServer(1) + server = await flushAndRunServer(1) await setAccessTokensToServers([ server ]) }) @@ -86,7 +84,7 @@ describe('Test logs', function () { } }) - after(async function () { + after(function () { killallServers([ server ]) }) }) 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 { killallServers, ServerInfo } from '../../../../shared/extra-utils' -import { runServer } from '../../../../shared/extra-utils/server/servers' +import { flushAndRunServer } from '../../../../shared/extra-utils/server/servers' describe('Start and stop server without web client routes', function () { let server: ServerInfo @@ -13,9 +13,7 @@ describe('Start and stop server without web client routes', function () { before(async function () { this.timeout(30000) - await flushTests() - - server = await runServer(1, {}, ['--no-client']) + server = await flushAndRunServer(1, {}, ['--no-client']) }) it('Should fail getting the client', function () { @@ -25,12 +23,7 @@ describe('Start and stop server without web client routes', function () { return req.expect(404) }) - after(async function () { + after(function () { killallServers([ server ]) - - // Keep the logs if the test failed - if (this['ok']) { - await flushTests() - } }) }) 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 import { getConfig, flushTests, - runServer, + flushAndRunServer, registerUser, getCustomConfig, setAccessTokensToServers, updateCustomConfig } from '../../../../shared/extra-utils/index' @@ -31,9 +31,7 @@ describe('Test application behind a reverse proxy', function () { before(async function () { this.timeout(30000) - - await flushTests() - server = await runServer(1) + server = await flushAndRunServer(1) await setAccessTokensToServers([ server ]) const { body } = await uploadVideo(server.url, server.accessToken, {}) @@ -102,7 +100,7 @@ describe('Test application behind a reverse proxy', function () { await userLogin(server, user, 429) }) - after(async function () { + after(function () { killallServers([ server ]) }) }) 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 () { before(async function () { this.timeout(60000) - - await flushTests() servers = await flushAndRunMultipleServers(3) await setAccessTokensToServers(servers) @@ -97,7 +95,7 @@ describe('Test stats (excluding redundancy)', function () { expect(data.totalInstanceFollowers).to.equal(0) }) - after(async function () { + after(function () { killallServers(servers) }) }) 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 @@ import * as magnetUtil from 'magnet-uri' import 'mocha' -import { getVideo, killallServers, reRunServer, runServer, ServerInfo, uploadVideo } from '../../../../shared/extra-utils' +import { getVideo, killallServers, reRunServer, flushAndRunServer, ServerInfo, uploadVideo } from '../../../../shared/extra-utils' import { flushTests, setAccessTokensToServers } from '../../../../shared/extra-utils/index' import { VideoDetails } from '../../../../shared/models/videos' import * as WebTorrent from 'webtorrent' @@ -14,9 +14,7 @@ describe('Test tracker', function () { before(async function () { this.timeout(60000) - - await flushTests() - server = await runServer(1) + server = await flushAndRunServer(1) await setAccessTokensToServers([ server ]) { @@ -84,7 +82,7 @@ describe('Test tracker', function () { }) }) - after(async function () { + after(function () { killallServers([ server ]) }) }) 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 () { before(async function () { this.timeout(60000) - await flushTests() - servers = await flushAndRunMultipleServers(2) await setAccessTokensToServers(servers) @@ -500,12 +498,7 @@ describe('Test blocklist', function () { }) }) - after(async function () { + after(function () { killallServers(servers) - - // Keep the logs if the test failed - if (this[ 'ok' ]) { - await flushTests() - } }) }) 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 () { } }) - after(async function () { + after(function () { killallServers(servers) }) }) 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 () { } }) - after(async function () { + after(function () { killallServers(servers) }) }) 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' import 'mocha' import { registerUser, flushTests, getUserInformation, getMyUserInformation, killallServers, - userLogin, login, runServer, ServerInfo, verifyEmail, updateCustomSubConfig, wait + userLogin, login, flushAndRunServer, ServerInfo, verifyEmail, updateCustomSubConfig, wait } from '../../../../shared/extra-utils' import { setAccessTokensToServers } from '../../../../shared/extra-utils/users/login' import { MockSmtpServer } from '../../../../shared/extra-utils/miscs/email' @@ -32,14 +32,12 @@ describe('Test users account verification', function () { await MockSmtpServer.Instance.collectEmails(emails) - await flushTests() - const overrideConfig = { smtp: { hostname: 'localhost' } } - server = await runServer(1, overrideConfig) + server = await flushAndRunServer(1, overrideConfig) await setAccessTokensToServers([ server ]) }) @@ -122,13 +120,8 @@ describe('Test users account verification', function () { await userLogin(server, user2) }) - after(async function () { + after(function () { MockSmtpServer.Instance.kill() killallServers([ server ]) - - // Keep the logs if the test failed - if (this[ 'ok' ]) { - await flushTests() - } }) }) 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 { registerUser, removeUser, removeVideo, - runServer, + flushAndRunServer, ServerInfo, testImage, unblockUser, @@ -54,9 +54,7 @@ describe('Test users', function () { before(async function () { this.timeout(30000) - - await flushTests() - server = await runServer(1) + server = await flushAndRunServer(1) await setAccessTokensToServers([ server ]) }) @@ -679,12 +677,7 @@ describe('Test users', function () { }) }) - after(async function () { + after(function () { killallServers([ server ]) - - // Keep the logs if the test failed - if (this[ 'ok' ]) { - await flushTests() - } }) }) 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 () { }) }) - after(async function () { + after(function () { killallServers(servers) - - // Keep the logs if the test failed - if (this['ok']) { - await flushTests() - } }) }) 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 { setAccessTokensToServers, uploadVideo } from '../../../../shared/extra-utils/index' -import { runServer } from '../../../../shared/extra-utils/server/servers' +import { flushAndRunServer } from '../../../../shared/extra-utils/server/servers' const expect = chai.expect @@ -21,9 +21,7 @@ describe('Test services', function () { before(async function () { this.timeout(30000) - await flushTests() - - server = await runServer(1) + server = await flushAndRunServer(1) await setAccessTokensToServers([ server ]) @@ -76,7 +74,7 @@ describe('Test services', function () { expect(res.body).to.not.have.property('thumbnail_height') }) - after(async function () { + after(function () { killallServers([ server ]) }) }) 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 { killallServers, rateVideo, removeVideo, - runServer, + flushAndRunServer, ServerInfo, setAccessTokensToServers, testImage, @@ -107,9 +107,7 @@ describe('Test a single server', function () { before(async function () { this.timeout(30000) - await flushTests() - - server = await runServer(1) + server = await flushAndRunServer(1) await setAccessTokensToServers([ server ]) }) @@ -426,12 +424,7 @@ describe('Test a single server', function () { expect(video.dislikes).to.equal(1) }) - after(async function () { + after(function () { killallServers([ server ]) - - // Keep the logs if the test failed - if (this['ok']) { - await flushTests() - } }) }) 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 () { expect(res.body.data.length).to.equal(0) }) - after(async function () { + after(function () { killallServers(servers) }) }) 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 () { }) }) - after(async function () { + after(function () { killallServers(servers) }) }) 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 () { before(async function () { this.timeout(30000) - await flushTests() - servers = await flushAndRunMultipleServers(2) await setAccessTokensToServers(servers) @@ -197,7 +195,7 @@ describe('Test video captions', function () { await checkVideoFilesWereRemoved(videoUUID, 1) }) - after(async function () { + after(function () { killallServers(servers) }) }) 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' import { acceptChangeOwnership, changeVideoOwnership, - createUser, doubleFollow, flushAndRunMultipleServers, - flushTests, + createUser, + doubleFollow, + flushAndRunMultipleServers, + flushAndRunServer, getMyUserInformation, + getVideo, getVideoChangeOwnershipList, getVideosList, killallServers, refuseChangeOwnership, - runServer, ServerInfo, setAccessTokensToServers, uploadVideo, - userLogin, - getVideo + userLogin } from '../../../../shared/extra-utils' import { waitJobs } from '../../../../shared/extra-utils/server/jobs' import { User } from '../../../../shared/models/users' @@ -202,7 +203,7 @@ describe('Test video change ownership - nominal', function () { } }) - after(async function () { + after(function () { killallServers(servers) }) }) @@ -225,8 +226,7 @@ describe('Test video change ownership - quota too small', function () { this.timeout(50000) // Run one server - await flushTests() - server = await runServer(1) + server = await flushAndRunServer(1) await setAccessTokensToServers([server]) const videoQuota = 42000000 @@ -297,7 +297,7 @@ describe('Test video change ownership - quota too small', function () { await acceptChangeOwnership(server.url, secondUserAccessToken, lastRequestChangeOwnershipId, channelId, 403) }) - after(async function () { + after(function () { killallServers([server]) }) }) 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 () { before(async function () { this.timeout(30000) - await flushTests() - servers = await flushAndRunMultipleServers(2) await setAccessTokensToServers(servers) @@ -279,7 +277,7 @@ describe('Test video channels', function () { } }) - after(async function () { + after(function () { killallServers(servers) }) }) 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 { dateIsValid, flushTests, killallServers, - runServer, + flushAndRunServer, ServerInfo, setAccessTokensToServers, updateMyAvatar, @@ -34,9 +34,7 @@ describe('Test video comments', function () { before(async function () { this.timeout(30000) - await flushTests() - - server = await runServer(1) + server = await flushAndRunServer(1) await setAccessTokensToServers([ server ]) @@ -201,7 +199,7 @@ describe('Test video comments', function () { expect(res.body.data[1].totalReplies).to.equal(0) }) - after(async function () { + after(function () { killallServers([ server ]) }) }) 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 () { } }) - after(async function () { + after(function () { killallServers(servers) }) }) 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 () { } }) - after(async function () { + after(function () { killallServers(servers) - - // Keep the logs if the test failed - if (this['ok']) { - await flushTests() - } }) }) 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 () { } }) - after(async function () { + after(function () { killallServers(servers) }) }) 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 { getMyUserInformation, getVideoChannelVideos, getVideosListWithToken, - runServer, + flushAndRunServer, searchVideo, searchVideoWithToken, updateCustomConfig, @@ -64,9 +64,7 @@ describe('Test video NSFW policy', function () { before(async function () { this.timeout(50000) - - await flushTests() - server = await runServer(1) + server = await flushAndRunServer(1) // Get the access tokens await setAccessTokensToServers([ server ]) @@ -243,7 +241,7 @@ describe('Test video NSFW policy', function () { }) }) - after(async function () { + after(function () { killallServers([ server ]) }) }) 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 () { } }) - after(async function () { + after(function () { killallServers(servers) - - // Keep the logs if the test failed - if (this['ok']) { - await flushTests() - } }) }) 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 () { } }) - after(async function () { + after(function () { killallServers(servers) }) }) 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 () { } }) - after(async function () { + after(function () { killallServers(servers) }) }) 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 () { } }) - after(async function () { + after(function () { killallServers(servers) }) }) 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 () { before(async function () { this.timeout(120000) - await flushTests() - servers = await flushAndRunMultipleServers(2) await setAccessTokensToServers(servers) @@ -121,12 +119,7 @@ describe('Test videos filter validator', function () { }) }) - after(async function () { + after(function () { killallServers(servers) - - // Keep the logs if the test failed - if (this['ok']) { - await flushTests() - } }) }) 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 { getVideosListWithToken, getVideoWithToken, killallServers, reRunServer, - runServer, + flushAndRunServer, searchVideoWithToken, ServerInfo, setAccessTokensToServers, @@ -33,9 +33,7 @@ describe('Test videos history', function () { before(async function () { this.timeout(30000) - await flushTests() - - server = await runServer(1) + server = await flushAndRunServer(1) await setAccessTokensToServers([ server ]) @@ -222,12 +220,7 @@ describe('Test videos history', function () { expect(res.body.total).to.equal(0) }) - after(async function () { + after(function () { killallServers([ server ]) - - // Keep the logs if the test failed - if (this['ok']) { - await flushTests() - } }) }) 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 @@ import * as chai from 'chai' import 'mocha' -import { flushTests, killallServers, runServer, ServerInfo, setAccessTokensToServers, uploadVideo } from '../../../../shared/extra-utils' +import { flushTests, killallServers, flushAndRunServer, ServerInfo, setAccessTokensToServers, uploadVideo } from '../../../../shared/extra-utils' import { getVideosOverview } from '../../../../shared/extra-utils/overviews/overviews' import { VideosOverview } from '../../../../shared/models/overviews' @@ -14,9 +14,7 @@ describe('Test a videos overview', function () { before(async function () { this.timeout(30000) - await flushTests() - - server = await runServer(1) + server = await flushAndRunServer(1) await setAccessTokensToServers([ server ]) }) @@ -89,12 +87,7 @@ describe('Test a videos overview', function () { expect(overview.channels[0].channel.name).to.equal('root_channel') }) - after(async function () { + after(function () { killallServers([ server ]) - - // Keep the logs if the test failed - if (this['ok']) { - await flushTests() - } }) }) 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 { flushTests, killallServers, reRunServer, - runServer, + flushAndRunServer, ServerInfo, setAccessTokensToServers, uploadVideo, uploadVideoAndGetId, viewVideo, wait, countVideoViewsOf, doubleFollow, waitJobs @@ -27,8 +27,6 @@ describe('Test video views cleaner', function () { before(async function () { this.timeout(50000) - await flushTests() - servers = await flushAndRunMultipleServers(2) await setAccessTokensToServers(servers) @@ -102,12 +100,7 @@ describe('Test video views cleaner', function () { } }) - after(async function () { + after(function () { killallServers(servers) - - // Keep the logs if the test failed - if (this['ok']) { - await flushTests() - } }) }) 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 () { before(async function () { this.timeout(90000) - await flushTests() // Run server 2 to have transcoding enabled servers = await flushAndRunMultipleServers(2) @@ -131,7 +130,7 @@ describe('Test create import video jobs', function () { } }) - after(async function () { + after(function () { killallServers(servers) }) }) 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 () { before(async function () { this.timeout(60000) - await flushTests() - // Run server 2 to have transcoding enabled servers = await flushAndRunMultipleServers(2) await setAccessTokensToServers(servers) @@ -126,7 +124,7 @@ describe('Test create transcoding jobs', function () { } }) - after(async function () { + after(function () { killallServers(servers) }) }) 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 () { before(async function () { this.timeout(200000) - await flushTests() - // Run server 2 to have transcoding enabled servers = await flushAndRunMultipleServers(2) await setAccessTokensToServers(servers) @@ -114,7 +112,7 @@ describe('Test optimize old videos', function () { } }) - after(async function () { + after(function () { killallServers(servers) }) }) 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 { flushTests, getEnvCli, killallServers, - runServer, + flushAndRunServer, ServerInfo, setAccessTokensToServers } from '../../../shared/extra-utils' @@ -19,9 +19,7 @@ describe('Test CLI wrapper', function () { before(async function () { this.timeout(30000) - - await flushTests() - server = await runServer(1) + server = await flushAndRunServer(1) await setAccessTokensToServers([ server ]) 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 { getEnvCli, killallServers, login, - runServer, + flushAndRunServer, ServerInfo, setAccessTokensToServers } from '../../../shared/extra-utils' @@ -17,9 +17,7 @@ describe('Test reset password scripts', function () { before(async function () { this.timeout(30000) - - await flushTests() - server = await runServer(1) + server = await flushAndRunServer(1) await setAccessTokensToServers([ server ]) await createUser({ url: server.url, accessToken: server.accessToken, username: 'user_1', password: 'super password' }) @@ -34,7 +32,7 @@ describe('Test reset password scripts', function () { await login(server.url, server.client, { username: 'user_1', password: 'coucou' }, 200) }) - after(async function () { + after(function () { killallServers([ server ]) }) }) 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 { killallServers, makeActivityPubGetRequest, parseTorrentVideo, - runServer, + flushAndRunServer, ServerInfo, setAccessTokensToServers, uploadVideo @@ -32,15 +32,13 @@ describe('Test update host scripts', function () { before(async function () { this.timeout(60000) - await flushTests() - const overrideConfig = { webserver: { port: 9256 } } // Run server 2 to have transcoding enabled - server = await runServer(2, overrideConfig) + server = await flushAndRunServer(2, overrideConfig) await setAccessTokensToServers([ server ]) // Upload two videos for our needs @@ -72,7 +70,7 @@ describe('Test update host scripts', function () { killallServers([ server ]) // Run server with standard configuration - server = await runServer(2) + server = await flushAndRunServer(2) const env = getEnvCli(server) await execCLI(`${env} npm run update-host`) @@ -148,7 +146,7 @@ describe('Test update host scripts', function () { } }) - after(async function () { + after(function () { killallServers([ server ]) }) }) 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 { getVideosList, killallServers, makeHTMLRequest, - runServer, + flushAndRunServer, ServerInfo, serverLogin, updateCustomConfig, @@ -31,9 +31,7 @@ describe('Test a client controllers', function () { before(async function () { this.timeout(120000) - await flushTests() - - server = await runServer(1) + server = await flushAndRunServer(1) server.accessToken = await serverLogin(server) const videoAttributes = { @@ -147,7 +145,7 @@ describe('Test a client controllers', function () { checkIndexTags(res.text, 'PeerTube updated', 'my short description', 'body { background-color: red; }') }) - after(async function () { + after(function () { killallServers([ server ]) }) }) 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', () => { }) }) - after(async function () { + after(function () { killallServers(servers) - - // Keep the logs if the test failed - if (this['ok']) { - await flushTests() - } }) }) 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 { flushTests, killallServers, makeGetRequest, - runServer, + flushAndRunServer, ServerInfo, setAccessTokensToServers, uploadVideo @@ -23,9 +23,7 @@ describe('Test misc endpoints', function () { before(async function () { this.timeout(120000) - await flushTests() - - server = await runServer(1) + server = await flushAndRunServer(1) await setAccessTokensToServers([ server ]) }) @@ -173,7 +171,7 @@ describe('Test misc endpoints', function () { }) }) - after(async function () { + after(function () { killallServers([ server ]) }) }) 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 { getVideosList, killallServers, rateVideo, - runServer, + flushAndRunServer, ServerInfo, setAccessTokensToServers, uploadVideo @@ -19,11 +19,10 @@ start() // ---------------------------------------------------------------------------- async function start () { - await flushTests() console.log('Flushed tests.') - const server = await runServer(6) + const server = await flushAndRunServer(6) process.on('exit', async () => { killallServers([ server ]) diff --git a/shared/extra-utils/server/servers.ts b/shared/extra-utils/server/servers.ts index 5288d253a..b0cb869f4 100644 --- a/shared/extra-utils/server/servers.ts +++ b/shared/extra-utils/server/servers.ts @@ -58,18 +58,17 @@ function flushAndRunMultipleServers (totalServers: number, configOverride?: Obje } } - flushTests() - .then(() => { - for (let j = 1; j <= totalServers; j++) { - runServer(j, configOverride).then(app => anotherServerDone(j, app)) - } - }) + for (let j = 1; j <= totalServers; j++) { + flushAndRunServer(j, configOverride).then(app => anotherServerDone(j, app)) + } }) } -function flushTests () { +function flushTests (serverNumber?: number) { return new Promise((res, rej) => { - return exec('npm run clean:server:test', err => { + const suffix = serverNumber ? ` -- ${serverNumber}` : '' + + return exec('npm run clean:server:test' + suffix, err => { if (err) return rej(err) return res() @@ -77,7 +76,7 @@ function flushTests () { }) } -function runServer (serverNumber: number, configOverride?: Object, args = []) { +function flushAndRunServer (serverNumber: number, configOverride?: Object, args = []) { const server: ServerInfo = { app: null, serverNumber: serverNumber, @@ -123,47 +122,51 @@ function runServer (serverNumber: number, configOverride?: Object, args = []) { } return new Promise(res => { - server.app = fork(join(root(), 'dist', 'server.js'), args, options) - server.app.stdout.on('data', function onStdout (data) { - let dontContinue = false - - // Capture things if we want to - for (const key of Object.keys(regexps)) { - const regexp = regexps[key] - const matches = data.toString().match(regexp) - if (matches !== null) { - if (key === 'client_id') server.client.id = matches[1] - else if (key === 'client_secret') server.client.secret = matches[1] - else if (key === 'user_username') server.user.username = matches[1] - else if (key === 'user_password') server.user.password = matches[1] - } - } - - // Check if all required sentences are here - for (const key of Object.keys(serverRunString)) { - if (data.toString().indexOf(key) !== -1) serverRunString[key] = true - if (serverRunString[key] === false) dontContinue = true - } - - // If no, there is maybe one thing not already initialized (client/user credentials generation...) - if (dontContinue === true) return - - server.app.stdout.removeListener('data', onStdout) + flushTests(serverNumber) + .then(() => { - process.on('exit', () => { - try { - process.kill(server.app.pid) - } catch { /* empty */ } + server.app = fork(join(root(), 'dist', 'server.js'), args, options) + server.app.stdout.on('data', function onStdout (data) { + let dontContinue = false + + // Capture things if we want to + for (const key of Object.keys(regexps)) { + const regexp = regexps[ key ] + const matches = data.toString().match(regexp) + if (matches !== null) { + if (key === 'client_id') server.client.id = matches[ 1 ] + else if (key === 'client_secret') server.client.secret = matches[ 1 ] + else if (key === 'user_username') server.user.username = matches[ 1 ] + else if (key === 'user_password') server.user.password = matches[ 1 ] + } + } + + // Check if all required sentences are here + for (const key of Object.keys(serverRunString)) { + if (data.toString().indexOf(key) !== -1) serverRunString[ key ] = true + if (serverRunString[ key ] === false) dontContinue = true + } + + // If no, there is maybe one thing not already initialized (client/user credentials generation...) + if (dontContinue === true) return + + server.app.stdout.removeListener('data', onStdout) + + process.on('exit', () => { + try { + process.kill(server.app.pid) + } catch { /* empty */ + } + }) + + res(server) + }) }) - - res(server) - }) - }) } async function reRunServer (server: ServerInfo, configOverride?: any) { - const newServer = await runServer(server.serverNumber, configOverride) + const newServer = await flushAndRunServer(server.serverNumber, configOverride) server.app = newServer.app return server @@ -212,7 +215,7 @@ export { ServerInfo, flushAndRunMultipleServers, flushTests, - runServer, + flushAndRunServer, killallServers, reRunServer, waitUntilLog -- 2.41.0