Skip to content
Permalink
Browse files

Fix error detection in Jenkinsfile

...and added cleanup step as well
  • Loading branch information
mederly committed Sep 28, 2018
1 parent 7c3c892 commit 5f100318eee91c6cb8d0f2941b344b48c84ce3f3
Showing with 27 additions and 7 deletions.
  1. +10 −7 Jenkinsfile
  2. +2 −0 download-midpoint
  3. +15 −0 tests/main.bats
@@ -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')
@@ -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

@@ -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

0 comments on commit 5f10031

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