From cb2154a0eb261758e7d25d15dfd1c50db344c730 Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Fri, 28 Sep 2018 14:24:27 +0200 Subject: [PATCH] Try to make tests pass --- Jenkinsfile | 6 +++--- demo/complex/tests/main.bats | 10 +++++++--- library.bash | 4 ++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 31c0a6c..c270952 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -55,9 +55,9 @@ 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 '(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' + 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' // sh 'echo Test output ; cat debug' } catch (error) { diff --git a/demo/complex/tests/main.bats b/demo/complex/tests/main.bats index 1e70b44..89b08f4 100755 --- a/demo/complex/tests/main.bats +++ b/demo/complex/tests/main.bats @@ -4,8 +4,12 @@ load ../../../common load ../../../library @test "000 Cleanup before running the tests" { - cd ../shibboleth ; docker-compose down -v ; true - run docker-compose down -v + pwd > /tmp/log + echo a1 >> /tmp/log + (cd ../shibboleth ; docker-compose down -v ; sleep 60) || true + echo a2 >> /tmp/log + (docker-compose down -v ; sleep 60) || true + echo a3 >> /tmp/log } @test "010 Initialize and start the composition" { @@ -67,5 +71,5 @@ load ../../../library } @test "999 Clean up" { - docker-compose down -v +# docker-compose down -v } diff --git a/library.bash b/library.bash index c8873cc..9ed8046 100644 --- a/library.bash +++ b/library.bash @@ -120,14 +120,14 @@ 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 [[ $(xmllint --xpath "*/status/text()" $TMPFILE) == "success" ]]; then + if [[ $(xmllint --xpath "/*/*[local-name()='status']/text()" $TMPFILE) == "success" ]]; then echo "Resource $OID test succeeded" rm $TMPFILE return 0 else echo "Resource $OID test failed" cat $TMPFILE -# rm $TMPFILE + rm $TMPFILE return 1 fi }