Skip to content

Commit 5cbbbfd

Browse files
committed
Merge branch '__rultor'
2 parents 43e9b7f + 60d0e68 commit 5cbbbfd

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

src/test/java/com/amihaiemil/docker/RtImagesITCase.java

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@
2828
import org.hamcrest.MatcherAssert;
2929
import org.hamcrest.Matchers;
3030
import org.junit.Test;
31+
3132
import java.io.File;
33+
import java.util.Arrays;
34+
import java.util.HashMap;
35+
import java.util.Map;
3236

3337
/**
3438
* Integration tests for {@link RtImages}.
@@ -57,4 +61,34 @@ public void iteratesImages() throws Exception {
5761
);
5862
}
5963
}
64+
65+
66+
/**
67+
* {@link RtImages} can filter Images and return filtered Images.
68+
* @throws Exception If an error occurs.
69+
* @todo #187:30min To have multiple controlled images for filtering and
70+
* not the ubuntu image dependency for this test will be nice to have
71+
* the build Images implemented as described here:
72+
* https://docs.docker.com/engine/api/v1.37/#operation/ImageBuild.
73+
*/
74+
@Test
75+
public void filterImage() throws Exception {
76+
final Map<String, Iterable<String>> filters = new HashMap<>();
77+
filters.put(
78+
"reference",
79+
Arrays.asList(
80+
"ubuntu"
81+
)
82+
);
83+
final Images images = new LocalDocker(
84+
new File("/var/run/docker.sock")
85+
).images();
86+
Images filtered = images.filter(filters);
87+
for(final Image img : filtered) {
88+
MatcherAssert.assertThat(
89+
img.getJsonArray("RepoTags").getString(0),
90+
Matchers.is("ubuntu:latest")
91+
);
92+
}
93+
}
6094
}

0 commit comments

Comments
 (0)