diff --git a/Jenkinsfile b/Jenkinsfile index e200e2b..c270952 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -35,8 +35,8 @@ pipeline { script { try { sh '(ls -l ; docker ps -a ; docker image ls ; echo Destroying ; bin/destroy.sh ; docker image ls) 2>&1 | tee debug' // temporary - sh './download-midpoint 2>&1 | tee -a debug' - sh 'bin/rebuild.sh 2>&1 | tee -a debug' + sh './download-midpoint 2>&1 | tee -a debug ; test ${PIPESTATUS[0]} -eq 0' + sh 'bin/rebuild.sh 2>&1 | tee -a debug ; test ${PIPESTATUS[0]} -eq 0' //sh 'echo Build output ; cat debug' } catch (error) { def error_details = readFile('./debug') @@ -51,11 +51,14 @@ pipeline { steps { script { try { - sh 'bin/test.sh 2>&1 | tee debug' - sh '(cd demo/simple ; bats tests ) 2>&1 | tee -a debug' - sh '(cd demo/shibboleth ; bats tests ) 2>&1 | tee -a debug' - sh '(echo Checking if xpath is present ; xpath || true ) 2>&1 | tee -a debug' - sh '(cd demo/complex ; bats tests ) 2>&1 | tee -a debug' + sh 'echo Docker containers before root tests ; docker ps -a' // temporary + 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 'echo Test output ; cat debug' } catch (error) { def error_details = readFile('./debug') diff --git a/download-midpoint b/download-midpoint index a6cf1a0..3cbea87 100755 --- a/download-midpoint +++ b/download-midpoint @@ -8,7 +8,9 @@ echo "-----------------------------------------" echo "Checking the download..." if tar -tf $dir/midpoint-3.9-SNAPSHOT-dist.tar.gz >/dev/null; then echo "OK" + exit 0 else echo "The file was not downloaded correctly" + exit 1 fi diff --git a/tests/main.bats b/tests/main.bats index 0856ec5..8b10b47 100755 --- a/tests/main.bats +++ b/tests/main.bats @@ -15,5 +15,20 @@ load ../common /etc/httpd/ } +@test "100 Cleanup before further tests - demo/simple" { + docker ps -a + cd demo/simple ; docker-compose down -v ; true +} + +@test "110 Cleanup before further tests - demo/shibboleth" { + docker ps -a + cd demo/shibboleth ; docker-compose down -v ; true +} + +@test "120 Cleanup before further tests - demo/complex" { + docker ps -a + cd demo/complex ; docker-compose down -v ; true +} + # not much more to check here, as we cannot start midpoint container without having a repository # so continuing with tests in demo/plain directory