From b1e12fae5334df445dbc7111360dc9303802bf6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Grzegorz=20Kokosi=C5=84ski?= Date: Tue, 10 Sep 2019 10:22:50 +0200 Subject: [PATCH] Store healthCheck as field --- .../io/prestosql/testing/docker/DockerContainer.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/presto-testing-docker/src/main/java/io/prestosql/testing/docker/DockerContainer.java b/presto-testing-docker/src/main/java/io/prestosql/testing/docker/DockerContainer.java index 0549679c076c3..3385a419f93ef 100644 --- a/presto-testing-docker/src/main/java/io/prestosql/testing/docker/DockerContainer.java +++ b/presto-testing-docker/src/main/java/io/prestosql/testing/docker/DockerContainer.java @@ -59,6 +59,7 @@ public final class DockerContainer private final String image; private final Map environment; private final List capabilities; + private final CheckedConsumer healthCheck; private DockerClient dockerClient; private String containerId; @@ -69,8 +70,9 @@ public DockerContainer(String image, List ports, Map en this.image = requireNonNull(image, "image is null"); this.environment = ImmutableMap.copyOf(requireNonNull(environment, "environment is null")); this.capabilities = ImmutableList.copyOf(requireNonNull(capabilities, "capabilities is null")); + this.healthCheck = requireNonNull(healthCheck, "healthCheck is null"); try { - startContainer(ports, healthCheck); + startContainer(ports); } catch (Exception e) { closeAllSuppress(e, this); @@ -78,7 +80,7 @@ public DockerContainer(String image, List ports, Map en } } - private void startContainer(List ports, CheckedConsumer healthCheck) + private void startContainer(List ports) throws Exception { dockerClient = DefaultDockerClient.fromEnv().build(); @@ -108,7 +110,7 @@ private void startContainer(List ports, CheckedConsumer ports) waitForContainerPorts(ports); } - private void waitForContainer(CheckedConsumer healthCheck) + private void waitForContainer() { RetryPolicy retryPolicy = new RetryPolicy<>() .withMaxDuration(Duration.of(10, MINUTES))