@Override protected void waitUntilReady() { WaitingConsumer waitingConsumer = new WaitingConsumer(); LogUtils.followOutput(DockerClientFactory.instance().client(), waitStrategyTarget.getContainerId(), waitingConsumer); Predicate<OutputFrame> waitPredicate = outputFrame -> // (?s) enables line terminator matching (equivalent to Pattern.DOTALL) outputFrame.getUtf8String().matches("(?s)" + regEx); try { waitingConsumer.waitUntil(waitPredicate, startupTimeout.getSeconds(), TimeUnit.SECONDS, times); } catch (TimeoutException e) { throw new ContainerLaunchException("Timed out waiting for log output matching '" + regEx + "'"); } }
@Override protected void waitUntilReady() { long seconds = startupTimeout.getSeconds(); try { Unreliables.retryUntilTrue((int) seconds, TimeUnit.SECONDS, () -> getRateLimiter().getWhenReady(this::isReady)); } catch (TimeoutException e) { throw new ContainerLaunchException( format("[%s] notifies that container[%s] is not ready after [%d] seconds, container cannot be started.", getContainerType(), waitStrategyTarget.getContainerId(), seconds)); } }
protected boolean isReady() { String commandName = getContainerType(); String containerId = waitStrategyTarget.getContainerId(); log.debug("{} execution of command {} for container id: {} ", commandName, containerId); ExecCmdResult healthCheckCmdResult = ContainerUtils.execCmd(DockerClientFactory.instance().client(), containerId, getCheckCommand()); log.debug("{} executed with exitCode: {}, output: {}", commandName, healthCheckCmdResult.getExitCode(), healthCheckCmdResult.getOutput()); if (healthCheckCmdResult.getExitCode() != 0) { log.debug("{} executed with exitCode !=0, considering status as unknown", commandName); return false; } log.debug("{} command executed, considering container {} successfully started", commandName, containerId); return true; } }
@Override protected void waitUntilReady() { WaitingConsumer waitingConsumer = new WaitingConsumer(); LogUtils.followOutput(DockerClientFactory.instance().client(), waitStrategyTarget.getContainerId(), waitingConsumer); Predicate<OutputFrame> waitPredicate = outputFrame -> // (?s) enables line terminator matching (equivalent to Pattern.DOTALL) outputFrame.getUtf8String().matches("(?s)" + regEx); try { waitingConsumer.waitUntil(waitPredicate, startupTimeout.getSeconds(), TimeUnit.SECONDS, times); } catch (TimeoutException e) { throw new ContainerLaunchException("Timed out waiting for log output matching '" + regEx + "'"); } }
@Override protected void waitUntilReady() { final DockerClient client = DockerClientFactory.instance().client(); final WaitingConsumer waitingConsumer = new WaitingConsumer(); LogUtils.followOutput(client, waitStrategyTarget.getContainerId(), waitingConsumer); try { waitingConsumer.waitUntil( f -> f.getUtf8String().contains("ready to serve client requests"), startupTimeout.getSeconds(), TimeUnit.SECONDS, 1 ); } catch (TimeoutException e) { throw new ContainerLaunchException("Timed out"); } } };
@Override protected void waitUntilReady() { final DockerClient client = DockerClientFactory.instance().client(); final WaitingConsumer waitingConsumer = new WaitingConsumer(); LogUtils.followOutput(client, waitStrategyTarget.getContainerId(), waitingConsumer); try { waitingConsumer.waitUntil( f -> f.getUtf8String().contains("ready to serve client requests"), startupTimeout.getSeconds(), TimeUnit.SECONDS, 1 ); } catch (TimeoutException e) { throw new ContainerLaunchException("Timed out"); } } };
@Override protected void waitUntilReady() { final DockerClient client = DockerClientFactory.instance().client(); final WaitingConsumer waitingConsumer = new WaitingConsumer(); LogUtils.followOutput(client, waitStrategyTarget.getContainerId(), waitingConsumer); try { waitingConsumer.waitUntil( f -> f.getUtf8String().contains("ready to serve client requests"), startupTimeout.getSeconds(), TimeUnit.SECONDS, 1 ); } catch (TimeoutException e) { throw new ContainerLaunchException("Timed out"); } } };
@Override protected boolean isReady() { String containerId = waitStrategyTarget.getContainerId(); log.debug("Check Aerospike container {} status", containerId); InspectContainerResponse containerInfo = waitStrategyTarget.getContainerInfo(); if (containerInfo == null) { log.debug("Aerospike container[{}] doesn't contain info. Abnormal situation, should not happen.", containerId); return false; } int port = getMappedPort(containerInfo.getNetworkSettings(), properties.port); String host = DockerClientFactory.instance().dockerHostIpAddress(); //TODO: Remove dependency to client https://www.aerospike.com/docs/tools/asmonitor/common_tasks.html try (AerospikeClient client = new AerospikeClient(host, port)) { return client.isConnected(); } catch (AerospikeException.Connection e) { log.debug("Aerospike container: {} not yet started. {}", containerId, e.getMessage()); } return false; }
@Override protected void waitUntilReady() { final DockerClient client = DockerClientFactory.instance().client(); final WaitingConsumer waitingConsumer = new WaitingConsumer(); LogUtils.followOutput(client, waitStrategyTarget.getContainerId(), waitingConsumer); try { waitingConsumer.waitUntil( f -> f.getUtf8String().contains("etcdserver: published"), startupTimeout.getSeconds(), TimeUnit.SECONDS, 1 ); } catch (TimeoutException e) { throw new ContainerLaunchException("Timed out"); } } };