use of org.eclipse.che.plugin.docker.client.params.RemoveImageParams in project che by eclipse.
the class DockerConnectorTest method shouldThrowDockerExceptionWhileRemovingImageIfResponseCodeIsNotSuccess.
@Test(expectedExceptions = DockerException.class, expectedExceptionsMessageRegExp = EXCEPTION_ERROR_MESSAGE)
public void shouldThrowDockerExceptionWhileRemovingImageIfResponseCodeIsNotSuccess() throws IOException {
RemoveImageParams removeImageParams = RemoveImageParams.create(IMAGE);
when(dockerResponse.getStatus()).thenReturn(RESPONSE_ERROR_CODE);
dockerConnector.removeImage(removeImageParams);
verify(dockerResponse).getStatus();
}
use of org.eclipse.che.plugin.docker.client.params.RemoveImageParams in project che by eclipse.
the class DockerConnectorTest method shouldCallRemoveImageWithParametersObject.
@Test
public void shouldCallRemoveImageWithParametersObject() throws IOException {
RemoveImageParams removeImageParams = RemoveImageParams.create(IMAGE);
doNothing().when(dockerConnector).removeImage(removeImageParams);
dockerConnector.removeImage(IMAGE);
verify(dockerConnector).removeImage((RemoveImageParams) captor.capture());
assertEquals(captor.getValue(), removeImageParams);
}
use of org.eclipse.che.plugin.docker.client.params.RemoveImageParams in project che by eclipse.
the class DockerConnectorTest method shouldBeAbleToRemoveImage.
@Test
public void shouldBeAbleToRemoveImage() throws IOException {
RemoveImageParams removeImageParams = RemoveImageParams.create(IMAGE);
dockerConnector.removeImage(removeImageParams);
verify(dockerConnectionFactory).openConnection(any(URI.class));
verify(dockerConnection).method(REQUEST_METHOD_DELETE);
verify(dockerConnection).path("/images/" + removeImageParams.getImage());
verify(dockerConnection).request();
verify(dockerResponse).getStatus();
}
use of org.eclipse.che.plugin.docker.client.params.RemoveImageParams in project che by eclipse.
the class MachineProviderImplTest method shouldReTagBuiltImageWithPredictableOnInstanceCreationFromRecipe.
@Test
public void shouldReTagBuiltImageWithPredictableOnInstanceCreationFromRecipe() throws Exception {
// given
String repo = MACHINE_SNAPSHOT_PREFIX + "repo1";
String tag = "tag1";
String registry = "registry1";
// when
CheServiceImpl machine = createInstanceFromSnapshot(repo, tag, registry);
// then
TagParams tagParams = TagParams.create(registry + "/" + repo + ":" + tag, "eclipse-che/" + machine.getContainerName());
verify(dockerConnector).tag(eq(tagParams));
ArgumentCaptor<RemoveImageParams> argumentCaptor = ArgumentCaptor.forClass(RemoveImageParams.class);
verify(dockerConnector).removeImage(argumentCaptor.capture());
RemoveImageParams imageParams = argumentCaptor.getValue();
assertEquals(imageParams.getImage(), registry + "/" + repo + ":" + tag);
assertFalse(imageParams.isForce());
}
Aggregations