diff options
author | Brent Baude <bbaude@redhat.com> | 2020-02-22 12:44:35 -0600 |
---|---|---|
committer | Brent Baude <bbaude@redhat.com> | 2020-02-23 11:01:21 -0600 |
commit | d92b9b88595b030245d5d74b096ce605b5ae2db7 (patch) | |
tree | e27164ccfa2248682e5338e5535a9dee0ee2d7b6 /pkg/bindings | |
parent | 9fd01e19458bd8c8281663bdb504f02aa3a92e3b (diff) | |
download | podman-d92b9b88595b030245d5d74b096ce605b5ae2db7.tar.gz podman-d92b9b88595b030245d5d74b096ce605b5ae2db7.tar.bz2 podman-d92b9b88595b030245d5d74b096ce605b5ae2db7.zip |
more image binding tests
add two additional bindings tests for image usage.
add ability to use search filter on the endpoint.
Signed-off-by: Brent Baude <bbaude@redhat.com>
Diffstat (limited to 'pkg/bindings')
-rw-r--r-- | pkg/bindings/test/images_test.go | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/pkg/bindings/test/images_test.go b/pkg/bindings/test/images_test.go index c51ce4a32..8eef28502 100644 --- a/pkg/bindings/test/images_test.go +++ b/pkg/bindings/test/images_test.go @@ -292,5 +292,58 @@ var _ = Describe("Podman images", func() { Expect(data.Comment).To(Equal(testMessage)) }) + It("History Image", func() { + // a bogus name should return a 404 + _, err := images.History(connText, "foobar") + Expect(err).To(Not(BeNil())) + code, _ := bindings.CheckResponseCode(err) + Expect(code).To(BeNumerically("==", http.StatusNotFound)) + + var foundID bool + data, err := images.GetImage(connText, alpine.name, nil) + Expect(err).To(BeNil()) + history, err := images.History(connText, alpine.name) + Expect(err).To(BeNil()) + for _, i := range history { + if i.ID == data.ID { + foundID = true + break + } + } + Expect(foundID).To(BeTrue()) + }) + + It("Search for an image", func() { + imgs, err := images.Search(connText, "alpine", nil, nil) + Expect(err).To(BeNil()) + Expect(len(imgs)).To(BeNumerically(">", 1)) + var foundAlpine bool + for _, i := range imgs { + if i.Name == "docker.io/library/alpine" { + foundAlpine = true + break + } + } + Expect(foundAlpine).To(BeTrue()) + + // Search for alpine with a limit of 10 + ten := 10 + imgs, err = images.Search(connText, "docker.io/alpine", &ten, nil) + Expect(err).To(BeNil()) + Expect(len(imgs)).To(BeNumerically("<=", 10)) + + // Search for alpine with stars greater than 100 + filters := make(map[string][]string) + filters["stars"] = []string{"100"} + imgs, err = images.Search(connText, "docker.io/alpine", nil, filters) + Expect(err).To(BeNil()) + for _, i := range imgs { + Expect(i.Stars).To(BeNumerically(">=", 100)) + } + + // Search with a fqdn + imgs, err = images.Search(connText, "quay.io/libpod/alpine_nginx", nil, nil) + Expect(len(imgs)).To(BeNumerically(">=", 1)) + }) }) |