2014-11-12 13:05:07 +01:00
|
|
|
require('es6-shim')
|
2013-12-19 16:11:54 +01:00
|
|
|
require('./lib/startup')
|
|
|
|
|
|
|
|
var assert = require('assert')
|
2014-11-12 12:14:37 +01:00
|
|
|
var async = require('async')
|
|
|
|
var exec = require('child_process').exec
|
2013-12-19 16:11:54 +01:00
|
|
|
|
|
|
|
describe('Func', function() {
|
2014-11-12 12:14:37 +01:00
|
|
|
var server = process.server
|
|
|
|
var server2 = process.server2
|
2013-12-29 07:40:47 +01:00
|
|
|
|
2014-11-12 12:14:37 +01:00
|
|
|
before(function(cb) {
|
|
|
|
async.parallel([
|
|
|
|
function(cb) {
|
|
|
|
require('./lib/startup').start('./test-storage', './config-1.yaml', cb)
|
|
|
|
},
|
|
|
|
function(cb) {
|
|
|
|
require('./lib/startup').start('./test-storage2', './config-2.yaml', cb)
|
|
|
|
},
|
|
|
|
], cb)
|
|
|
|
})
|
2013-12-19 16:11:54 +01:00
|
|
|
|
2014-11-12 12:14:37 +01:00
|
|
|
before(function(cb) {
|
|
|
|
async.map([server, server2], function(server, cb) {
|
|
|
|
server.debug(function(res, body) {
|
|
|
|
server.pid = body.pid
|
|
|
|
exec('lsof -p ' + Number(server.pid), function(err, result) {
|
2015-03-28 19:25:53 +01:00
|
|
|
assert.equal(err, null)
|
2015-03-28 19:30:19 +01:00
|
|
|
server.fdlist = result.replace(/ +/g, ' ')
|
2014-11-12 12:14:37 +01:00
|
|
|
cb()
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}, cb)
|
|
|
|
})
|
2014-09-25 03:21:59 +02:00
|
|
|
|
2014-11-12 12:14:37 +01:00
|
|
|
before(function auth(cb) {
|
|
|
|
async.map([server, server2], function(server, cb) {
|
|
|
|
server.auth('test', 'test', function(res, body) {
|
|
|
|
assert.equal(res.statusCode, 201)
|
2014-11-16 18:44:46 +01:00
|
|
|
assert.notEqual(body.ok.indexOf("'test'"), -1)
|
2014-11-12 12:14:37 +01:00
|
|
|
cb()
|
|
|
|
})
|
|
|
|
}, cb)
|
|
|
|
})
|
2013-12-19 16:11:54 +01:00
|
|
|
|
2014-11-12 12:14:37 +01:00
|
|
|
it('authenticate', function(){/* test for before() */})
|
2013-12-19 16:11:54 +01:00
|
|
|
|
2014-11-12 12:14:37 +01:00
|
|
|
require('./basic')()
|
|
|
|
require('./gh29')()
|
|
|
|
require('./tags')()
|
|
|
|
require('./gzip')()
|
|
|
|
require('./incomplete')()
|
|
|
|
require('./mirror')()
|
|
|
|
require('./newnpmreg')()
|
|
|
|
require('./nullstorage')()
|
|
|
|
require('./race')()
|
|
|
|
require('./racycrash')()
|
2014-12-14 21:29:56 +01:00
|
|
|
require('./scoped')()
|
2014-11-12 12:14:37 +01:00
|
|
|
require('./security')()
|
|
|
|
require('./adduser')()
|
|
|
|
require('./addtag')()
|
2014-09-25 03:21:59 +02:00
|
|
|
|
2014-11-12 12:14:37 +01:00
|
|
|
after(function(cb) {
|
|
|
|
async.map([server, server2], function(server, cb) {
|
|
|
|
exec('lsof -p ' + Number(server.pid), function(err, result) {
|
2015-03-28 19:25:53 +01:00
|
|
|
assert.equal(err, null)
|
2015-03-28 19:30:19 +01:00
|
|
|
result = result.split('\n').filter(function(q) {
|
2014-11-12 12:14:37 +01:00
|
|
|
if (q.match(/TCP .*->.* \(ESTABLISHED\)/)) return false
|
|
|
|
if (q.match(/\/libcrypt-[^\/]+\.so/)) return false
|
|
|
|
if (q.match(/\/node_modules\/crypt3\/build\/Release/)) return false
|
|
|
|
return true
|
2015-03-28 19:30:19 +01:00
|
|
|
}).join('\n').replace(/ +/g, ' ')
|
|
|
|
|
|
|
|
assert.equal(server.fdlist, result)
|
2014-11-12 12:14:37 +01:00
|
|
|
cb()
|
|
|
|
})
|
|
|
|
}, cb)
|
|
|
|
})
|
2013-12-19 16:11:54 +01:00
|
|
|
})
|
|
|
|
|