]> git.stg.codes - stg.git/blob - functest/test_admins.sh
Use std::lock_guard instead of STG_LOCKER.
[stg.git] / functest / test_admins.sh
1 #!/bin/sh
2
3 source `dirname $0`/functions
4
5 BASEPATH=$1
6
7 SGCONFPATH="$BASEPATH/stg/build/projects/sgconf"
8
9 printf "Check initial admin list... "
10
11 RES=`"$SGCONFPATH/sgconf" -s 127.0.0.1 -p 5555 -u admin -w 123456 --get-admins`
12
13 if [ "$?" != "0" ]
14 then
15     printf "Error.\n"
16     printf "Failed to get admins list. Result:\n$RES\n"
17     exit 0
18 fi
19
20 LOGINS=`getFields "login" "$RES"`
21
22 NUM=`count "$LOGINS"`
23
24 if [ "$NUM" != "1" ]
25 then
26     printf "Failed.\n"
27     printf "Admin list should have exactly one entry.\n"
28     printf "Logins:\n$LOGINS\n"
29     printf -- "--------\n$NUM\n\n"
30     exit 0
31 fi
32
33 printf "Ok.\nCheck updating admin permissions... "
34
35 RES=`"$SGCONFPATH/sgconf" -s localhost -p 5555 -u admin -w 123456 --chg-admin admin --priv 111111111`
36
37 if [ "$?" != "0" ]
38 then
39     printf "Error\n"
40     printf "Failed to update admin's priviledges Result:\n$RES\n"
41     exit 0
42 fi
43
44 printf "Ok.\n"