@Override public void pull() throws IOException, InterruptedException { dockerCompose.pull(); }
@Override public void initialize() throws Exception { determineEffectiveDockerFile(); if (Strings.isFilled(dockerfile)) { LOG.INFO("Starting docker compose using: %s", dockerfile); this.dockerCompose = new RetryingDockerCompose(retryAttempts, new DefaultDockerCompose(dockerComposeExecutable(), machine())); if (pull) { try { LOG.INFO("Executing docker-compose pull..."); dockerCompose.pull(); } catch (Exception e) { LOG.WARN("docker-compose pull failed: %s (%s)", e.getMessage(), e.getClass().getName()); } } try { LOG.INFO("Executing docker-compose up..."); dockerCompose.up(); } catch (Exception e) { LOG.WARN("docker-compose up failed: %s (%s)", e.getMessage(), e.getClass().getName()); } awaitClusterHealth(); PortMapper.setMapper(this); } else { LOG.INFO("No docker file is present - skipping...."); } }
@Test public void calls_pull_build_and_up_when_tests_are_run_and_pullOnStartup_is_true() throws InterruptedException, IOException { defaultBuilder().pullOnStartup(true) .build() .before(); verify(dockerCompose).pull(); verify(dockerCompose).build(); verify(dockerCompose).up(); }
@Override public void before() throws IOException, InterruptedException { log.debug("Starting docker-compose cluster"); if (pullOnStartup()) { dockerCompose().pull(); } dockerCompose().build(); DockerCompose upDockerCompose = dockerCompose(); if (removeConflictingContainersOnStartup()) { upDockerCompose = new ConflictingContainerRemovingDockerCompose(upDockerCompose, docker()); } upDockerCompose.up(); logCollector().startCollecting(dockerCompose()); log.debug("Waiting for services"); new ClusterWait(ClusterHealthCheck.nativeHealthChecks(), nativeServiceHealthCheckTimeout()) .waitUntilReady(containers()); clusterWaits().forEach(clusterWait -> clusterWait.waitUntilReady(containers())); log.debug("docker-compose cluster started"); }