Skip to content
Permalink
Browse files

resolving all TODO

  • Loading branch information
skublik committed Oct 3, 2018
1 parent 3e6ed0d commit 9a16f7b1a05c1bfbd72251ebed6106154c9bfa8a
Showing with 53 additions and 48 deletions.
  1. +29 −3 demo/complex/tests/main.bats
  2. +0 −33 demo/shibboleth/test.sh
  3. +24 −12 library.bash
@@ -21,8 +21,8 @@ load ../../../library
touch $BATS_TMPDIR/not-started
wait_for_midpoint_start complex_midpoint-server_1 complex_midpoint-data_1
wait_for_shibboleth_idp_start complex_idp_1
wait_for_grouper_ui_start complex_grouper-ui_1
rm $BATS_TMPDIR/not-started
# TODO wait for shibboleth, grouper-ui, (also something other?)
}

@test "040 Check midPoint health" {
@@ -61,11 +61,26 @@ load ../../../library
check_health
pwd >&2
./upload-objects

search_and_check_object objectTemplates template-org-course
search_and_check_object objectTemplates template-org-department
search_and_check_object objectTemplates template-role-affiliation
search_and_check_object objectTemplates template-role-generic-group
# TODO check other objects that were uploaded

search_and_check_object orgs courses
search_and_check_object orgs departments

search_and_check_object resources "OpenLDAP (directory)"
search_and_check_object resources "Grouper SQL/MQ"
search_and_check_object resources "SQL SIS courses (sources)"
search_and_check_object resources "SQL SIS persons (sources)"

search_and_check_object roles metarole-affiliation
search_and_check_object roles metarole-course
search_and_check_object roles metarole-department
search_and_check_object roles metarole-generic-group
search_and_check_object roles role-grouper-sysadmin
search_and_check_object roles role-ldap-basic
}

@test "210 Test resource" {
@@ -94,7 +109,18 @@ load ../../../library
search_and_check_object users amorrison
search_and_check_object users wprice
search_and_check_object users mroberts
# TODO check in LDAP, check assignments etc

check_ldap_account_by_user_name jsmith complex_directory_1
check_ldap_account_by_user_name banderson complex_directory_1
check_ldap_account_by_user_name kwhite complex_directory_1
check_ldap_account_by_user_name whenderson complex_directory_1
check_ldap_account_by_user_name ddavis complex_directory_1
check_ldap_account_by_user_name cmorrison complex_directory_1
check_ldap_account_by_user_name danderson complex_directory_1
check_ldap_account_by_user_name amorrison complex_directory_1
check_ldap_account_by_user_name wprice complex_directory_1
check_ldap_account_by_user_name mroberts complex_directory_1
# TODO check assignments etc
}

@test "230 Check 'TestUser230' in Midpoint and LDAP" {

This file was deleted.

@@ -45,11 +45,17 @@ function wait_for_midpoint_start () {
generic_wait_for_log $1 "INFO (com.evolveum.midpoint.web.boot.MidPointSpringApplication): Started MidPointSpringApplication in" "midPoint to start" "midPoint did not start" $2
}

# Waits until Shibboleth IDP starts ... TODO refactor using generic waiting function
# Waits until Shibboleth IDP starts
function wait_for_shibboleth_idp_start () {
generic_wait_for_log $1 "INFO:oejs.Server:main: Started" "shibboleth idp to start" "shibboleth idp did not start" $2
}

# Waits until Grouper UI starts
function wait_for_grouper_ui_start () {
generic_wait_for_log $1 "INFO org.apache.catalina.startup.Catalina- Server startup in" "grouper ui to start" "grouper ui did not start" $2
}


# Checks the health of midPoint server
function check_health () {
echo Checking health...
@@ -219,8 +225,8 @@ function delete_object () {
# Results of the search are in the $SEARCH_RESULT_FILE
# TODO check if the result is valid (i.e. not an error) - return 1 if invalid, otherwise return 0 ("no objects" is considered OK here)
function search_objects_by_name () {
TYPE=$1
NAME="$2"
local TYPE=$1
local NAME="$2"
TMPFILE=$(mktemp /tmp/search.XXXXXX)

curl -k --write-out %{http_code} --user administrator:5ecr3t -H "Content-Type: application/xml" -X POST "https://localhost:8443/midpoint/ws/rest/$TYPE/search" -d @- << EOF >$TMPFILE || (rm $TMPFILE ; return 1)
@@ -233,15 +239,21 @@ function search_objects_by_name () {
</q:filter>
</q:query>
EOF
SEARCH_RESULT_FILE=$TMPFILE

http_code=$(sed '$!d' <<<"$(cat $SEARCH_RESULT_FILE)")
local HTTP_CODE=$(sed '$!d' <<<"$(cat $TMPFILE)")
sed -i '$ d' $TMPFILE
cat $TMPFILE

sed -i '$ d' $SEARCH_RESULT_FILE
cat $SEARCH_RESULT_FILE
if [ "$http_code" -eq 200 ]; then
if [ "$HTTP_CODE" -eq 200 ]; then
SEARCH_RESULT_FILE=$TMPFILE
return 0
else
echo "Error code: $HTTP_CODE"
if [ "$HTTP_CODE" -ge 500 ]; then
echo "Error message: Internal server error. Unexpected error occurred, if necessary please contact system administrator."
else
local ERROR_MESSAGE=$(xmllint --xpath "/*/*[local-name()='error']/text()" $TMPFILE) || (echo "Couldn't extract error message from file:" ; cat $TMPFILE ; rm $TMPFILE; return 1)
echo "Error message: $ERROR_MESSAGE"
fi
rm $SEARCH_RESULT_FILE
return 1
fi
@@ -335,7 +347,7 @@ function search_ldap_object_by_filter () {
}

function check_ldap_account_by_user_name () {
local NAME=$1
local NAME="$1"
local LDAP_CONTAINER=$2
search_ldap_object_by_filter "ou=people,dc=internet2,dc=edu" "uid=$NAME" $LDAP_CONTAINER
search_objects_by_name users $NAME
@@ -360,8 +372,8 @@ function check_ldap_account_by_user_name () {
}

function check_of_ldap_membership () {
local NAME_OF_USER=$1
local NAME_OF_GROUP=$2
local NAME_OF_USER="$1"
local NAME_OF_GROUP="$2"
local LDAP_CONTAINER=$3
search_ldap_object_by_filter "ou=people,dc=internet2,dc=edu" "uid=$NAME_OF_USER" $LDAP_CONTAINER

0 comments on commit 9a16f7b

Please sign in to comment.
You can’t perform that action at this time.