use of org.eclipse.che.plugin.docker.client.params.TagParams 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());
}
use of org.eclipse.che.plugin.docker.client.params.TagParams in project che by eclipse.
the class DockerConnectorTest method shouldBeAbleToTagImage.
@Test
public void shouldBeAbleToTagImage() throws IOException {
TagParams tagParams = TagParams.create(IMAGE, REPOSITORY);
dockerConnector.tag(tagParams);
verify(dockerConnectionFactory).openConnection(any(URI.class));
verify(dockerConnection).method(REQUEST_METHOD_POST);
verify(dockerConnection).path("/images/" + tagParams.getImage() + "/tag");
verify(dockerConnection).query("repo", tagParams.getRepository());
verify(dockerConnection).request();
verify(dockerResponse).getStatus();
}
use of org.eclipse.che.plugin.docker.client.params.TagParams in project che by eclipse.
the class DockerConnectorTest method shouldThrowDockerExceptionWhileTaggingImageIfResponseCodeIsNotSuccess.
@Test(expectedExceptions = DockerException.class, expectedExceptionsMessageRegExp = EXCEPTION_ERROR_MESSAGE)
public void shouldThrowDockerExceptionWhileTaggingImageIfResponseCodeIsNotSuccess() throws IOException {
TagParams tagParams = TagParams.create(IMAGE, REPOSITORY);
when(dockerResponse.getStatus()).thenReturn(RESPONSE_ERROR_CODE);
dockerConnector.tag(tagParams);
verify(dockerResponse).getStatus();
}
Aggregations