diff --git a/Dockerfile b/Dockerfile index 847b1589..b6be311d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,7 @@ RUN yum update -y \ RUN yum install -y wget tar unzip dos2unix patch ARG GROUPER_CONTAINER_VERSION -ENV GROUPER_VERSION=2.5.33 \ +ENV GROUPER_VERSION=2.5.34 \ GROUPER_CONTAINER_VERSION=$GROUPER_CONTAINER_VERSION # Install Corretto Java JDK @@ -32,7 +32,7 @@ RUN echo 'Installing Grouper'; \ cd /opt/grouper/$GROUPER_VERSION/ \ && $JAVA_HOME/bin/java -cp :grouperInstaller.jar edu.internet2.middleware.grouperInstaller.GrouperInstaller FROM centos:centos7 as cleanup -ENV GROUPER_VERSION=2.5.33 \ +ENV GROUPER_VERSION=2.5.34 \ TOMEE_VERSION=7.0.0 RUN mkdir -p /opt/grouper/grouperWebapp/ RUN mkdir -p /opt/tomee/ diff --git a/container_files/tier-support/test/grouperContainerUnitTest.sh b/container_files/tier-support/test/grouperContainerUnitTest.sh index e5fc69ea..94263e77 100644 --- a/container_files/tier-support/test/grouperContainerUnitTest.sh +++ b/container_files/tier-support/test/grouperContainerUnitTest.sh @@ -5,13 +5,13 @@ if [ "$#" -ne 4 ]; then exit 1 fi -expectedSuccesses=538 +expectedSuccesses=554 export containerName=$1 export imageName=$2 export containerVersion=$3 export grouperVersion=$4 -export globalSleepSecondsAfterRun=5 +export globalSleepSecondsAfterRun=10 export globalExitOnError=false export successCount=0 diff --git a/container_files/tier-support/test/grouperContainerUnitTestLibrary.sh b/container_files/tier-support/test/grouperContainerUnitTestLibrary.sh index f3269692..29fca8e5 100644 --- a/container_files/tier-support/test/grouperContainerUnitTestLibrary.sh +++ b/container_files/tier-support/test/grouperContainerUnitTestLibrary.sh @@ -163,6 +163,18 @@ assertNotListeningOnPort() { assertEquals "not listening on port $1" "0" "$var" } +containerCommandResultEquals() { + + if [ "$#" -ne 2 ]; then + echo "You must enter exactly 2 arguments: the command to run and the expected result" + exit 1 + fi + local command="docker exec $containerName $1" + local var="$(runCommand "$command")" + assertEquals "$1" "$2" "$var" + +} + runCommand() { if [ "$#" -ne 1 ]; then echo "Pass the command to run" diff --git a/container_files/tier-support/test/grouperContainerUnitTestQuickstart.sh b/container_files/tier-support/test/grouperContainerUnitTestQuickstart.sh index 7bdbe426..16afbb02 100644 --- a/container_files/tier-support/test/grouperContainerUnitTestQuickstart.sh +++ b/container_files/tier-support/test/grouperContainerUnitTestQuickstart.sh @@ -121,5 +121,32 @@ testContainerQuickstart() { curl -L -k -u GrouperSystem:thisPassIsCopyrightedDontUse https://localhost/grouper-ws-scim/v2/Groups/ -o index.html assertLocalFileContains index.html 'etc:workflowEditors' + docker stop $containerName + docker start $containerName + + sleep $globalSleepSecondsAfterRun + + # one for hsqldb + assertNumberOfTomcatProcesses 2 + assertNumberOfApacheProcesses 5 + assertNumberOfShibProcesses 0 + + assertListeningOnPort 443 + assertListeningOnPort 80 + assertListeningOnPort 8009 + assertListeningOnPort 9001 + + curl -L -k -u GrouperSystem:thisPassIsCopyrightedDontUse https://localhost -o index.html + assertLocalFileContains index.html document.location.href + + curl -L -k -u GrouperSystem:thisPassIsCopyrightedDontUse https://localhost/grouper/grouperUi/app/UiV2Main.index?operation=UiV2Main.indexMain -o index.html + assertLocalFileContains index.html 'end index.jsp' + + containerCommandResultEquals "ps -ef | grep root | grep cat | grep -v grep | wc -l" 6 + containerCommandResultEquals "ps -ef | grep root | grep awk | grep supervisord | wc -l" 1 + containerCommandResultEquals "ps -ef | grep root | grep awk | grep grouper | wc -l" 1 + containerCommandResultEquals "ps -ef | grep root | grep awk | grep httpd | wc -l" 1 + containerCommandResultEquals "ps -ef | grep root | grep awk | grep tomee | wc -l" 1 + } export -f testContainerQuickstart diff --git a/container_files/tier-support/test/grouperContainerUnitTestUi.sh b/container_files/tier-support/test/grouperContainerUnitTestUi.sh index 5d995515..85c2e6eb 100644 --- a/container_files/tier-support/test/grouperContainerUnitTestUi.sh +++ b/container_files/tier-support/test/grouperContainerUnitTestUi.sh @@ -19,6 +19,10 @@ testContainerUi() { docker run --detach --name $containerName --publish 443:443 $imageName ui sleep $globalSleepSecondsAfterRun + + assertFileContains /opt/tomee/conf/server.xml 'address="0.0.0.0"' + assertFileContains /opt/tomee/conf/server.xml 'allowedRequestAttributesPattern=".*"' + assertFileExists /opt/grouper/grouperWebapp/WEB-INF/libWs/axis2-kernel-1.6.4.jar assertFileNotExists /opt/grouper/grouperWebapp/WEB-INF/lib/axis2-kernel-1.6.4.jar assertFileExists /opt/grouper/grouperWebapp/WEB-INF/libScim/stax-api-1.0-2.jar diff --git a/container_files/tier-support/test/rebuildTestContainer.sh b/container_files/tier-support/test/rebuildTestContainer.sh new file mode 100644 index 00000000..cc8ce32e --- /dev/null +++ b/container_files/tier-support/test/rebuildTestContainer.sh @@ -0,0 +1,26 @@ +#/bin/bash + +if [ "$#" -ne 2 ]; then + echo "You must enter exactly 2 command line arguments: grouper base container version, grouper_container_git_base_dir" + echo "rebuildTestContainer.sh 2.5.33 /mnt/c/mchyzer/git/grouper_container" + exit 1 +fi + +export grouperBaseContainerVersion=$1 +export grouperContainerGitPath=$2 +export subimageName=my-grouper-$1 + +export reldir=`dirname $0` + +# /mnt/c/mchyzer/git/grouper_container +mkdir -p $reldir/slashRoot/usr/local/bin +rsync -avzpl $grouperContainerGitPath/container_files/usr-local-bin/* $reldir/slashRoot/usr/local/bin + +rsync -avzpl $grouperContainerGitPath/container_files/tier-support/test/grouper*.sh $reldir + +mkdir -p $reldir/slashRoot/opt/tomee/conf +rsync -avzpl $grouperContainerGitPath/container_files/tomee/conf/* $reldir/slashRoot/opt/tomee/conf/ + +docker build -f $reldir/testContainer.Dockerfile -t $subimageName --build-arg GROUPER_VERSION=$grouperBaseContainerVersion $reldir + +echo "Run tests with: ./grouperContainerUnitTest.sh grouper-test $subimageName:latest $grouperBaseContainerVersion $grouperBaseContainerVersion" \ No newline at end of file diff --git a/container_files/tier-support/test/testContainer.Dockerfile b/container_files/tier-support/test/testContainer.Dockerfile new file mode 100644 index 00000000..5f391e07 --- /dev/null +++ b/container_files/tier-support/test/testContainer.Dockerfile @@ -0,0 +1,11 @@ +# this matches the version you decided on from release notes +ARG GROUPER_VERSION=2.5.XX + +# --build-arg GROUPER_VERSION=${VARIABLE_NAME} +FROM i2incommon/grouper:${GROUPER_VERSION} + +# this will overlay all the files from /opt/grouperContainer/slashRoot on to / +COPY slashRoot / + +RUN chown -R tomcat:tomcat /opt/grouper \ + && chown -R tomcat:tomcat /opt/tomee \ No newline at end of file diff --git a/container_files/tomee/conf/server.xml.turnOnAjp.patch b/container_files/tomee/conf/server.xml.turnOnAjp.patch index d0c32c3d..0c9d5fdd 100644 --- a/container_files/tomee/conf/server.xml.turnOnAjp.patch +++ b/container_files/tomee/conf/server.xml.turnOnAjp.patch @@ -10,7 +10,7 @@ - port="8009" - redirectPort="8443" /> - --> -+ ++ +