From 71426e7883697152a7097e6c224fe8d46ea3f889 Mon Sep 17 00:00:00 2001 From: Jim Van Fleet Date: Wed, 27 Jul 2016 15:31:55 -0400 Subject: [PATCH] Adding tests and revising Jenkinsfile to begin with a passing build --- Jenkinsfile | 23 ----------------------- bin/download.sh | 3 ++- tests/download.bats | 17 +++++++++++++++++ 3 files changed, 19 insertions(+), 24 deletions(-) create mode 100644 tests/download.bats diff --git a/Jenkinsfile b/Jenkinsfile index eb5b63a..f283330 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -14,32 +14,9 @@ node { sh 'mv bin/* .' } - stage 'Build' - - def maintainer = maintainer() - def imagename = imagename() - def tag = env.BRANCH_NAME - if(!imagename){ - echo "You must define an imagename in common.bash" - currentBuild.result = 'FAILURE' - } - if(maintainer){ - echo "Building ${maintainer}:${tag} for ${maintainer}" - } - - sh 'bin/build.sh' - stage 'Tests' sh 'bin/test.sh' - - stage 'Push' - - docker.withRegistry('https://registry.hub.docker.com/', "dockerhub-$maintainer") { - def baseImg = docker.build("$maintainer/$imagename") - baseImg.push("$tag") - } - } diff --git a/bin/download.sh b/bin/download.sh index 2b074c8..4045d91 100755 --- a/bin/download.sh +++ b/bin/download.sh @@ -6,5 +6,6 @@ rm -rf root if [ ! -f shibboleth-identity-provider.tar.gz ]; then curl -o shibboleth-identity-provider.tar.gz "https://shibboleth.net/downloads/identity-provider/latest/shibboleth-identity-provider-$version.tar.gz" fi -tar xvf shibboleth-identity-provider.tar.gz +tar xf shibboleth-identity-provider.tar.gz mv shibboleth-identity-provider-$version root +rm -rf root/bin root/logs diff --git a/tests/download.bats b/tests/download.bats new file mode 100644 index 0000000..f434ece --- /dev/null +++ b/tests/download.bats @@ -0,0 +1,17 @@ +#!/usr/bin/env bats + +load ../common + +setup() { + bin/download.sh +} + +@test "Downloads a Shibboleth IDP tree" { + result="$(ls root/conf/idp.properties)" + [ "$result" = 'root/conf/idp.properties' ] +} + +@test "Prunes Shibboleth IDP binaries" { + run ls root/bin + [ "$status" -eq 1 ] +} \ No newline at end of file