mirror of
https://github.com/containers/podman.git
synced 2025-10-18 19:53:58 +08:00
e2e: more ExitCleanly(): dumb string replacements
Ongoing steps toward RUN-1907: replace Exit(0) with ExitCleanly() Commit 1 of 2: simple automated string-replace, plus fixes to includes. Signed-off-by: Ed Santiago <santiago@redhat.com>
This commit is contained in:
@ -17,7 +17,7 @@ var _ = Describe("Podman images", func() {
|
||||
It("podman images", func() {
|
||||
session := podmanTest.Podman([]string{"images"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
Expect(len(session.OutputToStringArray())).To(BeNumerically(">", 2))
|
||||
Expect(session.OutputToStringArray()).To(ContainElement(HavePrefix("quay.io/libpod/alpine")))
|
||||
Expect(session.OutputToStringArray()).To(ContainElement(HavePrefix("quay.io/libpod/busybox")))
|
||||
@ -26,7 +26,7 @@ var _ = Describe("Podman images", func() {
|
||||
It("podman image List", func() {
|
||||
session := podmanTest.Podman([]string{"image", "list"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
Expect(len(session.OutputToStringArray())).To(BeNumerically(">", 2))
|
||||
Expect(session.OutputToStringArray()).To(ContainElement(HavePrefix("quay.io/libpod/alpine")))
|
||||
Expect(session.OutputToStringArray()).To(ContainElement(HavePrefix("quay.io/libpod/busybox")))
|
||||
@ -37,15 +37,15 @@ var _ = Describe("Podman images", func() {
|
||||
podmanTest.AddImageToRWStore(ALPINE)
|
||||
session := podmanTest.Podman([]string{"tag", ALPINE, "foo:a", "foo:b", "foo:c"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
// tag "foo:c" to "bar:{a,b}"
|
||||
session = podmanTest.Podman([]string{"tag", "foo:c", "bar:a", "bar:b"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
// check all previous and the newly tagged images
|
||||
session = podmanTest.Podman([]string{"images"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
Expect(session.LineInOutputContainsTag("quay.io/libpod/alpine", "latest")).To(BeTrue())
|
||||
Expect(session.LineInOutputContainsTag("quay.io/libpod/busybox", "latest")).To(BeTrue())
|
||||
Expect(session.LineInOutputContainsTag("localhost/foo", "a")).To(BeTrue())
|
||||
@ -55,14 +55,14 @@ var _ = Describe("Podman images", func() {
|
||||
Expect(session.LineInOutputContainsTag("localhost/bar", "b")).To(BeTrue())
|
||||
session = podmanTest.Podman([]string{"images", "-qn"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
Expect(session.OutputToStringArray()).To(HaveLen(len(CACHE_IMAGES)))
|
||||
})
|
||||
|
||||
It("podman images with digests", func() {
|
||||
session := podmanTest.Podman([]string{"images", "--digests"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
Expect(len(session.OutputToStringArray())).To(BeNumerically(">", 2))
|
||||
Expect(session.OutputToStringArray()).To(ContainElement(HavePrefix("quay.io/libpod/alpine")))
|
||||
Expect(session.OutputToStringArray()).To(ContainElement(HavePrefix("quay.io/libpod/busybox")))
|
||||
@ -71,14 +71,14 @@ var _ = Describe("Podman images", func() {
|
||||
It("podman empty images list in JSON format", func() {
|
||||
session := podmanTest.Podman([]string{"images", "--format=json", "not-existing-image"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
Expect(session.OutputToString()).To(BeValidJSON())
|
||||
})
|
||||
|
||||
It("podman images in JSON format", func() {
|
||||
session := podmanTest.Podman([]string{"images", "--format=json"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
Expect(session.OutputToString()).To(BeValidJSON())
|
||||
})
|
||||
|
||||
@ -86,13 +86,13 @@ var _ = Describe("Podman images", func() {
|
||||
formatStr := "{{.ID}}\t{{.Created}}\t{{.CreatedAt}}\t{{.CreatedSince}}\t{{.CreatedTime}}"
|
||||
session := podmanTest.Podman([]string{"images", fmt.Sprintf("--format=%s", formatStr)})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
})
|
||||
|
||||
It("podman images with short options", func() {
|
||||
session := podmanTest.Podman([]string{"images", "-qn"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
Expect(len(session.OutputToStringArray())).To(BeNumerically(">", 1))
|
||||
})
|
||||
|
||||
@ -102,43 +102,43 @@ var _ = Describe("Podman images", func() {
|
||||
|
||||
session := podmanTest.Podman([]string{"images", "-q", ALPINE})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
Expect(session.OutputToStringArray()).To(HaveLen(1))
|
||||
|
||||
session = podmanTest.Podman([]string{"tag", ALPINE, "foo:a"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
session = podmanTest.Podman([]string{"tag", BB, "foo:b"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
session = podmanTest.Podman([]string{"images", "-q", "foo"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
Expect(session.OutputToStringArray()).To(HaveLen(2))
|
||||
})
|
||||
|
||||
It("podman images filter reference", func() {
|
||||
result := podmanTest.Podman([]string{"images", "-q", "-f", "reference=quay.io/libpod/*"})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(result).Should(ExitCleanly())
|
||||
Expect(result.OutputToStringArray()).To(HaveLen(8))
|
||||
|
||||
retalpine := podmanTest.Podman([]string{"images", "-f", "reference=*lpine*"})
|
||||
retalpine.WaitWithDefaultTimeout()
|
||||
Expect(retalpine).Should(Exit(0))
|
||||
Expect(retalpine).Should(ExitCleanly())
|
||||
Expect(retalpine.OutputToStringArray()).To(HaveLen(5))
|
||||
Expect(retalpine.OutputToString()).To(ContainSubstring("alpine"))
|
||||
|
||||
retalpine = podmanTest.Podman([]string{"images", "-f", "reference=alpine"})
|
||||
retalpine.WaitWithDefaultTimeout()
|
||||
Expect(retalpine).Should(Exit(0))
|
||||
Expect(retalpine).Should(ExitCleanly())
|
||||
Expect(retalpine.OutputToStringArray()).To(HaveLen(2))
|
||||
Expect(retalpine.OutputToString()).To(ContainSubstring("alpine"))
|
||||
|
||||
retnone := podmanTest.Podman([]string{"images", "-q", "-f", "reference=bogus"})
|
||||
retnone.WaitWithDefaultTimeout()
|
||||
Expect(retnone).Should(Exit(0))
|
||||
Expect(retnone).Should(ExitCleanly())
|
||||
Expect(retnone.OutputToStringArray()).To(BeEmpty())
|
||||
})
|
||||
|
||||
@ -149,7 +149,7 @@ RUN echo hello > /hello
|
||||
podmanTest.BuildImage(dockerfile, "foobar.com/before:latest", "false")
|
||||
result := podmanTest.Podman([]string{"images", "-q", "-f", "before=foobar.com/before:latest"})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(result).Should(ExitCleanly())
|
||||
Expect(result.OutputToStringArray()).ToNot(BeEmpty())
|
||||
})
|
||||
|
||||
@ -160,7 +160,7 @@ WORKDIR /test
|
||||
podmanTest.BuildImage(dockerfile, "foobar.com/workdir:latest", "false")
|
||||
result := podmanTest.Podman([]string{"run", "foobar.com/workdir:latest", "pwd"})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(result).Should(ExitCleanly())
|
||||
Expect(result.OutputToString()).To(Equal("/test"))
|
||||
})
|
||||
|
||||
@ -174,13 +174,13 @@ WORKDIR /test
|
||||
// `since` filter
|
||||
result := podmanTest.PodmanNoCache([]string{"images", "-q", "-f", "since=foobar.com/one:latest"})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(result).Should(ExitCleanly())
|
||||
Expect(result.OutputToStringArray()).To(HaveLen(2))
|
||||
|
||||
// `after` filter
|
||||
result = podmanTest.Podman([]string{"image", "list", "-q", "-f", "after=foobar.com/one:latest"})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(result).Should(ExitCleanly())
|
||||
Expect(result.OutputToStringArray()).Should(HaveLen(2), "list filter output: %q", result.OutputToString())
|
||||
})
|
||||
|
||||
@ -201,11 +201,11 @@ WORKDIR /test
|
||||
digestPullAndList := func(noneTag bool) {
|
||||
session := podmanTest.Podman([]string{"pull", ALPINEAMD64DIGEST})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
result := podmanTest.Podman([]string{"images", "--all", ALPINEAMD64DIGEST})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(result).Should(ExitCleanly())
|
||||
|
||||
if noneTag {
|
||||
Expect(result.OutputToString()).To(ContainSubstring("<none>"))
|
||||
@ -219,14 +219,14 @@ WORKDIR /test
|
||||
// attached to it.
|
||||
session := podmanTest.Podman([]string{"pull", ALPINELISTTAG})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
digestPullAndList(false)
|
||||
|
||||
// Now remove all names from the read-write image record, re-pull by digest and
|
||||
// check for the "<none>" in its listing.
|
||||
session = podmanTest.Podman([]string{"untag", ALPINELISTTAG})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
digestPullAndList(true)
|
||||
})
|
||||
@ -234,25 +234,25 @@ WORKDIR /test
|
||||
It("podman check for image with sha256: prefix", func() {
|
||||
session := podmanTest.Podman([]string{"inspect", "--format=json", ALPINE})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
Expect(session.OutputToString()).To(BeValidJSON())
|
||||
imageData := session.InspectImageJSON()
|
||||
|
||||
result := podmanTest.Podman([]string{"images", "sha256:" + imageData[0].ID})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(result).Should(ExitCleanly())
|
||||
})
|
||||
|
||||
It("podman check for image with sha256: prefix", func() {
|
||||
session := podmanTest.Podman([]string{"image", "inspect", "--format=json", ALPINE})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
Expect(session.OutputToString()).To(BeValidJSON())
|
||||
imageData := session.InspectImageJSON()
|
||||
|
||||
result := podmanTest.Podman([]string{"image", "ls", fmt.Sprintf("sha256:%s", imageData[0].ID)})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(result).Should(ExitCleanly())
|
||||
})
|
||||
|
||||
It("podman images sort by values", func() {
|
||||
@ -307,12 +307,12 @@ ENV foo=bar
|
||||
podmanTest.BuildImage(dockerfile, "test", "true")
|
||||
session := podmanTest.Podman([]string{"images"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
Expect(session.OutputToStringArray()).To(HaveLen(len(CACHE_IMAGES) + 2))
|
||||
|
||||
session2 := podmanTest.Podman([]string{"images", "--all"})
|
||||
session2.WaitWithDefaultTimeout()
|
||||
Expect(session2).Should(Exit(0))
|
||||
Expect(session2).Should(ExitCleanly())
|
||||
Expect(session2.OutputToStringArray()).To(HaveLen(len(CACHE_IMAGES) + 4))
|
||||
})
|
||||
|
||||
@ -324,7 +324,7 @@ LABEL "com.example.vendor"="Example Vendor"
|
||||
podmanTest.BuildImage(dockerfile, "test", "true")
|
||||
session := podmanTest.Podman([]string{"images", "-f", "label=version=1.0"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
Expect(session.OutputToStringArray()).To(HaveLen(2))
|
||||
})
|
||||
|
||||
@ -342,52 +342,52 @@ LABEL "com.example.vendor"="Example Vendor"
|
||||
|
||||
session := podmanTest.Podman([]string{"images", "foo"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
output := session.OutputToString()
|
||||
Expect(output).To(Not(MatchRegexp("<missing>")))
|
||||
Expect(output).To(Not(MatchRegexp("error")))
|
||||
|
||||
session = podmanTest.Podman([]string{"image", "tree", "foo"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
output = session.OutputToString()
|
||||
Expect(output).To(MatchRegexp("No Image Layers"))
|
||||
|
||||
session = podmanTest.Podman([]string{"history", "foo"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
output = session.OutputToString()
|
||||
Expect(output).To(Not(MatchRegexp("error")))
|
||||
|
||||
session = podmanTest.Podman([]string{"history", "--quiet", "foo"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
Expect(session.OutputToStringArray()).To(HaveLen(6))
|
||||
|
||||
session = podmanTest.Podman([]string{"image", "list", "foo"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
output = session.OutputToString()
|
||||
Expect(output).To(Not(MatchRegexp("<missing>")))
|
||||
Expect(output).To(Not(MatchRegexp("error")))
|
||||
|
||||
session = podmanTest.Podman([]string{"image", "list"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
output = session.OutputToString()
|
||||
Expect(output).To(Not(MatchRegexp("<missing>")))
|
||||
Expect(output).To(Not(MatchRegexp("error")))
|
||||
|
||||
session = podmanTest.Podman([]string{"inspect", "foo"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
output = session.OutputToString()
|
||||
Expect(output).To(Not(MatchRegexp("<missing>")))
|
||||
Expect(output).To(Not(MatchRegexp("error")))
|
||||
|
||||
session = podmanTest.Podman([]string{"inspect", "--format", "{{.RootFS.Layers}}", "foo"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
output = session.OutputToString()
|
||||
Expect(output).To(Equal("[]"))
|
||||
})
|
||||
@ -398,7 +398,7 @@ LABEL "com.example.vendor"="Example Vendor"
|
||||
podmanTest.BuildImageWithLabel(dockerfile, "foobar.com/before:latest", "false", "test=with,comma")
|
||||
result := podmanTest.Podman([]string{"images", "--filter", "label=test=with,comma"})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(result).Should(ExitCleanly())
|
||||
Expect(result.OutputToStringArray()).To(HaveLen(2))
|
||||
})
|
||||
|
||||
@ -408,11 +408,11 @@ LABEL "com.example.vendor"="Example Vendor"
|
||||
podmanTest.BuildImage(dockerfile, "foobar.com/before:latest", "false")
|
||||
result := podmanTest.Podman([]string{"images", "-f", "readonly=true"})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(result).Should(ExitCleanly())
|
||||
|
||||
result1 := podmanTest.Podman([]string{"images", "--filter", "readonly=false"})
|
||||
result1.WaitWithDefaultTimeout()
|
||||
Expect(result1).Should(Exit(0))
|
||||
Expect(result1).Should(ExitCleanly())
|
||||
Expect(result.OutputToStringArray()).To(Not(Equal(result1.OutputToStringArray())))
|
||||
})
|
||||
|
||||
@ -428,7 +428,7 @@ RUN > file2
|
||||
// --force used to avoid y/n question
|
||||
result := podmanTest.Podman([]string{"image", "prune", "--filter", "label=abc", "--force"})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(result).Should(ExitCleanly())
|
||||
Expect(result.OutputToStringArray()).To(HaveLen(1))
|
||||
|
||||
// check if really abc is removed
|
||||
@ -449,7 +449,7 @@ RUN > file2
|
||||
// --force used to to avoid y/n question
|
||||
result := podmanTest.Podman([]string{"builder", "prune", "--filter", "label=abc", "--force"})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(result).Should(ExitCleanly())
|
||||
Expect(result.OutputToStringArray()).To(HaveLen(1))
|
||||
|
||||
// check if really abc is removed
|
||||
|
Reference in New Issue
Block a user