Add test cases of override_gid.

Signed-off-by: Peng Haitao <[email protected]>
---
 runtest/commands               |    1 +
 testcases/commands/sssd/sssd02 |   75 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 76 insertions(+), 0 deletions(-)
 create mode 100755 testcases/commands/sssd/sssd02

diff --git a/runtest/commands b/runtest/commands
index 0a1254b..95ccfda 100644
--- a/runtest/commands
+++ b/runtest/commands
@@ -18,3 +18,4 @@ mkdir_tests01 mkdir_tests.sh
 mv_tests01 mv_tests.sh
 size01 size01
 sssd01 sssd01
+sssd02 sssd02
diff --git a/testcases/commands/sssd/sssd02 b/testcases/commands/sssd/sssd02
new file mode 100755
index 0000000..3616969
--- /dev/null
+++ b/testcases/commands/sssd/sssd02
@@ -0,0 +1,75 @@
+#! /bin/sh
+
+#  Copyright (c) International Business Machines  Corp., 2012
+#
+#  This program is free software;  you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY;  without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
+#  the GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program;  if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Description:  Test override_gid in the configuration file.
+# Author:       Peng Haitao <[email protected]>
+# History:      2012/02/08 - Created.
+#
+
+. ./sssd-lib.sh || exit 1
+
+sssd_case1()
+{
+       tst_resm TINFO "test override_gid with gid+1 in [domain/LOCAL]"
+
+       # Create the configuration file specific to this test case.
+       make_config_file
+       gid=`id -g $username`
+       gid_add_one=$(( gid+1 ))
+       sed -i -e "/\[domain\/LOCAL\]/ a\override_gid = $gid_add_one" \
+               $CONFIG_FILE
+       sleep 1
+
+       getent passwd $username@LOCAL | grep "$gid_add_one" >/dev/null 2>&1
+       if [ $? -eq 0 ]; then
+               tst_resm TFAIL "sssd: user GID should be not $gid_add_one."
+               : $(( TFAILCNT += 1 ))
+               return $TFAILCNT
+       fi
+
+       restart_sssd_daemon
+
+       getent passwd $username@LOCAL | grep "$gid_add_one" >/dev/null 2>&1
+       if [ $? -eq 0 ]; then
+               tst_resm TPASS "sssd: user GID is $gid_add_one."
+       else
+               tst_resm TFAIL "sssd: user GID should be $gid_add_one."
+               : $(( TFAILCNT += 1 ))
+               return $TFAILCNT
+       fi
+
+       return 0
+}
+
+export TST_TOTAL=1
+export TST_COUNT=1
+export TCID=sssd02
+
+TFAILCNT=0
+username="sssd_test_user"
+
+make_config_file
+# make sure config file is OK
+sleep 1
+restart_sssd_daemon
+sss_useradd $username
+
+sssd_case1
+
+sss_userdel $username
+cleanup ${TFAILCNT:=0}
-- 
1.7.9


------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to