Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix error detection in Jenkinsfile
...and added cleanup step as well
mederly committed Sep 28, 2018
1 parent 7c3c892 commit 5f10031
Showing 3 changed files with 27 additions and 7 deletions.
17 changes: 10 additions & 7 deletions 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')
2 changes: 2 additions & 0 deletions 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

15 changes: 15 additions & 0 deletions 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

0 comments on commit 5f10031

Please sign in to comment.