Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix demo/complex tests (hopefully)
1. xpath -> xmllint
2. added some docker containers cleanup
mederly committed Sep 28, 2018
1 parent 5f10031 commit ec257f5
Showing 4 changed files with 11 additions and 3 deletions.
2 changes: 2 additions & 0 deletions Jenkinsfile
@@ -55,6 +55,8 @@ pipeline {
sh 'bin/test.sh 2>&1 | tee debug ; test ${PIPESTATUS[0]} -eq 0'
sh 'echo Docker containers before compositions tests ; docker ps -a' // temporary

sh 'xmllint &>> debug' // temporary

sh '(cd demo/simple ; bats tests ) 2>&1 | tee -a debug ; test ${PIPESTATUS[0]} -eq 0'
sh '(cd demo/shibboleth ; bats tests ) 2>&1 | tee -a debug ; test ${PIPESTATUS[0]} -eq 0'
sh '(cd demo/complex ; bats tests ) 2>&1 | tee -a debug ; test ${PIPESTATUS[0]} -eq 0'
2 changes: 2 additions & 0 deletions demo/complex/tests/main.bats
@@ -5,11 +5,13 @@ load ../../../library

@test "000 Cleanup before running the tests" {
# skip
cd ../shibboleth ; docker-compose down -v ; true
run docker-compose down -v
}

@test "010 Initialize and start the composition" {
# skip
docker ps -a
docker-compose up -d
wait_for_midpoint_start complex_midpoint-server_1
# TODO wait for shibboleth, grouper-ui, (also something other?)
4 changes: 2 additions & 2 deletions demo/shibboleth/tests/main.bats
@@ -16,7 +16,7 @@ load ../../../library
@test "020 Initialize and start Shibboleth" {
docker-compose up -d
# TODO implement wait_for_shibboleth_start
sleep 20
sleep 60
}

@test "030 Check health" {
@@ -27,5 +27,5 @@ load ../../../library

@test "999 Clean up" {
cd ../simple ; docker-compose down -v ; true
run docker-compose down -v
docker-compose down -v
}
6 changes: 5 additions & 1 deletion library.bash
@@ -117,7 +117,7 @@ function test_resource () {
local TMPFILE_ERR=$(mktemp /tmp/test.resource.err.XXXXXX)

curl -k --user administrator:5ecr3t -H "Content-Type: application/xml" -X POST "https://localhost:8443/midpoint/ws/rest/resources/$OID/test" >$TMPFILE || (rm $TMPFILE $TMPFILE_ERR ; return 1)
if [[ $(xpath -q -e "*/status/text()" < $TMPFILE) == "success" ]]; then
if [[ $(xmllint --xpath "*/status/text()" $TMPFILE) == "success" ]]; then
echo "Resource $OID test succeeded"
rm $TMPFILE
return 0
@@ -128,3 +128,7 @@ function test_resource () {
return 1
fi
}

function get_xpath () {
echo ok
}

0 comments on commit ec257f5

Please sign in to comment.