workers tests are now more explicite

This commit is contained in:
jshkurti 2014-11-17 11:23:28 +01:00
parent 280dd561b6
commit a68edc4208
2 changed files with 21 additions and 31 deletions

View File

@ -1,5 +1,4 @@
var vizion = require('vizion');
var cst = require('../constants.js');
var async = require('async');
@ -25,7 +24,7 @@ module.exports = function(God) {
if (err != null)
return false;
debug('%s parsed', proc.pm2_env.name);
debug('[WORKER] %s parsed', proc.pm2_env.name);
proc.pm2_env.versioning = meta;
proc.pm2_env.versioning.repo_path = repo_path;
return cb(null);
@ -36,9 +35,9 @@ module.exports = function(God) {
var processes = God.clusters_db;
async.eachLimit(Object.keys(processes), 1, function(proc_key, next) {
var proc = processes[proc_key + ''];
var proc = processes[proc_key];
debug('Processing task on proc id', proc_key);
debug('[WORKER] Processing task on proc id', proc_key);
versioning_refresh(proc, next);
}, function(err) {

View File

@ -31,58 +31,49 @@ git checkout hotfix
$pm2 start ./process.json --name app
sleep 5
#
# @joni please replace $1 by sentences
# else we cant understand what is happening
#
OUT=`$pm2 ls | grep errored | wc -l`
[ $OUT -eq 1 ] || fail "$1"
success "$1"
[ $OUT -eq 1 ] || fail "Process should be errored because node_modules are missing"
success "Process should be errored because node_modules are missing"
OUT=`$pm2 info 0 | grep remote | egrep -oh 'https://([^ ]+)'`
[ $OUT = "https://github.com/keymetrics/app-playground.git" ] || fail "$1"
success "$1"
[ $OUT = "https://github.com/keymetrics/app-playground.git" ] || fail "Remote URL should be right"
success "Remote URL should be right"
OUT=`$pm2 backward app | wc -l`
[ $OUT -eq 13 ] || fail "$1"
success "$1"
[ $OUT -eq 13 ] || fail "Backward method should work properly and print adequate output"
success "Backward method should work properly and print adequate output"
OUT=`$pm2 forward app | wc -l`
[ $OUT -eq 13 ] || fail "$1"
success "$1"
[ $OUT -eq 13 ] || fail "Forward method should work properly and print adequate output"
success "Forward method should work properly and print adequate output"
OUT=`$pm2 forward app | wc -l`
[ $OUT -eq 2 ] || fail "$1"
success "$1"
[ $OUT -eq 2 ] || fail "Forward method should fail and thus print 2-lined output"
success "Forward method should fail and thus print 2-lined output"
OUT=`$pm2 pull app | wc -l`
[ $OUT -eq 2 ] || fail "$1"
success "$1"
OUT=`$pm2 ls | grep "16 " | wc -l`
[ $OUT -eq 1 ] || fail "$1"
success "$1"
[ $OUT -eq 2 ] || fail "Pull method should 'fail' because it is already up-to-date"
success "Pull method should 'fail' because it is already up-to-date"
#
# Testing refresh-versioning worker
#
OUT=`$pm2 jlist | egrep -oh '"unstaged":true' | wc -c`
[ $OUT -eq 16 ] || fail "$1"
success "$1"
[ $OUT -eq 16 ] || fail "Worker: unstaged flag should be true"
success "Worker: unstaged flag should be true"
git add --all
git commit -m 'staged now'
sleep 5
OUT=`$pm2 jlist | egrep -oh '"unstaged":false' | wc -c`
[ $OUT -eq 17 ] || fail "$1"
success "$1"
[ $OUT -eq 17 ] || fail "Worker: unstaged flag should be false this time"
success "Worker: unstaged flag should be false this time"
OUT=`$pm2 jlist | egrep -oh '"ahead":true' | wc -c`
[ $OUT -eq 13 ] || fail "$1"
success "$1"
[ $OUT -eq 13 ] || fail "Worker: ahead flag should be true"
success "Worker: ahead flag should be true"
$pm2 kill
cd ..