summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorNalin Dahyabhai <nalin@redhat.com>2019-06-25 14:17:02 -0400
committerNalin Dahyabhai <nalin@redhat.com>2019-06-26 10:43:04 -0400
commit8e79de284865957fffc898b16410a212c1c33fc7 (patch)
tree3fa58bcb503a341374b128628cf0de07aea9234f /test
parent58a1777f518657ff12744bb69ccf2dab3d429625 (diff)
downloadpodman-8e79de284865957fffc898b16410a212c1c33fc7.tar.gz
podman-8e79de284865957fffc898b16410a212c1c33fc7.tar.bz2
podman-8e79de284865957fffc898b16410a212c1c33fc7.zip
Add tests that we don't hit errors with layerless images
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Diffstat (limited to 'test')
-rw-r--r--test/e2e/images_test.go70
1 files changed, 70 insertions, 0 deletions
diff --git a/test/e2e/images_test.go b/test/e2e/images_test.go
index 07d61e885..b6dae33ee 100644
--- a/test/e2e/images_test.go
+++ b/test/e2e/images_test.go
@@ -4,6 +4,7 @@ import (
"fmt"
"os"
"sort"
+ "strings"
. "github.com/containers/libpod/test/utils"
"github.com/docker/go-units"
@@ -318,4 +319,73 @@ LABEL "com.example.vendor"="Example Vendor"
Expect(session.ExitCode()).To(Equal(0))
Expect(len(session.OutputToStringArray())).To(Equal(2))
})
+
+ It("podman with images with no layers", func() {
+ if podmanTest.RemoteTest {
+ Skip("Does not work on remote client")
+ }
+
+ dockerfile := strings.Join([]string{
+ `FROM scratch`,
+ `LABEL org.opencontainers.image.authors="<somefolks@example.org>"`,
+ `LABEL org.opencontainers.image.created=2019-06-11T19:03:37Z`,
+ `LABEL org.opencontainers.image.description="This is a test image"`,
+ `LABEL org.opencontainers.image.title=test`,
+ `LABEL org.opencontainers.image.vendor="Example.org"`,
+ `LABEL org.opencontainers.image.version=1`,
+ }, "\n")
+ podmanTest.BuildImage(dockerfile, "foo", "true")
+
+ session := podmanTest.Podman([]string{"images", "foo"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ 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.ExitCode()).To(Equal(0))
+ output = session.OutputToString()
+ Expect(output).To(MatchRegexp("No Image Layers"))
+
+ session = podmanTest.Podman([]string{"history", "foo"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ output = session.OutputToString()
+ Expect(output).To(Not(MatchRegexp("<missing>")))
+ Expect(output).To(Not(MatchRegexp("error")))
+
+ session = podmanTest.Podman([]string{"history", "--quiet", "foo"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(len(session.OutputToStringArray())).To(Equal(6))
+
+ session = podmanTest.Podman([]string{"image", "list", "foo"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ 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.ExitCode()).To(Equal(0))
+ 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.ExitCode()).To(Equal(0))
+ 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.ExitCode()).To(Equal(0))
+ output = session.OutputToString()
+ Expect(output).To(Equal("[]"))
+ })
})