cd "$STGPATH"
+printf "Starting Stargazer... "
+
"$STGPATH/stargazer" "$STGPATH" >> "$LOGFILE" 2>&1 &
COUNT=""
done
PID=`cat "$STGPATH/stargazer.pid"`
-printf "\nStarted with pid $PID\n"
+printf "Started with pid $PID\n"
+printf "\nTesting admins:\n"
"$CURPATH/test_admins.sh" "$BASEPATH"
+printf "\nTesting services:\n"
"$CURPATH/test_services.sh" "$BASEPATH"
+printf "\n"
-printf "Stopping...\n"
+printf "Stopping... "
kill $PID
COUNT=""
SGCONFPATH="$BASEPATH/stg/projects/sgconf"
+printf "Check initial admin list... "
+
RES=`"$SGCONFPATH/sgconf" -s localhost -p 5555 -u admin -w 123456 --get-admins`
if [ "$?" != "0" ]
then
+ printf "Error.\n"
printf "Failed to get admins list. Result:\n$RES\n"
exit 0
fi
LOGINS=`getFields "login" "$RES"`
-printf "Logins:\n$LOGINS\n"
-
NUM=`count "$LOGINS"`
-printf -- "--------\n$NUM\n\n"
+if [ "$NUM" != "1" ]
+then
+ printf "Failed.\n"
+ printf "Admin list should have exactly one entry.\n"
+ printf "Logins:\n$LOGINS\n"
+ printf -- "--------\n$NUM\n\n"
+ exit 0
+fi
+
+printf "Ok.\nCheck updating admin permissions... "
RES=`"$SGCONFPATH/sgconf" -s localhost -p 5555 -u admin -w 123456 --chg-admin admin --priv 111111111`
if [ "$?" != "0" ]
then
+ printf "Error\n"
printf "Failed to update admin's priviledges Result:\n$RES\n"
exit 0
fi
+
+printf "Ok.\n"
SGCONFPATH="$BASEPATH/stg/projects/sgconf"
+printf "Check initial service list... "
+
RES=`"$SGCONFPATH/sgconf" -s localhost -p 5555 -u admin -w 123456 --get-services`
if [ "$?" != "0" ]
then
+ printf "Error.\n"
printf "Failed to get services list. Result:\n$RES\n"
exit 0
fi
NAMES=`getFields "name" "$RES"`
-printf "Names:\n$NAMES\n"
-
NUM=`count "$NAMES"`
-printf -- "--------\n$NUM\n\n"
-
if [ "$NUM" != "0" ]
then
+ printf "Failed.\n"
printf "Services list should be empty.\n"
+ printf "Names:\n$NAMES\n"
+ printf -- "--------\n$NUM\n\n"
exit 0
fi
+printf "Ok.\nCheck adding services... "
+
RES=`"$SGCONFPATH/sgconf" -s localhost -p 5555 -u admin -w 123456 --add-service test`
if [ "$?" != "0" ]
then
+ printf "Error.\n"
printf "Failed to add new service. Result:\n$RES\n"
exit 0
fi
+printf "Ok.\nCheck new service list... "
+
RES=`"$SGCONFPATH/sgconf" -s localhost -p 5555 -u admin -w 123456 --get-services`
if [ "$?" != "0" ]
then
+ printf "Error.\n"
printf "Failed to get services list. Result:\n$RES\n"
exit 0
fi
NAMES=`getFields "name" "$RES"`
-printf "Names:\n$NAMES\n"
-
NUM=`count "$NAMES"`
-printf -- "--------\n$NUM\n\n"
-
if [ "$NUM" != "1" ]
then
+ printf "Failed.\n"
printf "Services list should have exactly one entry.\n"
+ printf "Names:\n$NAMES\n"
+ printf -- "--------\n$NUM\n\n"
exit 0
fi
+printf "Ok.\nCheck deletion exisiting service... "
+
RES=`"$SGCONFPATH/sgconf" -s localhost -p 5555 -u admin -w 123456 --del-service test`
if [ "$?" != "0" ]
then
+ printf "Error.\n"
printf "Failed to delete a service. Result:\n$RES\n"
exit 0
fi
+printf "Ok.\nCheck new service list... "
+
RES=`"$SGCONFPATH/sgconf" -s localhost -p 5555 -u admin -w 123456 --get-services`
if [ "$?" != "0" ]
then
+ printf "Error.\n"
printf "Failed to get services list. Result:\n$RES\n"
exit 0
fi
NAMES=`getFields "name" "$RES"`
-printf "Names:\n$NAMES\n"
-
NUM=`count "$NAMES"`
-printf -- "--------\n$NUM\n\n"
-
if [ "$NUM" != "0" ]
then
+ printf "Failed.\n"
printf "Services list should be empty.\n"
+ printf "Names:\n$NAMES\n"
+ printf -- "--------\n$NUM\n\n"
exit 0
fi
+
+printf "Ok.\n"