Search in sources :

Example 6 with PushParams

use of org.eclipse.che.plugin.docker.client.params.PushParams in project che by eclipse.

the class DockerConnectorTest method shouldThrowDockerExceptionWhenPushImageButOutputIsEmpty.

@Test(expectedExceptions = DockerException.class, expectedExceptionsMessageRegExp = "Docker image pushing failed. Cause: .*")
public void shouldThrowDockerExceptionWhenPushImageButOutputIsEmpty() throws IOException, InterruptedException {
    PushParams pushParams = PushParams.create(REPOSITORY);
    dockerConnector.push(pushParams, progressMonitor);
}
Also used : PushParams(org.eclipse.che.plugin.docker.client.params.PushParams) Test(org.testng.annotations.Test)

Example 7 with PushParams

use of org.eclipse.che.plugin.docker.client.params.PushParams in project che by eclipse.

the class DockerConnectorTest method shouldThrowDockerExceptionWhenPushImageButDigestOutputMissing.

@Test(expectedExceptions = DockerException.class, expectedExceptionsMessageRegExp = "Docker image pushing failed. Cause: Docker push response doesn't contain image digest")
public void shouldThrowDockerExceptionWhenPushImageButDigestOutputMissing() throws IOException, InterruptedException {
    String dockerPushOutput = "{\"progress\":\"[=====>              ] 25%\"}\n" + "{\"status\":\"Image already exists\"}\n" + "{\"progress\":\"[===============>    ] 75%\"}\n";
    when(dockerResponse.getInputStream()).thenReturn(new ByteArrayInputStream(dockerPushOutput.getBytes()));
    PushParams pushParams = PushParams.create(REPOSITORY);
    dockerConnector.push(pushParams, progressMonitor);
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) PushParams(org.eclipse.che.plugin.docker.client.params.PushParams) Matchers.anyString(org.mockito.Matchers.anyString) Test(org.testng.annotations.Test)

Aggregations

PushParams (org.eclipse.che.plugin.docker.client.params.PushParams)7 Test (org.testng.annotations.Test)6 ByteArrayInputStream (java.io.ByteArrayInputStream)4 URI (java.net.URI)2 AuthConfig (org.eclipse.che.plugin.docker.client.dto.AuthConfig)2 Matchers.anyString (org.mockito.Matchers.anyString)2 IOException (java.io.IOException)1 MachineException (org.eclipse.che.api.machine.server.exception.MachineException)1 ProgressLineFormatterImpl (org.eclipse.che.plugin.docker.client.ProgressLineFormatterImpl)1