UNPKG

workforce

Version:

A cluster manager inspired by Learnboost's cluster.

40 lines (31 loc) 1.39 kB
var workforce = require('../') , os = require('os'); describe('workforce', function(){ describe('when initialized', function(){ var app = workforce(__dirname + '/server'); it('should resolve the absolute path', function(){ app.server.should.equal(__dirname + '/server'); }); it('should set the environment to NODE_ENV', function(){ app.env.should.equal(process.env.NODE_ENV || 'development'); }); it('should set the defaults', function(){ var defaults = app.settings; defaults.should.have.property('exit timeout', 15000); defaults.should.have.property('restart threshold', 5000); defaults.should.have.property('title', 'workforce'); defaults.should.have.property('working directory', process.cwd()); defaults.should.have.property('silent', false); defaults.should.have.property('exit timeout', 15000); defaults.should.have.property('workers', os.cpus().length); var signals = defaults.signals; signals.should.have.property('shutdown', 'SIGTERM'); signals.should.have.property('restart', 'SIGUSR2'); }); // it('should bind event handlers for kill signals', function(){ // process.listeners('SIGTERM').should.have.length(1); // process.listeners('SIGUSR2').should.have.length(1); // process.listeners('SIGKILL').should.have.length(1); // }); }); });