Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ public class PullResponseItem extends ResponseItem {

private static final String DOWNLOADED_SWARM = ": downloaded";

private static final String ALREADY_EXISTS = "Already exists";

/**
* Returns whether the status indicates a successful pull operation
*
Expand All @@ -34,7 +36,8 @@ public boolean isPullSuccessIndicated() {
getStatus().contains(IMAGE_UP_TO_DATE) ||
getStatus().contains(DOWNLOADED_NEWER_IMAGE) ||
getStatus().contains(LEGACY_REGISTRY) ||
getStatus().contains(DOWNLOADED_SWARM)
getStatus().contains(DOWNLOADED_SWARM) ||
getStatus().contains(ALREADY_EXISTS)
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@
* @author Zach Marshall
*/
public class PullResponseItemTest {
@Test
public void imageAlreadyExists() throws IOException {
PullResponseItem response = testRoundTrip(PullResponseJSONSamples.pullImageResponse_alreadyExists,
PullResponseItem.class);
assertTrue(response.isPullSuccessIndicated());
assertFalse(response.isErrorIndicated());
}

@Test
public void pullNewerImage() throws IOException {
PullResponseItem response = testRoundTrip(PullResponseJSONSamples.pullImageResponse_newerImage,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
* @author Zach Marshall
*/
public enum PullResponseJSONSamples implements JSONResourceRef {
pullImageResponse_legacy, pullImageResponse_error, pullImageResponse_newerImage, pullImageResponse_upToDate;
pullImageResponse_legacy, pullImageResponse_error,
pullImageResponse_newerImage, pullImageResponse_upToDate,
pullImageResponse_alreadyExists;

@Override
public String getFileName() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"status":"Already exists"}