Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b28b0dc

Browse filesBrowse files
n-geddumelendez
andauthored
Consider already existing images as successful pull (#2335)
Co-authored-by: Eddú Meléndez Gonzales <eddu.melendez@gmail.com>
1 parent f146f96 commit b28b0dc
Copy full SHA for b28b0dc

File tree

4 files changed

+16
-2
lines changed
Filter options

4 files changed

+16
-2
lines changed

‎docker-java-api/src/main/java/com/github/dockerjava/api/model/PullResponseItem.java

Copy file name to clipboardExpand all lines: docker-java-api/src/main/java/com/github/dockerjava/api/model/PullResponseItem.java
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ public class PullResponseItem extends ResponseItem {
1919

2020
private static final String DOWNLOADED_SWARM = ": downloaded";
2121

22+
private static final String ALREADY_EXISTS = "Already exists";
23+
2224
/**
2325
* Returns whether the status indicates a successful pull operation
2426
*
@@ -34,7 +36,8 @@ public boolean isPullSuccessIndicated() {
3436
getStatus().contains(IMAGE_UP_TO_DATE) ||
3537
getStatus().contains(DOWNLOADED_NEWER_IMAGE) ||
3638
getStatus().contains(LEGACY_REGISTRY) ||
37-
getStatus().contains(DOWNLOADED_SWARM)
39+
getStatus().contains(DOWNLOADED_SWARM) ||
40+
getStatus().contains(ALREADY_EXISTS)
3841
);
3942
}
4043
}

‎docker-java/src/test/java/com/github/dockerjava/api/model/PullResponseItemTest.java

Copy file name to clipboardExpand all lines: docker-java/src/test/java/com/github/dockerjava/api/model/PullResponseItemTest.java
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@
2929
* @author Zach Marshall
3030
*/
3131
public class PullResponseItemTest {
32+
@Test
33+
public void imageAlreadyExists() throws IOException {
34+
PullResponseItem response = testRoundTrip(PullResponseJSONSamples.pullImageResponse_alreadyExists,
35+
PullResponseItem.class);
36+
assertTrue(response.isPullSuccessIndicated());
37+
assertFalse(response.isErrorIndicated());
38+
}
39+
3240
@Test
3341
public void pullNewerImage() throws IOException {
3442
PullResponseItem response = testRoundTrip(PullResponseJSONSamples.pullImageResponse_newerImage,

‎docker-java/src/test/java/com/github/dockerjava/api/model/PullResponseJSONSamples.java

Copy file name to clipboardExpand all lines: docker-java/src/test/java/com/github/dockerjava/api/model/PullResponseJSONSamples.java
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@
2323
* @author Zach Marshall
2424
*/
2525
public enum PullResponseJSONSamples implements JSONResourceRef {
26-
pullImageResponse_legacy, pullImageResponse_error, pullImageResponse_newerImage, pullImageResponse_upToDate;
26+
pullImageResponse_legacy, pullImageResponse_error,
27+
pullImageResponse_newerImage, pullImageResponse_upToDate,
28+
pullImageResponse_alreadyExists;
2729

2830
@Override
2931
public String getFileName() {
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"status":"Already exists"}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.