webuntest

This commit is contained in:
Unitech 2017-12-13 00:53:35 +01:00
parent 02ab9c2820
commit af239c2521

View File

@ -157,48 +157,50 @@ $pm2 list
# spec "Should kill logs"
$pm2 web
spec "Should start web interface"
# $pm2 web
# spec "Should start web interface"
sleep 1
# sleep 1
JSON_FILE='/tmp/web-json'
# JSON_FILE='/tmp/web-json'
$http_get -q http://localhost:9615/ -O $JSON_FILE
cat $JSON_FILE | grep "HttpInterface.js" > /dev/null
spec "Should get the right JSON with HttpInterface file launched"
# $http_get -q http://localhost:9615/ -O $JSON_FILE
# cat $JSON_FILE | grep "HttpInterface.js" > /dev/null
# spec "Should get the right JSON with HttpInterface file launched"
$pm2 flush
spec "Should clean logs"
# $pm2 flush
# spec "Should clean logs"
# cat ~/.pm2/logs/echo-out.log | wc -l
# spec "File Log should be cleaned"
# # cat ~/.pm2/logs/echo-out.log | wc -l
# # spec "File Log should be cleaned"
sleep 1
$http_get -q http://localhost:9615/ -O $JSON_FILE
cat $JSON_FILE | grep "restart_time\":0" > /dev/null
spec "Should get the right JSON with HttpInterface file launched"
# sleep 1
# $http_get -q http://localhost:9615/ -O $JSON_FILE
# cat $JSON_FILE | grep "restart_time\":0" > /dev/null
# spec "Should get the right JSON with HttpInterface file launched"
#
# Restart only one process
#
$pm2 restart 1
should 'should has restarted process' 'restart_time: 1' 1
# #
# # Restart only one process
# #
# $pm2 restart 1
# should 'should has restarted process' 'restart_time: 1' 1
#
# Restart all processes
#
$pm2 restart all
spec "Should restart all processes"
# #
# # Restart all processes
# #
# $pm2 restart all
# spec "Should restart all processes"
sleep 1
$http_get -q http://localhost:9615/ -O $JSON_FILE
OUT=`cat $JSON_FILE | grep -o "restart_time\":1" | wc -l`
# sleep 1
# $http_get -q http://localhost:9615/ -O $JSON_FILE
# OUT=`cat $JSON_FILE | grep -o "restart_time\":1" | wc -l`
[ $OUT -eq 7 ] || fail "Error while wgeting data via web interface"
success "Got data from interface"
# [ $OUT -eq 7 ] || fail "Error while wgeting data via web interface"
# success "Got data from interface"
$pm2 start echo-env.js
$pm2 list
$pm2 dump