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} diff --git a/scripts/local_integration_test.sh b/scripts/local_integration_test.sh index 102de19d..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 "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' @@ -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..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 @@ -46,30 +46,36 @@ 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.INFO, "Ignoring IOException: " + e); log.log(Level.FINEST, "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); } /** 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..649b3d56 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=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