From b2191468b18b92da8a1f1982ae708f06e31cf923 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Tue, 30 Apr 2019 13:10:49 +0200 Subject: [PATCH 1/4] upgrade to jetty-9.4.18 Signed-off-by: Greg Wilkins --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 2b1198e9..39aa780d 100644 --- a/pom.xml +++ b/pom.xml @@ -31,8 +31,8 @@ yyyy-MM-dd-HH-mm 0.84.0-alpha 4 - 17 - 9.${jetty9.minor.version}.${jetty9.dot.version}.v20190418 + 18 + 9.${jetty9.minor.version}.${jetty9.dot.version}.v20190429 ${docker.tag.prefix}9.${jetty9.minor.version} ${docker.tag.prefix}9.${jetty9.minor.version}-${maven.build.timestamp} From a3c88d801b91d03bd38be1d5bf082819f29df15d Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Wed, 1 May 2019 09:52:27 +0200 Subject: [PATCH 2/4] Added better debugging for test failures Signed-off-by: Greg Wilkins --- scripts/local_integration_test.sh | 4 +-- .../cloud/runtime/jetty/util/HttpUrlUtil.java | 29 +++++++++++-------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/scripts/local_integration_test.sh b/scripts/local_integration_test.sh index 102de19d..9d9cf856 100755 --- a/scripts/local_integration_test.sh +++ b/scripts/local_integration_test.sh @@ -46,7 +46,7 @@ docker build -t $APP_IMAGE . || gcloud docker -- build -t $APP_IMAGE . # run app container locally to test shutdown logging echo "Starting app container..." -docker run --rm --name $CONTAINER -e "SHUTDOWN_LOGGING_THREAD_DUMP=true" -e "SHUTDOWN_LOGGING_HEAP_INFO=true" $APP_IMAGE &> $OUTPUT_FILE & +docker run --rm --name $CONTAINER -e "HEAP_SIZE_MB=8192" -e "SHUTDOWN_LOGGING_THREAD_DUMP=true" -e "SHUTDOWN_LOGGING_HEAP_INFO=true" $APP_IMAGE &> $OUTPUT_FILE & function waitForOutput() { found_output='false' @@ -76,4 +76,4 @@ waitForOutput 'num.*instances.*bytes.*class name' popd -echo 'OK' \ No newline at end of file +echo 'OK' diff --git a/tests/gcloud-testing-core/src/main/java/com/google/cloud/runtime/jetty/util/HttpUrlUtil.java b/tests/gcloud-testing-core/src/main/java/com/google/cloud/runtime/jetty/util/HttpUrlUtil.java index eec5c3a4..f04449fa 100644 --- a/tests/gcloud-testing-core/src/main/java/com/google/cloud/runtime/jetty/util/HttpUrlUtil.java +++ b/tests/gcloud-testing-core/src/main/java/com/google/cloud/runtime/jetty/util/HttpUrlUtil.java @@ -46,30 +46,35 @@ public final class HttpUrlUtil { * @param unit the time unit to wait for server up */ public static void waitForServerUp(URI uri, int duration, TimeUnit unit) { - System.err.println("Waiting for server up: " + uri); - boolean waiting = true; + + log.info("Waiting for server up: " + uri); + boolean ok = false; + long wait = 0; long expiration = System.currentTimeMillis() + unit.toMillis(duration); - while (waiting && System.currentTimeMillis() < expiration) { + while (!ok && System.currentTimeMillis() < expiration) { try { - System.out.print("."); HttpURLConnection http = openTo(uri); int statusCode = http.getResponseCode(); - if (statusCode != HttpURLConnection.HTTP_OK) { - log.log(Level.FINER, "Waiting 2s for next attempt"); - TimeUnit.SECONDS.sleep(2); - } else { - waiting = false; + if (statusCode == HttpURLConnection.HTTP_OK) { + ok = true; + break; } } catch (MalformedURLException e) { throw new IllegalArgumentException("Invalid URI: " + uri.toString()); } catch (IOException e) { - log.log(Level.FINEST, "Ignoring IOException", e); + log.log(Level.INFO, "Ignoring IOException", e); + } + try { + wait += 500; + log.log(Level.INFO, "Waiting " + wait + "ms for next attempt"); + TimeUnit.MILLISECONDS.sleep(wait); } catch (InterruptedException ignore) { + System.err.println(ignore); // ignore } } - System.err.println(); - System.err.println("Server seems to be up."); + + log.info("Server up: " + ok); } /** From 429b4c8aeabc05c3550197438e7383df7ccd6aae Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Wed, 1 May 2019 10:46:41 +0200 Subject: [PATCH 3/4] set heap size for smoketest Signed-off-by: Greg Wilkins --- .../java/com/google/cloud/runtime/jetty/util/HttpUrlUtil.java | 3 ++- tests/test-war-smoke/pom.xml | 2 ++ tests/test-war-smoke/src/main/docker/Dockerfile | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/gcloud-testing-core/src/main/java/com/google/cloud/runtime/jetty/util/HttpUrlUtil.java b/tests/gcloud-testing-core/src/main/java/com/google/cloud/runtime/jetty/util/HttpUrlUtil.java index f04449fa..ebf66139 100644 --- a/tests/gcloud-testing-core/src/main/java/com/google/cloud/runtime/jetty/util/HttpUrlUtil.java +++ b/tests/gcloud-testing-core/src/main/java/com/google/cloud/runtime/jetty/util/HttpUrlUtil.java @@ -62,7 +62,8 @@ public static void waitForServerUp(URI uri, int duration, TimeUnit unit) { } catch (MalformedURLException e) { throw new IllegalArgumentException("Invalid URI: " + uri.toString()); } catch (IOException e) { - log.log(Level.INFO, "Ignoring IOException", e); + log.log(Level.INFO, "Ignoring IOException: " + e); + log.log(Level.FINEST, "Ignoring IOException", e); } try { wait += 500; diff --git a/tests/test-war-smoke/pom.xml b/tests/test-war-smoke/pom.xml index 7f13b344..8c45730c 100644 --- a/tests/test-war-smoke/pom.xml +++ b/tests/test-war-smoke/pom.xml @@ -149,6 +149,8 @@ start + + stop diff --git a/tests/test-war-smoke/src/main/docker/Dockerfile b/tests/test-war-smoke/src/main/docker/Dockerfile index 9d1514d4..78b5f705 100644 --- a/tests/test-war-smoke/src/main/docker/Dockerfile +++ b/tests/test-war-smoke/src/main/docker/Dockerfile @@ -1,6 +1,7 @@ FROM ${jetty.test.image} ADD ${project.build.finalName}.war $JETTY_BASE/webapps/root.war +ENV HEAP_SIZE_MB=4096 # Uncomment to dump the jetty configuration at startup # WORKDIR $JETTY_BASE # RUN java -jar $JETTY_HOME/start.jar --update-ini jetty.server.dumpAfterStart=true From 92d3bfb65734b287435d97df24e0358e02576eca Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Wed, 1 May 2019 11:38:51 +0200 Subject: [PATCH 4/4] test with a smaller heap Signed-off-by: Greg Wilkins --- scripts/local_integration_test.sh | 2 +- tests/test-war-smoke/src/main/docker/Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/local_integration_test.sh b/scripts/local_integration_test.sh index 9d9cf856..0d0245a1 100755 --- a/scripts/local_integration_test.sh +++ b/scripts/local_integration_test.sh @@ -46,7 +46,7 @@ docker build -t $APP_IMAGE . || gcloud docker -- build -t $APP_IMAGE . # run app container locally to test shutdown logging echo "Starting app container..." -docker run --rm --name $CONTAINER -e "HEAP_SIZE_MB=8192" -e "SHUTDOWN_LOGGING_THREAD_DUMP=true" -e "SHUTDOWN_LOGGING_HEAP_INFO=true" $APP_IMAGE &> $OUTPUT_FILE & +docker run --rm --name $CONTAINER -e "HEAP_SIZE_MB=512" -e "SHUTDOWN_LOGGING_THREAD_DUMP=true" -e "SHUTDOWN_LOGGING_HEAP_INFO=true" $APP_IMAGE &> $OUTPUT_FILE & function waitForOutput() { found_output='false' diff --git a/tests/test-war-smoke/src/main/docker/Dockerfile b/tests/test-war-smoke/src/main/docker/Dockerfile index 78b5f705..649b3d56 100644 --- a/tests/test-war-smoke/src/main/docker/Dockerfile +++ b/tests/test-war-smoke/src/main/docker/Dockerfile @@ -1,7 +1,7 @@ FROM ${jetty.test.image} ADD ${project.build.finalName}.war $JETTY_BASE/webapps/root.war -ENV HEAP_SIZE_MB=4096 +ENV HEAP_SIZE_MB=512 # Uncomment to dump the jetty configuration at startup # WORKDIR $JETTY_BASE # RUN java -jar $JETTY_HOME/start.jar --update-ini jetty.server.dumpAfterStart=true