X-Git-Url: https://feistymeow.org/gitweb/?a=blobdiff_plain;f=testkit%2Flibrary%2Ftear_down_test_infrastructure.sh;fp=testkit%2Flibrary%2Ftear_down_test_infrastructure.sh;h=b1e38b7d8c038d2c679243c3200664e282c1ff64;hb=d46483c93ecc9a4ef7d80656d23bd0891ddf5ac6;hp=0000000000000000000000000000000000000000;hpb=4e15bc3b03c452086296b0b2e8dab709f34b5957;p=feisty_meow.git diff --git a/testkit/library/tear_down_test_infrastructure.sh b/testkit/library/tear_down_test_infrastructure.sh new file mode 100644 index 00000000..b1e38b7d --- /dev/null +++ b/testkit/library/tear_down_test_infrastructure.sh @@ -0,0 +1,67 @@ +#!/bin/bash + +# Tears down the demo users previously set up for multi-user testing. +# +# Author: Chris Koeritz + +export WORKDIR="$( \cd "$(\dirname "$0")" && \pwd )" # obtain the script's working directory. +cd "$WORKDIR" + +if [ -z "$TESTKIT_SENTINEL" ]; then echo Please run prepare_tools.sh before testing.; exit 3; fi +source "$TESTKIT_ROOT/library/establish_environment.sh" + +progname="$(basename "$0")" + +if [ $# -lt 1 ]; then + echo "$progname: This script needs a single parameter, which is the container" + echo "path to use for the authentication (e.g. $STS_LOC)" + exit 3 +fi + +ADMIN_CONTAINER=$1; shift +echo "container location is $ADMIN_CONTAINER " + +# we test for ten users currently. +user_count=10 + +# login the right power user that can delete other user entries. +testLoginAsAdmin() +{ + if [ -z "$NON_INTERACTIVE" ]; then + login_a_user admin + fi +} + +# now that we're logged in appropriately, delete our corresponding set of users. +testDeleteUsers() +{ + local x + for (( x=0; x < ${#MULTI_USER_LIST[*]}; x++ )); do + username="${MULTI_USER_LIST[$x]}" + echo "Whacking user '$username'..." + passwd="${MULTI_PASSWORD_LIST[$x]}" + # now do the heavy lifting to get that user set up. + silent_grid script "local:'$TESTKIT_ROOT/library/delete_one_user.xml'" "$CONTAINERPATH" "$(basename $username)" "$username" "$SUBMIT_GROUP" + assertEquals "Should delete user '$username' successfully" 0 $? + done +} + +# make sure we don't leave them logged in as an administrator. +testLogoutAgain() +{ + if [ -z "$NON_INTERACTIVE" ]; then + silent_grid logout --all + assertEquals "Final logout of the grid" 0 $? + fi +} + +testLoginNormalUser() +{ + if [ -z "$NON_INTERACTIVE" ]; then + login_a_user normal + fi +} + +# load and run shUnit2 +source "$SHUNIT_DIR/shunit2" +