Skip to content

Commit

Permalink
test: improved Tomcat 10 test
Browse files Browse the repository at this point in the history
  • Loading branch information
manusa committed Apr 22, 2022
1 parent 0f05df4 commit 779688d
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ jobs:
echo "Building quay.io/jkube/${{ matrix.image }}:${TAG}"
cekit --descriptor ${{ matrix.image }}.yaml build docker --tag="quay.io/jkube/${{ matrix.image }}:${TAG}"
- name: Test
if: success() && startsWith(matrix.image, 'jkube-java')
if: success()
run: |
./scripts/test-${{ matrix.image }}.sh
4 changes: 2 additions & 2 deletions scripts/test-jkube-jetty9.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ IMAGE="quay.io/jkube/jkube-jetty9:$TAG_OR_LATEST"

assertContains "$(dockerRun 'id')" "uid=1000 gid=0(root) groups=0(root)" || reportError "Invalid run user, should be 1000"

assertContains "$(dockerRun 'java -version')" 'openjdk version "17.0.1"' || reportError "Invalid Java version"
assertContains "$(dockerRun 'java -version')" 'openjdk version "17.0.2"' || reportError "Invalid Java version"

# S2I scripts
s2i="$(dockerRun 'ls -la /usr/local/s2i/')"
Expand All @@ -24,7 +24,7 @@ assertContains "$assembleScript" 'copy_dir maven$' || reportError "Invalid s2i a
env_variables="$(dockerRun 'env')"
assertContains "$env_variables" "JAVA_HOME=/usr/local/openjdk-17$" \
|| reportError "JAVA_HOME invalid"
assertContains "$env_variables" "JAVA_VERSION=17.0.1$" \
assertContains "$env_variables" "JAVA_VERSION=17.0.2$" \
|| reportError "JAVA_VERSION invalid"
assertContains "$env_variables" "JETTY_HOME=/usr/local/jetty$" \
|| reportError "JETTY_HOME invalid"
Expand Down
2 changes: 1 addition & 1 deletion scripts/test-jkube-karaf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ IMAGE="quay.io/jkube/jkube-karaf:$TAG_OR_LATEST"

assertContains "$(dockerRun 'id')" "uid=1000 gid=0(root) groups=0(root)" || reportError "Invalid run user, should be 1000"

assertContains "$(dockerRun 'java -version')" 'openjdk version "17.0.1"' || reportError "Invalid Java version"
assertContains "$(dockerRun 'java -version')" 'openjdk version "17.0.2"' || reportError "Invalid Java version"

# S2I scripts
s2i="$(dockerRun 'ls -la /usr/local/s2i/')"
Expand Down
13 changes: 10 additions & 3 deletions scripts/test-jkube-tomcat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ IMAGE="quay.io/jkube/jkube-tomcat:$TAG_OR_LATEST"

assertContains "$(dockerRun 'id')" "uid=1000 gid=0(root) groups=0(root)" || reportError "Invalid run user, should be 1000"

assertContains "$(dockerRun 'java -version')" 'openjdk version "17.0.1"' || reportError "Invalid Java version"
assertContains "$(dockerRun 'java -version')" 'openjdk version "17.0.2"' || reportError "Invalid Java version"

# S2I scripts
s2i="$(dockerRun 'ls -la /usr/local/s2i/')"
Expand All @@ -19,16 +19,23 @@ assembleScript="$(dockerRun 'cat /usr/local/s2i/assemble')"
assertContains "$assembleScript" 'copy_dir bin$' || reportError "Invalid s2i assemble script"
assertContains "$assembleScript" 'copy_dir deployments$' || reportError "Invalid s2i assemble script"
assertContains "$assembleScript" 'copy_dir maven$' || reportError "Invalid s2i assemble script"
runScript="$(dockerRun 'cat /usr/local/s2i/run')"
assertContains "$runScript" 'webappsDir=${TOMCAT_WEBAPPS_DIR:-"webapps"}' || reportError "Invalid s2i run script"
assertContains "$runScript" 'target="${CATALINA_HOME}/${webappsDir}"' || reportError "Invalid s2i run script"

# Legacy webapps directory
tomcatDir="$(dockerRun 'ls /usr/local/tomcat/')"
assertContains "$tomcatDir" "^webapps-javaee$" || reportError "webapps-javaee not found"

# Env
env_variables="$(dockerRun 'env')"
assertContains "$env_variables" "JAVA_HOME=/opt/java/openjdk$" \
|| reportError "JAVA_HOME invalid"
assertContains "$env_variables" "JAVA_VERSION=jdk-17.0.1+12$" \
assertContains "$env_variables" "JAVA_VERSION=jdk-17.0.2+8$" \
|| reportError "JAVA_VERSION invalid"
assertContains "$env_variables" "CATALINA_HOME=/usr/local/tomcat$" \
|| reportError "CATALINA_HOME invalid"
assertContains "$env_variables" "TOMCAT_VERSION=10.0.18$" \
assertMatches "$env_variables" "TOMCAT_VERSION=10.1.[0-9A-Z-]+$" \
|| reportError "TOMCAT_VERSION invalid"
assertContains "$env_variables" "DEPLOYMENTS_DIR=/deployments$" \
|| reportError "DEPLOYMENTS_DIR invalid"
6 changes: 3 additions & 3 deletions scripts/test-jkube-tomcat9.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ IMAGE="quay.io/jkube/jkube-tomcat9:$TAG_OR_LATEST"

assertContains "$(dockerRun 'id')" "uid=1000 gid=0(root) groups=0(root)" || reportError "Invalid run user, should be 1000"

assertContains "$(dockerRun 'java -version')" 'openjdk version "17.0.1"' || reportError "Invalid Java version"
assertContains "$(dockerRun 'java -version')" 'openjdk version "17.0.2"' || reportError "Invalid Java version"

# S2I scripts
s2i="$(dockerRun 'ls -la /usr/local/s2i/')"
Expand All @@ -24,11 +24,11 @@ assertContains "$assembleScript" 'copy_dir maven$' || reportError "Invalid s2i a
env_variables="$(dockerRun 'env')"
assertContains "$env_variables" "JAVA_HOME=/opt/java/openjdk$" \
|| reportError "JAVA_HOME invalid"
assertContains "$env_variables" "JAVA_VERSION=jdk-17.0.1+12$" \
assertContains "$env_variables" "JAVA_VERSION=jdk-17.0.2+8$" \
|| reportError "JAVA_VERSION invalid"
assertContains "$env_variables" "CATALINA_HOME=/usr/local/tomcat$" \
|| reportError "CATALINA_HOME invalid"
assertContains "$env_variables" "TOMCAT_VERSION=9.0.56$" \
assertContains "$env_variables" "TOMCAT_VERSION=9.0.62$" \
|| reportError "TOMCAT_VERSION invalid"
assertContains "$env_variables" "DEPLOYMENTS_DIR=/deployments$" \
|| reportError "DEPLOYMENTS_DIR invalid"

0 comments on commit 779688d

Please sign in to comment.