Search in sources :

Example 26 with DockerAccessException

use of org.eclipse.jkube.kit.build.service.docker.access.DockerAccessException in project jkube by eclipse.

the class DockerAccessWithHcClientTest method testLoadImageFail.

@Test
public void testLoadImageFail() throws IOException {
    givenAnImageName("test");
    givenArchiveFile("test.tar");
    givenThePostWillFail();
    DockerAccessException dockerAccessException = assertThrows(DockerAccessException.class, () -> client.loadImage(imageName, new File(archiveFile)));
    assertThat(dockerAccessException).isNotNull();
}
Also used : DockerAccessException(org.eclipse.jkube.kit.build.service.docker.access.DockerAccessException) File(java.io.File) Test(org.junit.Test)

Example 27 with DockerAccessException

use of org.eclipse.jkube.kit.build.service.docker.access.DockerAccessException in project jkube by eclipse.

the class DockerAccessWithHcClientTest method testPushFailes_noRetry.

@Test
public void testPushFailes_noRetry() throws Exception {
    givenAnImageName("test");
    givenThePushWillFail(0);
    DockerAccessException dae = assertThrows(DockerAccessException.class, this::whenPushImage);
    assertThat(dae).isNotNull();
}
Also used : DockerAccessException(org.eclipse.jkube.kit.build.service.docker.access.DockerAccessException) Test(org.junit.Test)

Example 28 with DockerAccessException

use of org.eclipse.jkube.kit.build.service.docker.access.DockerAccessException in project jkube by eclipse.

the class HealthCheckChecker method check.

@Override
public boolean check() {
    try {
        final ContainerDetails container = docker.getContainer(containerId);
        if (container == null) {
            log.debug("HealthWaitChecker: Container %s not found");
            return false;
        }
        if (container.getHealthcheck() == null) {
            throw new IllegalArgumentException("Can not wait for healthstate of " + imageConfigDesc + ". No HEALTHCHECK configured.");
        }
        if (first) {
            log.info("%s: Waiting to become healthy", imageConfigDesc);
            log.debug("HealthWaitChecker: Waiting for healthcheck: '%s'", container.getHealthcheck());
            first = false;
        } else if (log.isDebugEnabled()) {
            log.debug("HealthWaitChecker: Waiting on healthcheck '%s'", container.getHealthcheck());
        }
        return container.isHealthy();
    } catch (DockerAccessException e) {
        log.warn("Error while checking health: %s", e.getMessage());
        return false;
    }
}
Also used : DockerAccessException(org.eclipse.jkube.kit.build.service.docker.access.DockerAccessException) ContainerDetails(org.eclipse.jkube.kit.build.api.model.ContainerDetails)

Aggregations

DockerAccessException (org.eclipse.jkube.kit.build.service.docker.access.DockerAccessException)28 IOException (java.io.IOException)21 JsonObject (com.google.gson.JsonObject)8 Test (org.junit.Test)5 ArrayList (java.util.ArrayList)3 ImageName (org.eclipse.jkube.kit.config.image.ImageName)3 JsonArray (com.google.gson.JsonArray)2 File (java.io.File)2 HttpResponseException (org.apache.http.client.HttpResponseException)2 Container (org.eclipse.jkube.kit.build.api.model.Container)2 Map (java.util.Map)1 ContainerDetails (org.eclipse.jkube.kit.build.api.model.ContainerDetails)1 ContainersListElement (org.eclipse.jkube.kit.build.api.model.ContainersListElement)1 Network (org.eclipse.jkube.kit.build.api.model.Network)1 NetworksListElement (org.eclipse.jkube.kit.build.api.model.NetworksListElement)1 BuildOptions (org.eclipse.jkube.kit.build.service.docker.access.BuildOptions)1 CreateImageOptions (org.eclipse.jkube.kit.build.service.docker.access.CreateImageOptions)1 ExitCodeChecker (org.eclipse.jkube.kit.build.service.docker.wait.ExitCodeChecker)1 HealthCheckChecker (org.eclipse.jkube.kit.build.service.docker.wait.HealthCheckChecker)1 LogWaitChecker (org.eclipse.jkube.kit.build.service.docker.wait.LogWaitChecker)1