Upgrade server packages

pull/125/head
Chocobozzz 2017-10-31 16:31:24 +01:00
parent 604e02abcb
commit 53abc4c272
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
17 changed files with 369 additions and 396 deletions

View File

@ -115,7 +115,7 @@
"standard": "^10.0.0",
"supertest": "^3.0.0",
"tslint": "^5.7.0",
"tslint-config-standard": "^6.0.0",
"tslint-config-standard": "^7.0.0",
"webtorrent": "^0.98.0"
},
"scripty": {

View File

@ -19,7 +19,7 @@ import {
videoRateValidator,
asyncMiddleware
} from '../../../middlewares'
import { UserVideoRateUpdate, VideoRateType } from '../../../../shared'
import { UserVideoRateUpdate } from '../../../../shared'
const rateVideoRouter = express.Router()
@ -73,7 +73,7 @@ async function rateVideo (req: express.Request, res: express.Response) {
if (rateType === 'none') { // Destroy previous rate
await previousRate.destroy()
} else { // Update previous rate
previousRate.type = rateType as VideoRateType
previousRate.type = rateType
await previousRate.save()
}

View File

@ -122,9 +122,6 @@ async function generateWatchHtmlPage (req: express.Request, res: express.Respons
videoPromise
])
file = file as Buffer
video = video as VideoInstance
const html = file.toString()
// Let Angular application handle errors

View File

@ -71,13 +71,13 @@ async function createCertsIfNotExist () {
return
}
return await createCerts()
return createCerts()
}
async function cryptPassword (password: string) {
const salt = await bcryptGenSaltPromise(BCRYPT_SALT_SIZE)
return await bcryptHashPromise(password, salt)
return bcryptHashPromise(password, salt)
}
function getMyPrivateCert () {

View File

@ -3,10 +3,9 @@ import * as express from 'express'
import { database as db } from '../../initializers/database'
import { checkErrors } from './utils'
import { logger, isEachUniqueHostValid } from '../../helpers'
import { logger, isEachUniqueHostValid, isTestInstance } from '../../helpers'
import { CONFIG } from '../../initializers'
import { hasFriends } from '../../lib'
import { isTestInstance } from '../../helpers'
const makeFriendsValidator = [
body('hosts').custom(isEachUniqueHostValid).withMessage('Should have an array of unique hosts'),

View File

@ -1,7 +1,7 @@
import * as Sequelize from 'sequelize'
import * as Promise from 'bluebird'
import { getSort } from '../utils'
import { getSort, addMethodsToModel } from '../utils'
import {
cryptPassword,
comparePassword,
@ -13,7 +13,6 @@ import {
} from '../../helpers'
import { UserRight, USER_ROLE_LABELS, hasUserRight } from '../../../shared'
import { addMethodsToModel } from '../utils'
import {
UserInstance,
UserAttributes,

View File

@ -1,12 +1,11 @@
import * as safeBuffer from 'safe-buffer'
const Buffer = safeBuffer.Buffer
import * as magnetUtil from 'magnet-uri'
import { map } from 'lodash'
import { map, maxBy, truncate } from 'lodash'
import * as parseTorrent from 'parse-torrent'
import { join } from 'path'
import * as Sequelize from 'sequelize'
import * as Promise from 'bluebird'
import { maxBy, truncate } from 'lodash'
import { TagInstance } from './tag-interface'
import {

View File

@ -25,12 +25,12 @@ describe('Test advanced friends', function () {
async function makeFriendsWrapper (podNumber: number) {
const server = servers[podNumber - 1]
return await makeFriends(server.url, server.accessToken)
return makeFriends(server.url, server.accessToken)
}
async function quitFriendsWrapper (podNumber: number) {
const server = servers[podNumber - 1]
return await quitFriends(server.url, server.accessToken)
return quitFriends(server.url, server.accessToken)
}
async function removeFriendWrapper (podNumber: number, podNumberToRemove: number) {
@ -42,12 +42,12 @@ describe('Test advanced friends', function () {
let friendsList = res.body.data
let podToRemove = friendsList.find(friend => (friend.host === serverToRemove.host))
return await quitOneFriend(server.url, server.accessToken, podToRemove.id)
return quitOneFriend(server.url, server.accessToken, podToRemove.id)
}
async function getFriendsListWrapper (podNumber: number) {
const server = servers[podNumber - 1]
return await getFriendsList(server.url)
return getFriendsList(server.url)
}
async function uploadVideoWrapper (podNumber: number) {
@ -56,11 +56,11 @@ describe('Test advanced friends', function () {
}
const server = servers[podNumber - 1]
return await uploadVideo(server.url, server.accessToken, videoAttributes)
return uploadVideo(server.url, server.accessToken, videoAttributes)
}
async function getVideosWrapper (podNumber: number) {
return await getVideosList(servers[podNumber - 1].url)
return getVideosList(servers[podNumber - 1].url)
}
// ---------------------------------------------------------------

View File

@ -80,11 +80,15 @@ start()
async function start () {
const servers = await runServers(numberOfPods)
process.on('exit', async () => await exitServers(servers, flushAtExit))
process.on('exit', async () => {
await exitServers(servers, flushAtExit)
return
})
process.on('SIGINT', goodbye)
process.on('SIGTERM', goodbye)
console.log('Servers runned')
console.log('Servers ran')
initializeRequestsPerServer(servers)
let checking = false
@ -150,10 +154,8 @@ function getRandomNumServer (servers) {
}
async function runServers (numberOfPods: number) {
let servers = null
// Run servers
servers = await flushAndRunMultipleServers(numberOfPods)
const servers: ServerInfo[] = (await flushAndRunMultipleServers(numberOfPods))
.map(s => Object.assign({ requestsNumber: 0 }, s))
// Get the access tokens
await setAccessTokensToServers(servers)

View File

@ -1,7 +1,6 @@
import * as program from 'commander'
import * as Promise from 'bluebird'
import { isAbsolute } from 'path'
import { join } from 'path'
import { isAbsolute, join } from 'path'
import { readdirPromise } from '../../../helpers/core-utils'
import { execCLI } from '../../utils'

View File

@ -33,7 +33,7 @@ interface ServerInfo {
}
}
async function flushAndRunMultipleServers (totalServers) {
function flushAndRunMultipleServers (totalServers) {
let apps = []
let i = 0

694
yarn.lock

File diff suppressed because it is too large Load Diff