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" &
before(async function () {
this.timeout(30000)
- await flushTests()
-
servers = await flushAndRunMultipleServers(2)
await setAccessTokensToServers(servers)
expect(res.header.location).to.equal('http://localhost:9001/videos/watch/' + videoUUID)
})
- after(async function () {
+ after(function () {
killallServers(servers)
})
})
killallServers(servers)
await closeAllSequelize(servers)
-
- // Keep the logs if the test failed
- if (this['ok']) {
- await flushTests()
- }
})
})
})
})
- after(async function () {
+ after(function () {
killallServers(servers)
})
})
killallServers(servers)
await closeAllSequelize(servers)
-
- // Keep the logs if the test failed
- if (this['ok']) {
- await flushTests()
- }
})
})
import 'mocha'
-import { flushTests, killallServers, runServer, ServerInfo } from '../../../../shared/extra-utils'
+import { flushTests, killallServers, flushAndRunServer, ServerInfo } from '../../../../shared/extra-utils'
import {
checkBadCountPagination,
checkBadSortPagination,
before(async function () {
this.timeout(30000)
- await flushTests()
-
- server = await runServer(1)
+ server = await flushAndRunServer(1)
})
describe('When listing accounts', function () {
})
})
- after(async function () {
+ after(function () {
killallServers([ server ])
-
- // Keep the logs if the test failed
- if (this['ok']) {
- await flushTests()
- }
})
})
before(async function () {
this.timeout(60000)
- await flushTests()
-
servers = await flushAndRunMultipleServers(2)
await setAccessTokensToServers(servers)
})
})
- after(async function () {
+ after(function () {
killallServers(servers)
-
- // Keep the logs if the test failed
- if (this['ok']) {
- await flushTests()
- }
})
})
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'
before(async function () {
this.timeout(30000)
- await flushTests()
- server = await runServer(1)
+ server = await flushAndRunServer(1)
await setAccessTokensToServers([ server ])
})
})
- after(async function () {
+ after(function () {
killallServers([ server ])
-
- // Keep the logs if the test failed
- if (this['ok']) {
- await flushTests()
- }
})
})
immutableAssign,
killallServers,
reRunServer,
- runServer,
+ flushAndRunServer,
ServerInfo,
setAccessTokensToServers
} from '../../../../shared/extra-utils'
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 () {
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()
- }
})
})
createUser,
flushTests,
killallServers,
- runServer,
+ flushAndRunServer,
ServerInfo,
setAccessTokensToServers,
userLogin
before(async function () {
this.timeout(120000)
- await flushTests()
-
- server = await runServer(1)
+ server = await flushAndRunServer(1)
await setAccessTokensToServers([ server ])
})
})
- after(async function () {
+ after(function () {
killallServers([ server ])
-
- // Keep the logs if the test failed
- if (this['ok']) {
- await flushTests()
- }
})
})
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 {
before(async function () {
this.timeout(30000)
- await flushTests()
- server = await runServer(1)
+ server = await flushAndRunServer(1)
await setAccessTokensToServers([ server ])
})
})
})
- after(async function () {
+ after(function () {
killallServers([ server ])
-
- // Keep the logs if the test failed
- if (this['ok']) {
- await flushTests()
- }
})
})
createUser,
flushTests,
killallServers,
- runServer,
+ flushAndRunServer,
ServerInfo,
setAccessTokensToServers,
userLogin
before(async function () {
this.timeout(120000)
- await flushTests()
-
- server = await runServer(1)
+ server = await flushAndRunServer(1)
await setAccessTokensToServers([ server ])
})
})
- after(async function () {
+ after(function () {
killallServers([ server ])
-
- // Keep the logs if the test failed
- if (this['ok']) {
- await flushTests()
- }
})
})
createUser,
flushTests,
killallServers,
- runServer,
+ flushAndRunServer,
ServerInfo,
setAccessTokensToServers,
userLogin
before(async function () {
this.timeout(120000)
- await flushTests()
-
- server = await runServer(1)
+ server = await flushAndRunServer(1)
await setAccessTokensToServers([ server ])
})
})
- after(async function () {
+ after(function () {
killallServers([ server ])
-
- // Keep the logs if the test failed
- if (this['ok']) {
- await flushTests()
- }
})
})
before(async function () {
this.timeout(30000)
- await flushTests()
servers = await flushAndRunMultipleServers(2)
await setAccessTokensToServers(servers)
})
})
- after(async function () {
+ after(function () {
killallServers(servers)
-
- // Keep the logs if the test failed
- if (this['ok']) {
- await flushTests()
- }
})
})
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,
before(async function () {
this.timeout(30000)
- await flushTests()
-
- server = await runServer(1)
+ server = await flushAndRunServer(1)
})
describe('When searching videos', function () {
})
})
- after(async function () {
+ after(function () {
killallServers([ server ])
-
- // Keep the logs if the test failed
- if (this['ok']) {
- await flushTests()
- }
})
})
flushTests,
killallServers,
makeGetRequest,
- runServer,
+ flushAndRunServer,
ServerInfo,
setAccessTokensToServers,
uploadVideo
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' })
})
})
- after(async function () {
+ after(function () {
killallServers([ server ])
-
- // Keep the logs if the test failed
- if (this['ok']) {
- await flushTests()
- }
})
})
makeGetRequest,
makePostBodyRequest,
makePutBodyRequest,
- runServer,
+ flushAndRunServer,
ServerInfo,
setAccessTokensToServers,
wait
before(async function () {
this.timeout(30000)
- await flushTests()
-
- server = await runServer(1)
+ server = await flushAndRunServer(1)
await setAccessTokensToServers([ server ])
})
})
})
- after(async function () {
+ after(function () {
killallServers([ server ])
-
- // Keep the logs if the test failed
- if (this['ok']) {
- await flushTests()
- }
})
})
makeDeleteRequest,
makeGetRequest,
makePostBodyRequest,
- runServer,
+ flushAndRunServer,
ServerInfo,
setAccessTokensToServers,
userLogin
before(async function () {
this.timeout(30000)
- await flushTests()
-
- server = await runServer(1)
+ server = await flushAndRunServer(1)
await setAccessTokensToServers([ server ])
})
})
- after(async function () {
+ after(function () {
killallServers([ server ])
-
- // Keep the logs if the test failed
- if (this['ok']) {
- await flushTests()
- }
})
})
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 {
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 ])
})
})
- after(async function () {
+ after(function () {
killallServers([ server, serverWithRegistrationDisabled ])
-
- // Keep the logs if the test failed
- if (this['ok']) {
- await flushTests()
- }
})
})
killallServers,
makeGetRequest,
makePostBodyRequest,
- runServer,
+ flushAndRunServer,
ServerInfo,
setAccessTokensToServers,
updateVideoAbuse,
before(async function () {
this.timeout(30000)
- await flushTests()
-
- server = await runServer(1)
+ server = await flushAndRunServer(1)
await setAccessTokensToServers([ server ])
})
})
- after(async function () {
+ after(function () {
killallServers([ server ])
-
- // Keep the logs if the test failed
- if (this['ok']) {
- await flushTests()
- }
})
})
before(async function () {
this.timeout(120000)
- await flushTests()
servers = await flushAndRunMultipleServers(2)
await setAccessTokensToServers(servers)
})
})
- after(async function () {
+ after(function () {
killallServers(servers)
-
- // Keep the logs if the test failed
- if (this['ok']) {
- await flushTests()
- }
})
})
makeDeleteRequest,
makeGetRequest,
makeUploadRequest,
- runServer,
+ flushAndRunServer,
ServerInfo,
setAccessTokensToServers,
uploadVideo,
before(async function () {
this.timeout(30000)
- await flushTests()
-
- server = await runServer(1)
+ server = await flushAndRunServer(1)
await setAccessTokensToServers([ server ])
})
})
- after(async function () {
+ after(function () {
killallServers([ server ])
-
- // Keep the logs if the test failed
- if (this['ok']) {
- await flushTests()
- }
})
})
makePostBodyRequest,
makePutBodyRequest,
makeUploadRequest,
- runServer,
+ flushAndRunServer,
ServerInfo,
setAccessTokensToServers,
userLogin
before(async function () {
this.timeout(30000)
- await flushTests()
-
- server = await runServer(1)
+ server = await flushAndRunServer(1)
await setAccessTokensToServers([ server ])
})
})
- after(async function () {
+ after(function () {
killallServers([ server ])
-
- // Keep the logs if the test failed
- if (this['ok']) {
- await flushTests()
- }
})
})
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 {
before(async function () {
this.timeout(30000)
- await flushTests()
-
- server = await runServer(1)
+ server = await flushAndRunServer(1)
await setAccessTokensToServers([ server ])
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()
- }
})
})
makeGetRequest,
makePostBodyRequest,
makeUploadRequest,
- runServer,
+ flushAndRunServer,
ServerInfo,
setAccessTokensToServers,
updateCustomSubConfig,
before(async function () {
this.timeout(30000)
- await flushTests()
-
- server = await runServer(1)
+ server = await flushAndRunServer(1)
await setAccessTokensToServers([ server ])
})
})
- after(async function () {
+ after(function () {
killallServers([ server ])
-
- // Keep the logs if the test failed
- if (this['ok']) {
- await flushTests()
- }
})
})
makeGetRequest,
removeVideoFromPlaylist,
reorderVideosPlaylist,
- runServer,
+ flushAndRunServer,
ServerInfo,
setAccessTokensToServers, setDefaultVideoChannel,
updateVideoPlaylist,
before(async function () {
this.timeout(30000)
- await flushTests()
-
- server = await runServer(1)
+ server = await flushAndRunServer(1)
await setAccessTokensToServers([ server ])
await setDefaultVideoChannel([ server ])
})
})
- after(async function () {
+ after(function () {
killallServers([ server ])
-
- // Keep the logs if the test failed
- if (this['ok']) {
- await flushTests()
- }
})
})
flushTests,
killallServers,
makeGetRequest,
- runServer,
+ flushAndRunServer,
ServerInfo,
setAccessTokensToServers, setDefaultVideoChannel,
userLogin
before(async function () {
this.timeout(30000)
- await flushTests()
-
- server = await runServer(1)
+ server = await flushAndRunServer(1)
await setAccessTokensToServers([ server ])
await setDefaultVideoChannel([ server ])
})
})
- after(async function () {
+ after(function () {
killallServers([ server ])
-
- // Keep the logs if the test failed
- if (this['ok']) {
- await flushTests()
- }
})
})
makeGetRequest,
makePostBodyRequest,
makePutBodyRequest,
- runServer,
+ flushAndRunServer,
ServerInfo,
setAccessTokensToServers,
uploadVideo
before(async function () {
this.timeout(30000)
- await flushTests()
-
- server = await runServer(1)
+ server = await flushAndRunServer(1)
await setAccessTokensToServers([ server ])
})
})
- after(async function () {
+ after(function () {
killallServers([ server ])
-
- // Keep the logs if the test failed
- if (this['ok']) {
- await flushTests()
- }
})
})
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,
before(async function () {
this.timeout(30000)
- await flushTests()
-
- server = await runServer(1)
+ server = await flushAndRunServer(1)
await setAccessTokensToServers([ server ])
})
})
- after(async function () {
+ after(function () {
killallServers([ server ])
-
- // Keep the logs if the test failed
- if (this['ok']) {
- await flushTests()
- }
})
})
await MockSmtpServer.Instance.collectEmails(emails)
- await flushTests()
-
const overrideConfig = {
smtp: {
hostname: 'localhost'
})
})
- after(async function () {
+ after(function () {
MockSmtpServer.Instance.kill()
killallServers(servers)
before(async function () {
this.timeout(120000)
- await flushTests()
-
servers = await flushAndRunMultipleServers(2)
await setAccessTokensToServers(servers)
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()
- }
})
})
before(async function () {
this.timeout(120000)
- await flushTests()
-
servers = await flushAndRunMultipleServers(2)
await setAccessTokensToServers(servers)
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()
- }
})
})
advancedVideosSearch,
flushTests,
killallServers,
- runServer,
+ flushAndRunServer,
searchVideo,
ServerInfo,
setAccessTokensToServers,
before(async function () {
this.timeout(30000)
- await flushTests()
-
- server = await runServer(1)
+ server = await flushAndRunServer(1)
await setAccessTokensToServers([ server ])
}
})
- after(async function () {
+ after(function () {
killallServers([ server ])
-
- // Keep the logs if the test failed
- if (this['ok']) {
- await flushTests()
- }
})
})
getConfig,
getCustomConfig,
registerUser,
- runServer,
+ flushAndRunServer,
setAccessTokensToServers,
updateCustomConfig
} from '../../../../shared/extra-utils'
before(async function () {
this.timeout(30000)
-
- await flushTests()
- server = await runServer(1)
+ server = await flushAndRunServer(1)
await setAccessTokensToServers([ server ])
})
checkInitialConfig(data)
})
- after(async function () {
+ after(function () {
killallServers([ server ])
})
})
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'
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 ])
})
})
})
- after(async function () {
+ after(function () {
MockSmtpServer.Instance.kill()
killallServers([ server ])
})
createUser, removeVideoFromBlacklist,
reportVideoAbuse,
resetPassword,
- runServer,
+ flushAndRunServer,
unblockUser,
uploadVideo,
userLogin,
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 ])
{
})
})
- after(async function () {
+ after(function () {
MockSmtpServer.Instance.kill()
killallServers([ server ])
})
})
})
- after(async function () {
+ after(function () {
killallServers(servers)
})
})
}
})
- after(async function () {
+ after(function () {
killallServers(servers)
})
})
})
- after(async function () {
+ after(function () {
killallServers(servers)
})
})
}
})
- after(async function () {
+ after(function () {
killallServers(servers)
})
})
expect(dateIsValid(job.finishedOn)).to.be.true
})
- after(async function () {
+ after(function () {
killallServers(servers)
})
})
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'
before(async function () {
this.timeout(30000)
- await flushTests()
-
- server = await runServer(1)
+ server = await flushAndRunServer(1)
await setAccessTokensToServers([ server ])
})
}
})
- after(async function () {
+ after(function () {
killallServers([ server ])
})
})
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
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 () {
return req.expect(404)
})
- after(async function () {
+ after(function () {
killallServers([ server ])
-
- // Keep the logs if the test failed
- if (this['ok']) {
- await flushTests()
- }
})
})
import {
getConfig,
flushTests,
- runServer,
+ flushAndRunServer,
registerUser, getCustomConfig, setAccessTokensToServers, updateCustomConfig
} from '../../../../shared/extra-utils/index'
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, {})
await userLogin(server, user, 429)
})
- after(async function () {
+ after(function () {
killallServers([ server ])
})
})
before(async function () {
this.timeout(60000)
-
- await flushTests()
servers = await flushAndRunMultipleServers(3)
await setAccessTokensToServers(servers)
expect(data.totalInstanceFollowers).to.equal(0)
})
- after(async function () {
+ after(function () {
killallServers(servers)
})
})
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'
before(async function () {
this.timeout(60000)
-
- await flushTests()
- server = await runServer(1)
+ server = await flushAndRunServer(1)
await setAccessTokensToServers([ server ])
{
})
})
- after(async function () {
+ after(function () {
killallServers([ server ])
})
})
before(async function () {
this.timeout(60000)
- await flushTests()
-
servers = await flushAndRunMultipleServers(2)
await setAccessTokensToServers(servers)
})
})
- after(async function () {
+ after(function () {
killallServers(servers)
-
- // Keep the logs if the test failed
- if (this[ 'ok' ]) {
- await flushTests()
- }
})
})
}
})
- after(async function () {
+ after(function () {
killallServers(servers)
})
})
}
})
- after(async function () {
+ after(function () {
killallServers(servers)
})
})
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'
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 ])
})
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()
- }
})
})
registerUser,
removeUser,
removeVideo,
- runServer,
+ flushAndRunServer,
ServerInfo,
testImage,
unblockUser,
before(async function () {
this.timeout(30000)
-
- await flushTests()
- server = await runServer(1)
+ server = await flushAndRunServer(1)
await setAccessTokensToServers([ server ])
})
})
})
- after(async function () {
+ after(function () {
killallServers([ server ])
-
- // Keep the logs if the test failed
- if (this[ 'ok' ]) {
- await flushTests()
- }
})
})
})
})
- after(async function () {
+ after(function () {
killallServers(servers)
-
- // Keep the logs if the test failed
- if (this['ok']) {
- await flushTests()
- }
})
})
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
before(async function () {
this.timeout(30000)
- await flushTests()
-
- server = await runServer(1)
+ server = await flushAndRunServer(1)
await setAccessTokensToServers([ server ])
expect(res.body).to.not.have.property('thumbnail_height')
})
- after(async function () {
+ after(function () {
killallServers([ server ])
})
})
killallServers,
rateVideo,
removeVideo,
- runServer,
+ flushAndRunServer,
ServerInfo,
setAccessTokensToServers,
testImage,
before(async function () {
this.timeout(30000)
- await flushTests()
-
- server = await runServer(1)
+ server = await flushAndRunServer(1)
await setAccessTokensToServers([ server ])
})
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()
- }
})
})
expect(res.body.data.length).to.equal(0)
})
- after(async function () {
+ after(function () {
killallServers(servers)
})
})
})
})
- after(async function () {
+ after(function () {
killallServers(servers)
})
})
before(async function () {
this.timeout(30000)
- await flushTests()
-
servers = await flushAndRunMultipleServers(2)
await setAccessTokensToServers(servers)
await checkVideoFilesWereRemoved(videoUUID, 1)
})
- after(async function () {
+ after(function () {
killallServers(servers)
})
})
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'
}
})
- after(async function () {
+ after(function () {
killallServers(servers)
})
})
this.timeout(50000)
// Run one server
- await flushTests()
- server = await runServer(1)
+ server = await flushAndRunServer(1)
await setAccessTokensToServers([server])
const videoQuota = 42000000
await acceptChangeOwnership(server.url, secondUserAccessToken, lastRequestChangeOwnershipId, channelId, 403)
})
- after(async function () {
+ after(function () {
killallServers([server])
})
})
before(async function () {
this.timeout(30000)
- await flushTests()
-
servers = await flushAndRunMultipleServers(2)
await setAccessTokensToServers(servers)
}
})
- after(async function () {
+ after(function () {
killallServers(servers)
})
})
dateIsValid,
flushTests,
killallServers,
- runServer,
+ flushAndRunServer,
ServerInfo,
setAccessTokensToServers,
updateMyAvatar,
before(async function () {
this.timeout(30000)
- await flushTests()
-
- server = await runServer(1)
+ server = await flushAndRunServer(1)
await setAccessTokensToServers([ server ])
expect(res.body.data[1].totalReplies).to.equal(0)
})
- after(async function () {
+ after(function () {
killallServers([ server ])
})
})
}
})
- after(async function () {
+ after(function () {
killallServers(servers)
})
})
}
})
- after(async function () {
+ after(function () {
killallServers(servers)
-
- // Keep the logs if the test failed
- if (this['ok']) {
- await flushTests()
- }
})
})
}
})
- after(async function () {
+ after(function () {
killallServers(servers)
})
})
getMyUserInformation,
getVideoChannelVideos,
getVideosListWithToken,
- runServer,
+ flushAndRunServer,
searchVideo,
searchVideoWithToken,
updateCustomConfig,
before(async function () {
this.timeout(50000)
-
- await flushTests()
- server = await runServer(1)
+ server = await flushAndRunServer(1)
// Get the access tokens
await setAccessTokensToServers([ server ])
})
})
- after(async function () {
+ after(function () {
killallServers([ server ])
})
})
}
})
- after(async function () {
+ after(function () {
killallServers(servers)
-
- // Keep the logs if the test failed
- if (this['ok']) {
- await flushTests()
- }
})
})
}
})
- after(async function () {
+ after(function () {
killallServers(servers)
})
})
}
})
- after(async function () {
+ after(function () {
killallServers(servers)
})
})
}
})
- after(async function () {
+ after(function () {
killallServers(servers)
})
})
before(async function () {
this.timeout(120000)
- await flushTests()
-
servers = await flushAndRunMultipleServers(2)
await setAccessTokensToServers(servers)
})
})
- after(async function () {
+ after(function () {
killallServers(servers)
-
- // Keep the logs if the test failed
- if (this['ok']) {
- await flushTests()
- }
})
})
getVideosListWithToken,
getVideoWithToken,
killallServers, reRunServer,
- runServer,
+ flushAndRunServer,
searchVideoWithToken,
ServerInfo,
setAccessTokensToServers,
before(async function () {
this.timeout(30000)
- await flushTests()
-
- server = await runServer(1)
+ server = await flushAndRunServer(1)
await setAccessTokensToServers([ server ])
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()
- }
})
})
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'
before(async function () {
this.timeout(30000)
- await flushTests()
-
- server = await runServer(1)
+ server = await flushAndRunServer(1)
await setAccessTokensToServers([ server ])
})
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()
- }
})
})
flushTests,
killallServers,
reRunServer,
- runServer,
+ flushAndRunServer,
ServerInfo,
setAccessTokensToServers,
uploadVideo, uploadVideoAndGetId, viewVideo, wait, countVideoViewsOf, doubleFollow, waitJobs
before(async function () {
this.timeout(50000)
- await flushTests()
-
servers = await flushAndRunMultipleServers(2)
await setAccessTokensToServers(servers)
}
})
- after(async function () {
+ after(function () {
killallServers(servers)
-
- // Keep the logs if the test failed
- if (this['ok']) {
- await flushTests()
- }
})
})
before(async function () {
this.timeout(90000)
- await flushTests()
// Run server 2 to have transcoding enabled
servers = await flushAndRunMultipleServers(2)
}
})
- after(async function () {
+ after(function () {
killallServers(servers)
})
})
before(async function () {
this.timeout(60000)
- await flushTests()
-
// Run server 2 to have transcoding enabled
servers = await flushAndRunMultipleServers(2)
await setAccessTokensToServers(servers)
}
})
- after(async function () {
+ after(function () {
killallServers(servers)
})
})
before(async function () {
this.timeout(200000)
- await flushTests()
-
// Run server 2 to have transcoding enabled
servers = await flushAndRunMultipleServers(2)
await setAccessTokensToServers(servers)
}
})
- after(async function () {
+ after(function () {
killallServers(servers)
})
})
flushTests,
getEnvCli,
killallServers,
- runServer,
+ flushAndRunServer,
ServerInfo,
setAccessTokensToServers
} from '../../../shared/extra-utils'
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' })
getEnvCli,
killallServers,
login,
- runServer,
+ flushAndRunServer,
ServerInfo,
setAccessTokensToServers
} from '../../../shared/extra-utils'
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' })
await login(server.url, server.client, { username: 'user_1', password: 'coucou' }, 200)
})
- after(async function () {
+ after(function () {
killallServers([ server ])
})
})
killallServers,
makeActivityPubGetRequest,
parseTorrentVideo,
- runServer,
+ flushAndRunServer,
ServerInfo,
setAccessTokensToServers,
uploadVideo
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
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`)
}
})
- after(async function () {
+ after(function () {
killallServers([ server ])
})
})
getVideosList,
killallServers,
makeHTMLRequest,
- runServer,
+ flushAndRunServer,
ServerInfo,
serverLogin,
updateCustomConfig,
before(async function () {
this.timeout(120000)
- await flushTests()
-
- server = await runServer(1)
+ server = await flushAndRunServer(1)
server.accessToken = await serverLogin(server)
const videoAttributes = {
checkIndexTags(res.text, 'PeerTube updated', 'my short description', 'body { background-color: red; }')
})
- after(async function () {
+ after(function () {
killallServers([ server ])
})
})
})
})
- after(async function () {
+ after(function () {
killallServers(servers)
-
- // Keep the logs if the test failed
- if (this['ok']) {
- await flushTests()
- }
})
})
flushTests,
killallServers,
makeGetRequest,
- runServer,
+ flushAndRunServer,
ServerInfo,
setAccessTokensToServers,
uploadVideo
before(async function () {
this.timeout(120000)
- await flushTests()
-
- server = await runServer(1)
+ server = await flushAndRunServer(1)
await setAccessTokensToServers([ server ])
})
})
})
- after(async function () {
+ after(function () {
killallServers([ server ])
})
})
getVideosList,
killallServers,
rateVideo,
- runServer,
+ flushAndRunServer,
ServerInfo,
setAccessTokensToServers,
uploadVideo
// ----------------------------------------------------------------------------
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 ])
}
}
- 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()
})
}
-function runServer (serverNumber: number, configOverride?: Object, args = []) {
+function flushAndRunServer (serverNumber: number, configOverride?: Object, args = []) {
const server: ServerInfo = {
app: null,
serverNumber: serverNumber,
}
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
-
- // 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
ServerInfo,
flushAndRunMultipleServers,
flushTests,
- runServer,
+ flushAndRunServer,
killallServers,
reRunServer,
waitUntilLog