Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Unitech committed Oct 18, 2013
1 parent 025033c commit 1a4861e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"description": "Modern CLI process manager for Node apps with a builtin load-balancer",
"main": "index.js",
"scripts": {
"test": "bash ./test/cli.sh && bash ./test/cli2.sh && NODE_ENV=test ./node_modules/mocha/bin/mocha test"
"test": "NODE_ENV=test ./node_modules/mocha/bin/mocha test && bash ./test/cli.sh && bash ./test/cli2.sh"
},
"keywords": [
"cli",
Expand Down
22 changes: 12 additions & 10 deletions test/cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -183,14 +183,6 @@ OUT=`cat $JSON_FILE | grep -o "restart_time\":1" | wc -l`
[ $OUT -eq 7 ] || fail "$1"
success "$1"

#
# Cron
#
$pm2 start cron.js -c "* * * asdasd"
ispec "Cron should throw error when pattern invalid"

$pm2 start cron.js -c "* * * * * *"
spec "Should cron restart echo.js"

$pm2 list

Expand All @@ -205,7 +197,7 @@ spec "Should stop all processes"

sleep 0.5
OUT=`$pm2 prettylist | grep -o "stopped" | wc -l`
[ $OUT -eq 9 ] || fail "Process not stopped"
[ $OUT -eq 8 ] || fail "Process not stopped"
success "Process succesfully stopped"


Expand Down Expand Up @@ -239,7 +231,7 @@ spec "Should resurect all apps"

sleep 0.5
OUT=`$pm2 prettylist | grep -o "restart_time" | wc -l`
[ $OUT -eq 9 ] || fail "Not valid process number"
[ $OUT -eq 8 ] || fail "Not valid process number"
success "Processes valid"

$pm2 delete all
Expand All @@ -250,6 +242,16 @@ OUT=`$pm2 prettylist | grep -o "restart_time" | wc -l`
[ $OUT -eq 0 ] || fail "Process not stopped"
success "Process succesfully stopped"

#
# Cron
#
$pm2 start cron.js -c "* * * asdasd"
ispec "Cron should throw error when pattern invalid"

$pm2 start cron.js -c "* * * * * *"
spec "Should cron restart echo.js"


$pm2 kill
spec "Should kill daemon"

Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/child.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ var i = 0;
http.createServer(function(req, res) {
res.writeHead(200);
res.end("hello world\n" + i++);
}).listen(8000);
}).listen(8004);

0 comments on commit 1a4861e

Please sign in to comment.