Skip to content

Commit

Permalink
Merge 60d0e68 into d89052f
Browse files Browse the repository at this point in the history
  • Loading branch information
alemdomarco committed Aug 17, 2019
2 parents d89052f + 60d0e68 commit 8a93554
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/test/java/com/amihaiemil/docker/RtImagesITCase.java
Expand Up @@ -28,7 +28,11 @@
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Test;

import java.io.File;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

/**
* Integration tests for {@link RtImages}.
Expand Down Expand Up @@ -57,4 +61,34 @@ public void iteratesImages() throws Exception {
);
}
}


/**
* {@link RtImages} can filter Images and return filtered Images.
* @throws Exception If an error occurs.
* @todo #187:30min To have multiple controlled images for filtering and
* not the ubuntu image dependency for this test will be nice to have
* the build Images implemented as described here:
* https://docs.docker.com/engine/api/v1.37/#operation/ImageBuild.
*/
@Test
public void filterImage() throws Exception {
final Map<String, Iterable<String>> filters = new HashMap<>();
filters.put(
"reference",
Arrays.asList(
"ubuntu"
)
);
final Images images = new LocalDocker(
new File("/var/run/docker.sock")
).images();
Images filtered = images.filter(filters);
for(final Image img : filtered) {
MatcherAssert.assertThat(
img.getJsonArray("RepoTags").getString(0),
Matchers.is("ubuntu:latest")
);
}
}
}

0 comments on commit 8a93554

Please sign in to comment.