Skip to content

Introduce testing #3

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions Dockerfile
Expand Up @@ -11,6 +11,7 @@ ENV TOMCAT_VERSION="6.0.35"
ADD ./container_files /opt/
COPY conf/grouper.conf /etc/httpd/conf.d/grouper.conf
COPY conf/grouper.hibernate.properties /opt/etc
COPY conf/server.* /etc/httpd/certs/
RUN rm /opt/grouper/2.3.0/grouper.apiBinary-2.3.0/conf/grouper.hibernate.properties && \
ln -s /opt/etc/grouper.hibernate.properties /opt/grouper/2.3.0/grouper.apiBinary-2.3.0/conf/grouper.hibernate.properties && \
rm /opt/grouper/2.3.0/grouper.ws-2.3.0/grouper-ws/build/dist/grouper-ws/WEB-INF/classes/grouper.hibernate.properties && \
Expand Down
31 changes: 29 additions & 2 deletions Jenkinsfile
Expand Up @@ -40,22 +40,36 @@ node('docker') {
sh 'bin/rebuild.sh &> debug'
} catch(error) {
def error_details = readFile('./debug');
def message = "BUILD ERROR: There was a problem building ${imagename}:${tag}. \n\n ${error_details}"
def message = "BUILD ERROR: There was a problem building Grouper appliance (${tag}). \n\n ${error_details}"
sh "rm -f ./debug"
handleError(message)
}

stage 'Compose'
try{
sh 'bin/compose.sh &> debug'
} catch(error) {
def error_details = readFile('./debug');
def message = "BUILD ERROR: There was a problem composing Grouper appliance (${tag}). \n\n ${error_details}"
sh "rm -f ./debug"
handleError(message)
}

stage 'Tests'

try{
sh 'bin/test.sh &> debug'
} catch(error) {
def error_details = readFile('./debug');
def message = "BUILD ERROR: There was a problem building ${imagename}:${tag}. \n\n ${error_details}"
def message = "BUILD ERROR: There was a problem testing Grouper appliance :${tag}. \n\n ${error_details}"
sh "rm -f ./debug"
handleError(message)
}

stage 'Clean Up'

cleanup()

stage 'Notify'

slackSend color: 'good', message: "grouper-appliance (${tag}) passes test battery"
Expand All @@ -77,5 +91,18 @@ def handleError(String message){
currentBuild.setResult("FAILED")
slackSend color: 'danger', message: "${message}"
//step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: 'chris.bynum@levvel.io', sendToIndividuals: true])
cleanup()
sh 'exit 1'
}

def cleanup() {
try{
sh 'bin/decompose.sh &> debug'
sh 'bin/prune.sh &> debug'
} catch(error) {
def error_details = readFile('./debug');
def message = "BUILD ERROR: There was a problem cleaning up Grouper appliance :${tag}. \n\n ${error_details}"
sh "rm -f ./debug"
handleError(message)
}
}
4 changes: 4 additions & 0 deletions bin/compose.sh
@@ -0,0 +1,4 @@
#!/bin/bash

echo "Composing"
docker-compose up -d
4 changes: 4 additions & 0 deletions bin/decompose.sh
@@ -0,0 +1,4 @@
#!/bin/bash

echo "Decomposing"
docker-compose stop
7 changes: 7 additions & 0 deletions bin/prune.sh
@@ -0,0 +1,7 @@
#!/bin/bash

result=$(docker volume ls -qf dangling=true)

if [ ! -z "$result" ]; then
docker volume rm $result
fi
3 changes: 3 additions & 0 deletions bin/recompose.sh
@@ -0,0 +1,3 @@
#!/bin/bash

source bin/decompose.sh && source bin/destroy.sh && source bin/prune.sh && source bin/build.sh && source bin/compose.sh
4 changes: 2 additions & 2 deletions conf/grouper.conf
@@ -1,6 +1,6 @@
Listen 443
<VirtualHost *:443>
ServerAlias grouper.your.institution.edu
ServerAlias grouper.grouperappliance_i2network

SSLEngine on
SSLCertificateFile /etc/httpd/certs/server.crt
Expand All @@ -22,4 +22,4 @@ Listen 443
ProxyPass /grouper-ws/ ajp://localhost:8009/grouper-ws/ retry=0
ProxyPass /examples/ ajp://localhost:8009/examples/ retry=0

</VirtualHost>
</VirtualHost>
22 changes: 22 additions & 0 deletions conf/server.crt
@@ -0,0 +1,22 @@
-----BEGIN CERTIFICATE-----
MIIDrDCCApQCCQCqx2/xzYm5ejANBgkqhkiG9w0BAQsFADCBlzELMAkGA1UEBhMC
VVMxFzAVBgNVBAgTDk5vcnRoI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gp+Fo3InxsHN+QdfJmyXDzOvFBRLOgkdkCgYEA6cEY
konEDB7Kd4S7lYKuk1euvFp1XUk5MSXmz2JR6uvB5RaJJNvXBuZB0i60jeUHgA3V
mouwjuX1zsVSRQEtQ37eiQ2p7ivd1j86SlMBRzFxFempGV00IZevXiBxtfnx38Lw
mYYOWMXdX0CsV/HHvUpTrkC1F8rIP1tXj0IhwEcCgYEAq1q1P+OsCLBlWDSJNCkC
+5qqBEGqFa02M37YLqhkrA0UpXFgEhX6VZ63/qS0GRqfRimAROpyyYKRNtDW12gb
kTBOwcV2Cr8Ejn0Yv3Ix2WREvrqqEJlJkha3gm/aLu3FBaMs24hvTzXdCXJ1AO4v
jPncVyJOzaBR85DLTOt7kMkCgYAHoRjHN53hc2PSUM+6ioBeKL94QE+SUuB9/Smy
XRglXbp/WqPxQweanwtI6+NSukXrZQgyuhpyH4lNTV1pCSfMCykCOiLwthfQdVHW
uSzSgQea2nx9anBYJFZB8Tck5FqDnh4yNJDlTtfx0u+NE0Qcpn9isZP3idPNVZLf
Bx6I4wKBgQDagUD7YJ3oX/4mbBmWJ/z7fAWcUqdRC2kwVfOn2qdeRgVNXQD97u0f
ZUw7fH6MSKHkuQsM0UWxex2dxxfJaFH5aF5EqXzlT/9by4Ela9p6GtecyuNPDnm+
jReIeDTO73BnM0LJNPPyd/CSHvaVEgvVmjjNTkuBYpyk8HVXf/Cd/A==
-----END RSA PRIVATE KEY-----
31 changes: 31 additions & 0 deletions tests/running.bats
@@ -0,0 +1,31 @@
#!/usr/bin/env bats

load ../common

@test "Contains mysql grouper user" {
docker exec -i mariadb mysql -u root -h 127.0.0.1 --password=123321 -e 'SELECT User FROM mysql.user' | grep grouper_user
}

@test "Grouper database tables created" {
docker exec -i mariadb mysql -u root -h 127.0.0.1 --password=123321 grouper -e 'show tables' | grep grouper
}

@test "Continues running grouper container" {
docker ps | grep grouper | grep Up
}

@test "curl can connect to Grouper diagnostics URL successfully" {
skip
run docker exec -i grouper curl http://localhost:8080/grouper-ws/status?diagnosticType=all
echo ${output}
[ "$status" -eq 0 ]
[[ ${output} == *"302"* || ${output} == *"200"* ]]
}

@test "curl can connect to Grouper WS endpoint" {
skip
run docker exec -i grouper curl http://`docker-machine ip`/grouper-ws/
echo ${output}
[ "$status" -eq 0 ]
[[ ${output} == *"302"* || ${output} == *"200"* ]]
}