mirror of
https://github.com/verdaccio/verdaccio.git
synced 2025-02-17 23:45:29 -05:00
add stuff for testing against fd leaks and memory leaks
This commit is contained in:
parent
fdbde9eb87
commit
5dd720cc21
4 changed files with 23 additions and 1 deletions
|
@ -21,6 +21,7 @@ var pkg_file = '../package.yaml'
|
|||
, commander = require('commander')
|
||||
, server = require('./index')
|
||||
, crypto = require('crypto')
|
||||
, Path = require('path')
|
||||
, pkg = yaml.safeLoad(fs.readFileSync(__dirname + '/' + pkg_file, 'utf8'))
|
||||
|
||||
commander
|
||||
|
@ -101,7 +102,7 @@ function get_hostport() {
|
|||
|
||||
function afterConfigLoad() {
|
||||
if (!config.user_agent) config.user_agent = 'Sinopia/'+pkg.version
|
||||
if (!config.self_path) config.self_path = config_path
|
||||
if (!config.self_path) config.self_path = Path.resolve(config_path)
|
||||
|
||||
logger.setup(config.logs)
|
||||
|
||||
|
|
15
lib/index.js
15
lib/index.js
|
@ -498,6 +498,21 @@ module.exports = function(config_hash) {
|
|||
})
|
||||
})
|
||||
|
||||
// hook for tests only
|
||||
if (config._debug) {
|
||||
app.get('/-/_debug', function(req, res) {
|
||||
var do_gc = typeof(global.gc) !== 'undefined'
|
||||
if (do_gc) global.gc()
|
||||
res.send({
|
||||
pid: process.pid,
|
||||
main: process.mainModule.filename,
|
||||
conf: config.self_path,
|
||||
mem: process.memoryUsage(),
|
||||
gc: do_gc,
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
app.use(app.router)
|
||||
app.use(function(err, req, res, next) {
|
||||
if (typeof(res.report_error) !== 'function') {
|
||||
|
|
|
@ -57,3 +57,6 @@ packages:
|
|||
allow_access: none
|
||||
|
||||
listen: 55551
|
||||
|
||||
# expose internal methods
|
||||
_debug: true
|
||||
|
|
|
@ -37,3 +37,6 @@ packages:
|
|||
allow_publish: test anonymous
|
||||
|
||||
listen: 55552
|
||||
|
||||
# expose internal methods
|
||||
_debug: true
|
||||
|
|
Loading…
Add table
Reference in a new issue