diff --git a/Jenkinsfile b/Jenkinsfile index b2496a8..41c67ed 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -74,7 +74,7 @@ pipeline { script { try { echo "Starting tests..." - // sh "bin/test.sh 2>&1 | tee debug ; test ${PIPESTATUS[0]} -eq 0" + sh "bin/test.sh 2>&1 | tee debug ; test ${PIPESTATUS[0]} -eq 0" sh 'tests/fulltest.sh' // echo "Skipping tests for now" } catch (error) { diff --git a/tests/fulltest.sh b/tests/fulltest.sh index f60a382..613a6d5 100755 --- a/tests/fulltest.sh +++ b/tests/fulltest.sh @@ -47,7 +47,6 @@ rm -f ./lastpage.txt # replace FROM line in IdP Dockerfile to newly-built local image echo "Setting test suite to base from new IdP image: ${imagename}_${tag}" -#sed -i "s*FROM i2incommon/shib-idp:latest*FROM shib-idp_4.2.1_20221101_rocky8_multiarch_dev*g" ../test-compose/idp/Dockerfile sed -i "s*FROM i2incommon/shib-idp:latest*FROM ${imagename}_${tag}*g" ../test-compose/idp/Dockerfile echo "Attempting full-cycle test..." diff --git a/tests/main.bats b/tests/main.bats index 4a8e488..b80cf79 100644 --- a/tests/main.bats +++ b/tests/main.bats @@ -2,55 +2,55 @@ load ../common -#@test "010 Image is present and healthy" { -# docker image inspect ${maintainer}/${imagename} -#} +@test "010 Image is present and healthy" { + docker image inspect ${imagename}_${tag} +} -#@test "020 All key files are present" { -# docker run --rm -i ${maintainer}/${imagename} \ -# find \ -# /opt/shibboleth-idp/credentials/idp-encryption.crt \ -# /opt/shibboleth-idp/credentials/idp-encryption.key \ -# /opt/shibboleth-idp/credentials/idp-signing.crt \ -# /opt/shibboleth-idp/credentials/idp-signing.key \ -# /usr/local/tomcat/ \ -# /usr/bin/java -#} +@test "020 All key files are present" { + docker run --rm -i ${imagename}_${tag} \ + find \ + /opt/shibboleth-idp/credentials/idp-encryption.crt \ + /opt/shibboleth-idp/credentials/idp-encryption.key \ + /opt/shibboleth-idp/credentials/idp-signing.crt \ + /opt/shibboleth-idp/credentials/idp-signing.key \ + /usr/local/tomcat/ \ + /usr/bin/java +} -#@test "030 Port 443/https is listening" { -# docker run -d ${maintainer}/${imagename} -# sleep 25 -# #get cont id -# contid=$(docker ps | grep ${maintainer}/${imagename} | cut -f 1 -d ' ') -# run docker exec -i ${contid} sh -c 'cat < /dev/null > /dev/tcp/127.0.0.1/443' -# docker kill ${contid} &>/dev/null -# docker rm ${contid} &>/dev/null -# [ "$status" -eq 0 ] -#} +@test "030 Port 443/https is listening" { + docker run -d ${imagename}_${tag} + sleep 25 + #get cont id + contid=$(docker ps | grep ${imagename}_${tag} | cut -f 1 -d ' ') + run docker exec -i ${contid} sh -c 'cat < /dev/null > /dev/tcp/127.0.0.1/443' + docker kill ${contid} &>/dev/null + docker rm ${contid} &>/dev/null + [ "$status" -eq 0 ] +} -#@test "040 The IdP Status page is present" { -# docker run -d ${maintainer}/${imagename} -# sleep 60 -# contid2=$(docker ps | grep ${maintainer}/${imagename} | cut -f 1 -d ' ') -# run docker exec -i ${contid2} sh -c 'curl -I -k -s -f https://127.0.0.1/idp/status' -# docker kill ${contid2} &>/dev/null -# docker rm ${contid2} &>/dev/null -# [ "$status" -eq 0 ] -#} +@test "040 The IdP Status page is present" { + docker run -d ${imagename}_${tag} + sleep 60 + contid2=$(docker ps | grep ${imagename}_${tag} | cut -f 1 -d ' ') + run docker exec -i ${contid2} sh -c 'curl -I -k -s -f https://127.0.0.1/idp/status' + docker kill ${contid2} &>/dev/null + docker rm ${contid2} &>/dev/null + [ "$status" -eq 0 ] +} -#@test "050 The version of Tomcat is current" { -# ./tests/checktomcatver.sh ${maintainer}/${imagename} -#} +@test "050 The version of Tomcat is current" { + ./tests/checktomcatver.sh ${imagename}_${tag} +} -#@test "060 The version of the IdP is current" { -# ./tests/checkidpver.sh ${maintainer}/${imagename} -#} +@test "060 The version of the IdP is current" { + ./tests/checkidpver.sh ${imagename}_${tag} +} ##@test "070 There are no known security vulnerabilities" { ## ./tests/clairscan.sh ${maintainer}/${imagename}:latest ##} -@test "080 The IdP successfully completed a full-cycle test with an SP" { - ./tests/fulltest.sh -} +#@test "080 The IdP successfully completed a full-cycle test with an SP" { +# ./tests/fulltest.sh +#}