Skip to content

Expanded tests #1

Merged
9 commits merged into from
Jul 21, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 31 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ ARG registry=docker.io
ARG maintainer=tier
ARG imagename=shibboleth_idp
ARG version=3.2.1

ENV VERSION=$version

MAINTAINER $maintainer
Expand All @@ -17,4 +16,34 @@ LABEL ImageName=$imagename
LABEL ImageOS=centos7
LABEL Version=$VERSION

CMD echo $VERSION
RUN yum -y install \
apr-devel \
httpd \
java-1.8.0-openjdk-headless \
krb5-workstation \
mod_ssl \
openssl-devel \
tomcat \
tomcat-native.x86_64 \
wget \
&& yum -y clean all

ENV SHIB_RELDIR=http://shibboleth.net/downloads/identity-provider/$VERSION
ENV SHIB_PREFIX=shibboleth-identity-provider-$VERSION

RUN mkdir -p /tmp/shibboleth && cd /tmp/shibboleth && \
wget -q https://shibboleth.net/downloads/PGP_KEYS \
$SHIB_RELDIR/$SHIB_PREFIX.tar.gz \
$SHIB_RELDIR/$SHIB_PREFIX.tar.gz.asc \
$SHIB_RELDIR/$SHIB_PREFIX.tar.gz.sha256 && \
# Perform verifications
gpg --import PGP_KEYS && \
gpg $SHIB_PREFIX.tar.gz.asc && \
sha256sum --check $SHIB_PREFIX.tar.gz.sha256 && \
# Prepare filesystem
tar xf $SHIB_PREFIX.tar.gz && \
mkdir -p /opt/shibboleth && \
mv $SHIB_PREFIX /opt/shibboleth/. && \
ln -s /opt/shibboleth/$SHIB_PREFIX /opt/shibboleth/current && \
# Cleanup
rm -rf /tmp/shibboleth
10 changes: 2 additions & 8 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,11 @@ node {

stage 'Base'

sh './build_image.sh'
sh 'bin/build.sh'

stage 'Tests'

sh '/usr/local/bin/bats tests/shibboleth-idp.bats'
sh '/usr/local/bin/bats tests'

# stage 'Push'
# if(env.BRANCH_NAME == "master")
# docker.withRegistry('https://registry.hub.docker.com/', 'dockerhub-bigfleet') {
# def baseImg = docker.build('$env.DOCKERHUB_ACCOUNT/shib_')
# baseImg.push('latest')
# }

}
3 changes: 3 additions & 0 deletions bin/rebuild.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

source bin/destroy.sh && source bin/build.sh
2 changes: 1 addition & 1 deletion bin/rerun.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

source bin/destroy.sh && source bin/build.sh && source bin/run.sh
source bin/rebuild.sh && source bin/run.sh $1
2 changes: 1 addition & 1 deletion bin/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

source common.bash .

docker run $maintainer/$imagename
docker run -it $maintainer/$imagename $1
17 changes: 11 additions & 6 deletions tests/shibboleth-idp.bats
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@

load ../common

@test "file reading" {
result="$(echo $maintainer)"
[ "$result" = 'bigfleet' ]
@test "Creates non-root Shib IDP home" {
result="$(docker run -i bigfleet/shibboleth_idp ls /opt/shibboleth/current/bin/)"
[ "$result" != '' ]
}

@test "container output" {
result="$(docker run bigfleet/shibboleth_idp)"
[ "$result" = '3.2.1' ]
@test "Retains first-run experience" {
result="$(docker run -i bigfleet/shibboleth_idp ls /tmp/firsttimerunning)"
[ "$result" != '' ]
}

@test "Contains java" {
run docker run -i bigfleet/shibboleth_idp which java
[ "$status" -eq 0 ]
}