use of com.spotify.docker.client.messages.RemovedImage in project docker-client by spotify.
the class DefaultDockerClientTest method testTag.
@Test
public void testTag() throws Exception {
sut.pull(BUSYBOX_LATEST);
// Tag image
final String newImageName = "test-repo:testTag";
sut.tag(BUSYBOX, newImageName);
// Verify tag was successful by trying to remove it.
final RemovedImage removedImage = getOnlyElement(sut.removeImage(newImageName));
assertThat(removedImage, equalTo(RemovedImage.create(UNTAGGED, newImageName)));
}
use of com.spotify.docker.client.messages.RemovedImage in project docker-client by spotify.
the class DefaultDockerClientTest method testRemoveImage.
@Test
public void testRemoveImage() throws Exception {
// Don't remove images on CircleCI. Their version of Docker causes failures when pulling an
// image that shares layers with an image that has been removed. This causes tests after this
// one to fail.
assumeFalse(CIRCLECI);
sut.pull("dxia/cirros:latest");
sut.pull("dxia/cirros:0.3.0");
final String imageLatest = "dxia/cirros:latest";
final String imageVersion = "dxia/cirros:0.3.0";
final Set<RemovedImage> removedImages = Sets.newHashSet();
removedImages.addAll(sut.removeImage(imageLatest));
removedImages.addAll(sut.removeImage(imageVersion));
assertThat(removedImages, hasItems(RemovedImage.create(UNTAGGED, imageLatest), RemovedImage.create(UNTAGGED, imageVersion)));
// Try to inspect deleted image and make sure ImageNotFoundException is thrown
try {
sut.inspectImage(imageLatest);
fail("inspectImage should have thrown ImageNotFoundException");
} catch (ImageNotFoundException e) {
// we should get exception because we deleted image
}
}
use of com.spotify.docker.client.messages.RemovedImage in project docker-client by spotify.
the class DefaultDockerClientTest method testTagForce.
@Test
public void testTagForce() throws Exception {
sut.pull(BUSYBOX_LATEST);
sut.pull(BUSYBOX_BUILDROOT_2013_08_1);
final String name = "test-repo/tag-force:sometag";
// Assign name to first image
sut.tag(BUSYBOX_LATEST, name);
// Force-re-assign tag to another image
sut.tag(BUSYBOX_BUILDROOT_2013_08_1, name, true);
// Verify that re-tagging was successful
final RemovedImage removedImage = getOnlyElement(sut.removeImage(name));
assertThat(removedImage, is(RemovedImage.create(UNTAGGED, name)));
}
Aggregations