From 6468352c1068db96c1570a5972337eb698c0f8e3 Mon Sep 17 00:00:00 2001 From: Michael Vorburger Date: Wed, 16 Jan 2019 03:57:41 +0100 Subject: [PATCH 1/2] minor: small clean-ups in test.sh --- test.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/test.sh b/test.sh index 34110342..f13c0abb 100755 --- a/test.sh +++ b/test.sh @@ -75,7 +75,7 @@ function test_entrypoint() { echo "APP TEST FAILED (with entrypoint ${entrypoint})" docker logs ${container_id} docker rm -f ${container_id} - return -123 + return -123 fi } @@ -137,6 +137,7 @@ function test_image() { test_container "${name}-binary-example" + # ---------------------------------------------------------------------------------- # Maven Wrapper # ---------------------------------------------------------------------------------- @@ -144,11 +145,10 @@ function test_image() { s2i build --copy java/examples/maven-wrapper ${name} ${name}-maven-wrapper-example s2i build --copy java/examples/maven-wrapper ${name} ${name}-maven-wrapper-example --incremental + # ---------------------------------------------------------------------------------- # Entrypoint Binary # ---------------------------------------------------------------------------------- - local dir=$1 - local name=$2 curl https://repo.spring.io/release/org/springframework/cloud/spring-cloud-deployer-spi-test-app/1.3.4.RELEASE/spring-cloud-deployer-spi-test-app-1.3.4.RELEASE-exec.jar \ -o java/examples/binary/deployments/app.jar @@ -159,7 +159,6 @@ function test_image() { test_entrypoint "${name}-entrypoint-binary-example" "java -jar /deployments/app.jar" # works test_entrypoint "${name}-entrypoint-binary-example" /opt/run-java/run-java.sh # will fail until https://github.com/fabric8io-images/run-java-sh/issues/75 is fixed test_entrypoint "${name}-entrypoint-binary-example" /usr/local/s2i/run # will fail until https://github.com/fabric8io-images/run-java-sh/issues/75 is fixed - } # ================================================================================== From 5ece25cb7151d1cc1bc923cdc6c14c24855387da Mon Sep 17 00:00:00 2001 From: Michael Vorburger Date: Wed, 16 Jan 2019 03:50:47 +0100 Subject: [PATCH 2/2] show docker logs in case of test failure Inspired by #212 and found this very useful for #213 --- test.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test.sh b/test.sh index f13c0abb..50d4aa21 100755 --- a/test.sh +++ b/test.sh @@ -15,13 +15,14 @@ function test_app() { local http_port="$(docker port ${container_id} ${port}|sed 's/0.0.0.0://')" local http_reply=$(curl --silent --show-error http://localhost:$http_port) - docker rm -f "$container_id" - if [ "$http_reply" = 'hello, world' ]; then echo "APP TEST PASSED" + docker rm -f ${container_id} return 0 else echo "APP TEST FAILED" + docker logs ${container_id} + docker rm -f ${container_id} return -123 fi } @@ -40,15 +41,16 @@ function test_metrics() { local metrics_port="$(docker port ${container_id} ${port}|sed 's/0.0.0.0://')" local metrics_reply=$(curl --silent --show-error http://localhost:$metrics_port/metrics) - docker rm -f "$container_id" - case $metrics_reply in *"jvm_threads_current"*) echo "METRICS TEST PASSED" + docker rm -f ${container_id} return 0 ;; *) echo "METRICS TEST FAILED" + docker logs ${container_id} + docker rm -f ${container_id} return -123 ;; esac