21. Test example
describe('##getConfiguration', function () {
it('should return promise and resolve with data ', function (done) {
var promise = sysStore.getConfiguration('somekey');
promise.should.eventually.become({key: 'somekey'})
.then(function () {
mockDb.getItem.should.be.calledWithMatch(
mockTables.system,
{key: sinon.match.string}
);
})
.should.notify(done);
});
});
23. Test Env How-to
Goals:
-
run from root using mvn test
run from sub using npm test
human-readable result logs
result >> in console and file
Jenkins support
http://www.mindmeister.com/346337860
25. Test Env How-to
runtest.sh
#!/bin/bash
mocha $(find test -name '*.js') -R tap |
tee test/testresults.tap; (exit ${PIPESTATUS[0]})
The whole command runs in a single line. Wrapped here for display purpose
28. Build process
-
No npm install on build server (too slooow)
-
Fixed deps versions (update by-hand)
-
All deployable deps are checked in!
-
Build phase only copies deps in subprojects
http://www.futurealoof.com/posts/nodemodules-in-git.html
31. Deployment
upstart (server.conf)
#this should be put in /etc/init/server.conf on Ubuntu
description ”Node.js server"
author
"Alexey Migutsky"
# used to be: start on startup
# until we found some mounts weren't ready yet while booting:
start on started mountall
stop on shutdown
# Automatically Respawn:
respawn
respawn limit 20 5
# Max open files are @ 1024 by default. Bit few.
limit nofile 32768 32768
script
# Not sure why $HOME is needed, but we found that it is:
export HOME="/root”
exec /usr/local/bin/node /usr/local/server/app.js >> /var/log/server-err.log 2>&1
end script
post-start script
end script
http://kvz.io/blog/2009/12/15/run-nodejs-as-a-service-on-ubuntu-karmic/