use of io.fabric8.maven.docker.wait.ExitCodeChecker in project docker-maven-plugin by fabric8io.
the class ExitCodeCheckerTest method checkReturnsFalseIfContainerDoesNotExist.
@Test
public void checkReturnsFalseIfContainerDoesNotExist() throws Exception {
new Expectations() {
{
Exception e = new DockerAccessException("Cannot find container %s", CONTAINER_ID);
queryService.getMandatoryContainer(CONTAINER_ID);
result = e;
}
};
ExitCodeChecker checker = new ExitCodeChecker(0, queryService, CONTAINER_ID);
assertThat(checker.check()).isFalse();
}
use of io.fabric8.maven.docker.wait.ExitCodeChecker in project docker-maven-plugin by fabric8io.
the class WaitService method prepareWaitCheckers.
private List<WaitChecker> prepareWaitCheckers(ImageConfiguration imageConfig, Properties projectProperties, String containerId) throws IOException {
WaitConfiguration wait = getWaitConfiguration(imageConfig);
if (wait == null) {
return Collections.emptyList();
}
List<WaitChecker> checkers = new ArrayList<>();
if (wait.getUrl() != null) {
checkers.add(getUrlWaitChecker(imageConfig.getDescription(), projectProperties, wait));
}
if (wait.getLog() != null) {
log.debug("LogWaitChecker: Waiting on %s", wait.getLog());
checkers.add(new LogWaitChecker(wait.getLog(), dockerAccess, containerId, log));
}
if (wait.getTcp() != null) {
try {
Container container = queryService.getMandatoryContainer(containerId);
checkers.add(getTcpWaitChecker(container, imageConfig.getDescription(), projectProperties, wait.getTcp()));
} catch (DockerAccessException e) {
throw new IOException("Unable to access container " + containerId, e);
}
}
if (Boolean.TRUE.equals(wait.getHealthy())) {
checkers.add(new HealthCheckChecker(dockerAccess, containerId, imageConfig.getDescription(), log));
}
if (wait.getExit() != null) {
checkers.add(new ExitCodeChecker(wait.getExit(), queryService, containerId));
}
return checkers;
}
Aggregations