1
0
Fork 0

Cleanup tests

This commit is contained in:
Chocobozzz 2019-04-24 10:53:40 +02:00
parent 9cc8d43e37
commit 210feb6cc4
No known key found for this signature in database
GPG key ID: 583A612D890159BE
83 changed files with 226 additions and 537 deletions

View file

@ -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" &

View file

@ -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)
})
})

View file

@ -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()
}
})
})

View file

@ -153,7 +153,7 @@ describe('Test AP refresher', function () {
})
})
after(async function () {
after(function () {
killallServers(servers)
})
})

View file

@ -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()
}
})
})

View file

@ -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()
}
})
})

View file

@ -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()
}
})
})

View file

@ -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()
}
})
})

View file

@ -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()
}
})
})

View file

@ -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()
}
})
})

View file

@ -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()
}
})
})

View file

@ -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()
}
})
})

View file

@ -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()
}
})
})

View file

@ -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()
}
})
})

View file

@ -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()
}
})
})

View file

@ -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()
}
})
})

View file

@ -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()
}
})
})

View file

@ -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()
}
})
})

View file

@ -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()
}
})
})

View file

@ -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()
}
})
})

View file

@ -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()
}
})
})

View file

@ -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()
}
})
})

View file

@ -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()
}
})
})

View file

@ -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()
}
})
})

View file

@ -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()
}
})
})

View file

@ -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()
}
})
})

View file

@ -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()
}
})
})

View file

@ -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()
}
})
})

View file

@ -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()
}
})
})

View file

@ -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)

View file

@ -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()
}
})
})

View file

@ -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()
}
})
})

View file

@ -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()
}
})
})

View file

@ -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 ])
})
})

View file

@ -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 ])
})

View file

@ -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 ])
})

View file

@ -219,7 +219,7 @@ describe('Test follow constraints', function () {
})
})
after(async function () {
after(function () {
killallServers(servers)
})
})

View file

@ -189,7 +189,7 @@ describe('Test follows moderation', function () {
}
})
after(async function () {
after(function () {
killallServers(servers)
})
})

View file

@ -435,7 +435,7 @@ describe('Test follows', function () {
})
after(async function () {
after(function () {
killallServers(servers)
})
})

View file

@ -296,7 +296,7 @@ describe('Test handle downs', function () {
}
})
after(async function () {
after(function () {
killallServers(servers)
})
})

View file

@ -56,7 +56,7 @@ describe('Test jobs', function () {
expect(dateIsValid(job.finishedOn)).to.be.true
})
after(async function () {
after(function () {
killallServers(servers)
})
})

View file

@ -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 ])
})
})

View file

@ -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()
}
})
})

View file

@ -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 ])
})
})

View file

@ -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)
})
})

View file

@ -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 ])
})
})

View file

@ -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()
}
})
})

View file

@ -368,7 +368,7 @@ describe('Test users subscriptions', function () {
}
})
after(async function () {
after(function () {
killallServers(servers)
})
})

View file

@ -235,7 +235,7 @@ describe('Test users with multiple servers', function () {
}
})
after(async function () {
after(function () {
killallServers(servers)
})
})

View file

@ -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()
}
})
})

View file

@ -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()
}
})
})

View file

@ -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()
}
})
})

View file

@ -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 ])
})
})

View file

@ -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()
}
})
})

View file

@ -172,7 +172,7 @@ describe('Test video abuses', function () {
expect(res.body.data.length).to.equal(0)
})
after(async function () {
after(function () {
killallServers(servers)
})
})

View file

@ -425,7 +425,7 @@ describe('Test video blacklist', function () {
})
})
after(async function () {
after(function () {
killallServers(servers)
})
})

View file

@ -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)
})
})

View file

@ -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])
})
})

View file

@ -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)
})
})

View file

@ -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 ])
})
})

View file

@ -99,7 +99,7 @@ describe('Test video description', function () {
}
})
after(async function () {
after(function () {
killallServers(servers)
})
})

View file

@ -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()
}
})
})

View file

@ -241,7 +241,7 @@ describe('Test video imports', function () {
}
})
after(async function () {
after(function () {
killallServers(servers)
})
})

View file

@ -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 ])
})
})

View file

@ -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()
}
})
})

View file

@ -152,7 +152,7 @@ describe('Test video privacy', function () {
}
})
after(async function () {
after(function () {
killallServers(servers)
})
})

View file

@ -165,7 +165,7 @@ describe('Test video update scheduler', function () {
}
})
after(async function () {
after(function () {
killallServers(servers)
})
})

View file

@ -349,7 +349,7 @@ describe('Test video transcoding', function () {
}
})
after(async function () {
after(function () {
killallServers(servers)
})
})

View file

@ -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()
}
})
})

View file

@ -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()
}
})
})

View file

@ -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()
}
})
})

View file

@ -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()
}
})
})

View file

@ -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)
})
})

View file

@ -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)
})
})

View file

@ -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)
})
})

View file

@ -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' })

View file

@ -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 ])
})
})

View file

@ -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 ])
})
})

View file

@ -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 ])
})
})

View file

@ -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()
}
})
})

View file

@ -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 ])
})
})

View file

@ -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 ])

View file

@ -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<void>((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<ServerInfo>(res => {
server.app = fork(join(root(), 'dist', 'server.js'), args, options)
server.app.stdout.on('data', function onStdout (data) {
let dontContinue = false
flushTests(serverNumber)
.then(() => {
// 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]
}
}
server.app = fork(join(root(), 'dist', 'server.js'), args, options)
server.app.stdout.on('data', function onStdout (data) {
let dontContinue = false
// 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
}
// 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 ]
}
}
// If no, there is maybe one thing not already initialized (client/user credentials generation...)
if (dontContinue === true) return
// 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
}
server.app.stdout.removeListener('data', onStdout)
// If no, there is maybe one thing not already initialized (client/user credentials generation...)
if (dontContinue === true) return
process.on('exit', () => {
try {
process.kill(server.app.pid)
} catch { /* empty */ }
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