Skip to content
Permalink
Browse files

Migrate RabbitMQ to TIER image

A couple of Grouper-related tests were added, including testing
of live sync using RabbitMQ (not finished yet).
  • Loading branch information
mederly committed Oct 9, 2018
1 parent d5165da commit 5c4f48aa76736330d86bb24b820ca445ec767091
@@ -25,6 +25,4 @@ RUN useradd ldapadmin \

EXPOSE 389

# temporary!

CMD rm -rf /var/lock/dirsrv/slapd-dir/server/* && /usr/sbin/ns-slapd -D /etc/dirsrv/slapd-dir && sleep 100000000
CMD rm -rf /var/lock/dirsrv/slapd-dir/server/* && /usr/sbin/ns-slapd -D /etc/dirsrv/slapd-dir && sleep infinity
@@ -3,7 +3,7 @@ version: "3.3"
services:
grouper_daemon:
build: ./grouper_daemon/
command: bash -c "while ! curl -s grouper_data:3306 > /dev/null; do echo waiting for mysql on grouper_data to start; sleep 3; done; while ! curl -s ldap://directory:389 > /dev/null; do echo waiting for ldap on directory to start; sleep 3; done; exec daemon"
# do NOT put command: here
depends_on:
- grouper_data
- directory
@@ -2,4 +2,10 @@ FROM tier/grouper:2.3.0-a109-u47-w12-p21

LABEL author="tier-packaging@internet2.edu <tier-packaging@internet2.edu>"

CMD ["daemon"]
# This is to allow running gsh on this container interactively

ENTRYPOINT []

CMD bash -c "while ! curl -s grouper_data:3306 > /dev/null; do echo waiting for mysql on grouper_data to start; sleep 3; done; \
while ! curl -s ldap://directory:389 > /dev/null; do echo waiting for ldap on directory to start; sleep 3; done; \
/usr/local/bin/entrypoint.sh daemon"
@@ -20,7 +20,7 @@ load ../../../library
@test "020 Wait until components are started" {
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_shibboleth_idp_start_old complex_idp_1
wait_for_grouper_ui_start complex_grouper_ui_1
rm $BATS_TMPDIR/not-started
}
@@ -32,7 +32,7 @@ load ../../../library

@test "050 Check Shibboleth IDP health" {
if [ -e $BATS_TMPDIR/not-started ]; then skip 'not started'; fi
check_health_shibboleth_idp
check_health_shibboleth_idp_old
}

@test "060 Check Grouper health" {
@@ -182,7 +182,6 @@ load ../../../library
check_of_ldap_membership wprice "ou=courses,ou=groups,dc=internet2,dc=edu" "SCI404" complex_directory_1
}


@test "240 Check 'TestUser240' in Midpoint and LDAP" {
if [ -e $BATS_TMPDIR/not-started ]; then skip 'not started'; fi
check_health
@@ -200,6 +199,75 @@ load ../../../library
delete_object_by_name users TestUser240
}

@test "300 Add wprice to 'etc:testGroup' and 'ref:affiliation:alum_includes'. Export 'ref:affiliation:alum'" {
if [ -e $BATS_TMPDIR/not-started ]; then skip 'not started'; fi

docker cp tests/resources/grouper/t300.gsh complex_grouper_daemon_1:/tmp/
docker exec complex_grouper_daemon_1 bash -c "/opt/grouper/grouper.apiBinary/bin/gsh /tmp/t300.gsh"
}

@test "310 Import Grouper-to-midPoint import task" {
if [ -e $BATS_TMPDIR/not-started ]; then skip 'not started'; fi

check_health
add_object tasks midpoint-objects-manual/tasks/task-import-grouper.xml
search_and_check_object tasks "Import from Grouper"
}

@test "320 Wait for the import to finish" {
wait_for_task_completion 617fec0c-f7a6-4f91-89d0-395fb8878edd 8 10
assert_task_success 617fec0c-f7a6-4f91-89d0-395fb8878edd
}

@test "330 Assert wprice membership in LDAP" {
skip TODO
}

@test "400 Clean sampleQueue" {
if [ -e $BATS_TMPDIR/not-started ]; then skip 'not started'; fi

docker exec complex_mq_1 rabbitmqctl purge_queue sampleQueue
}

@test "410 Import Grouper-to-midPoint live sync task" {
if [ -e $BATS_TMPDIR/not-started ]; then skip 'not started'; fi

check_health
add_object tasks tests/resources/tasks/task-livesync-grouper-single.xml
search_and_check_object tasks "LiveSync from Grouper"
wait_for_task_completion 87ffce52-717a-4205-ba01-0a698f0deaee 8 10
assert_task_success 87ffce52-717a-4205-ba01-0a698f0deaee
}

@test "420 Add kwhite to 'etc:testGroup', remove wprice from 'ref:affiliation:alum_includes'" {
if [ -e $BATS_TMPDIR/not-started ]; then skip 'not started'; fi

docker cp tests/resources/grouper/t420.gsh complex_grouper_daemon_1:/tmp/
docker exec complex_grouper_daemon_1 bash -c "/opt/grouper/grouper.apiBinary/bin/gsh /tmp/t420.gsh"
}

@test "430 Assert existence of change messages in sampleQueue" {
if [ -e $BATS_TMPDIR/not-started ]; then skip 'not started'; fi

sleep 80
docker cp tests/resources/rabbitmq/check-samplequeue.sh complex_mq_1:/tmp/
docker exec complex_mq_1 bash /tmp/check-samplequeue.sh
}

@test "440 Execute Grouper-to-midPoint live sync task (again)" {
if [ -e $BATS_TMPDIR/not-started ]; then skip 'not started'; fi

skip TODO

check_health
run_task_now 87ffce52-717a-4205-ba01-0a698f0deaee
wait_for_task_completion 87ffce52-717a-4205-ba01-0a698f0deaee 8 10
assert_task_success 87ffce52-717a-4205-ba01-0a698f0deaee
}

@test "450 Assert wprice and kwhite membership in LDAP" {
skip TODO
}

@test "999 Clean up" {
docker-compose down -v
@@ -0,0 +1,15 @@
System.out.println("************** t300.gsh starting **************");

gs = GrouperSession.startRootSession()

exportedGroups = GroupFinder.findByName(gs, 'etc:exportedGroups')
alumSubject = SubjectFinder.findByIdentifier('ref:affiliation:alum', 'group', 'g:gsa')
exportedGroups.addMember(alumSubject, false)

alumIncludes = GroupFinder.findByName(gs, 'ref:affiliation:alum_includes')
testGroup = GroupFinder.findByName(gs, 'etc:testGroup')
wprice = SubjectFinder.findById('wprice', 'person', 'ldap')
alumIncludes.addMember(wprice, false)
testGroup.addMember(wprice, false)

System.out.println("************** t300.gsh done **************");
@@ -0,0 +1,12 @@
System.out.println("************** t420.gsh starting **************");

gs = GrouperSession.startRootSession()

alumIncludes = GroupFinder.findByName(gs, 'ref:affiliation:alum_includes')
testGroup = GroupFinder.findByName(gs, 'etc:testGroup')
kwhite = SubjectFinder.findById('kwhite', 'person', 'ldap')
wprice = SubjectFinder.findById('wprice', 'person', 'ldap')
testGroup.addMember(kwhite, false)
alumIncludes.deleteMember(wprice, false)

System.out.println("************** t420.gsh done **************");
@@ -0,0 +1,8 @@
count=$(rabbitmqctl list_queues | grep s1ampleQueue | awk '{print $2}')
if [[ -z $count || $count -eq 0 ]]; then
echo "ERROR: sampleQueue does not exist or is empty"
exit 1
else
echo "OK: sampleQueue has $count message(s)"
exit 0
fi
@@ -0,0 +1,29 @@
<task xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3"
xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
xmlns:t="http://prism.evolveum.com/xml/ns/public/types-3"
xmlns:org="http://midpoint.evolveum.com/xml/ns/public/common/org-3"
xmlns:icfs="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3"
xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3"
oid="87ffce52-717a-4205-ba01-0a698f0deaee">
<name>LiveSync from Grouper</name>
<extension xmlns:mext="http://midpoint.evolveum.com/xml/ns/public/model/extension-3"
xmlns:gen437="http://midpoint.evolveum.com/xml/ns/public/provisioning/liveSync-3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="c:ExtensionType">
<mext:kind>account</mext:kind>
<mext:objectclass>ri:AccountObjectClass</mext:objectclass>
</extension>
<taskIdentifier>1535465478027-0-1</taskIdentifier>
<ownerRef oid="00000000-0000-0000-0000-000000000002"
relation="org:default"
type="c:UserType"><!-- administrator --></ownerRef>
<executionStatus>runnable</executionStatus>
<category>LiveSynchronization</category>
<handlerUri>http://midpoint.evolveum.com/xml/ns/public/model/synchronization/task/live-sync/handler-3</handlerUri>
<objectRef oid="6dcb84f5-bf82-4931-9072-fbdf87f96442"
relation="org:default"
type="c:ResourceType"><!-- Grouper SQL NEW --></objectRef>
<recurrence>single</recurrence>
<binding>loose</binding>
</task>
@@ -17,10 +17,10 @@ function generic_wait_for_log () {

until [[ $ATTEMPT = $MAX_ATTEMPTS ]]; do
ATTEMPT=$((ATTEMPT+1))
echo "Waiting $DELAY seconds for $WAITING_FOR (attempt $ATTEMPT) ..."
sleep $DELAY
docker ps
( docker logs $CONTAINER_NAME 2>&1 | grep -F "$MESSAGE" ) && return 0
echo "Waiting $DELAY seconds for $WAITING_FOR (attempt $ATTEMPT) ..."
sleep $DELAY
done

echo "$FAILURE" in $(( $MAX_ATTEMPTS * $DELAY )) seconds in $CONTAINER_NAME

0 comments on commit 5c4f48a

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