mirror of
https://github.com/containers/podman.git
synced 2025-11-29 17:48:05 +08:00
e2e: ExitCleanly(): low-hanging fruit, part 1
Continuing work on RUN-1907: huge set of files, but not as intimidating as it looks. Commit 1 of 2: mindless replace of Exit(0) with ExitCleanly() Signed-off-by: Ed Santiago <santiago@redhat.com>
This commit is contained in:
@@ -23,7 +23,7 @@ var _ = Describe("Podman rmi", func() {
|
||||
podmanTest.AddImageToRWStore(ALPINE)
|
||||
session := podmanTest.Podman([]string{"rmi", ALPINE})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
})
|
||||
|
||||
@@ -31,7 +31,7 @@ var _ = Describe("Podman rmi", func() {
|
||||
podmanTest.AddImageToRWStore(CIRROS_IMAGE)
|
||||
session := podmanTest.Podman([]string{"rmi", "cirros"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
})
|
||||
|
||||
@@ -41,7 +41,7 @@ var _ = Describe("Podman rmi", func() {
|
||||
session.WaitWithDefaultTimeout()
|
||||
images := podmanTest.Podman([]string{"images"})
|
||||
images.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
})
|
||||
|
||||
@@ -49,7 +49,7 @@ var _ = Describe("Podman rmi", func() {
|
||||
podmanTest.AddImageToRWStore(NGINX_IMAGE)
|
||||
session := podmanTest.Podman([]string{"rmi", "-fa"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
})
|
||||
|
||||
@@ -57,15 +57,15 @@ var _ = Describe("Podman rmi", func() {
|
||||
podmanTest.AddImageToRWStore(CIRROS_IMAGE)
|
||||
setup := podmanTest.Podman([]string{"images", "-q", CIRROS_IMAGE})
|
||||
setup.WaitWithDefaultTimeout()
|
||||
Expect(setup).Should(Exit(0))
|
||||
Expect(setup).Should(ExitCleanly())
|
||||
|
||||
session := podmanTest.Podman([]string{"tag", CIRROS_IMAGE, "foo:bar", "foo"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
result := podmanTest.Podman([]string{"images", "-q", "foo"})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(result).Should(ExitCleanly())
|
||||
|
||||
Expect(result.OutputToString()).To(ContainSubstring(setup.OutputToString()))
|
||||
})
|
||||
@@ -74,12 +74,12 @@ var _ = Describe("Podman rmi", func() {
|
||||
podmanTest.AddImageToRWStore(CIRROS_IMAGE)
|
||||
setup := podmanTest.Podman([]string{"images", "-q", CIRROS_IMAGE})
|
||||
setup.WaitWithDefaultTimeout()
|
||||
Expect(setup).Should(Exit(0))
|
||||
Expect(setup).Should(ExitCleanly())
|
||||
cirrosID := setup.OutputToString()
|
||||
|
||||
session := podmanTest.Podman([]string{"tag", "cirros", "foo:bar", "foo"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
// Trying without --force should fail
|
||||
result := podmanTest.Podman([]string{"rmi", cirrosID})
|
||||
@@ -89,7 +89,7 @@ var _ = Describe("Podman rmi", func() {
|
||||
// With --force it should work
|
||||
resultForce := podmanTest.Podman([]string{"rmi", "-f", cirrosID})
|
||||
resultForce.WaitWithDefaultTimeout()
|
||||
Expect(resultForce).Should(Exit(0))
|
||||
Expect(resultForce).Should(ExitCleanly())
|
||||
})
|
||||
|
||||
It("podman rmi image that is a parent of another image", func() {
|
||||
@@ -97,28 +97,28 @@ var _ = Describe("Podman rmi", func() {
|
||||
podmanTest.AddImageToRWStore(CIRROS_IMAGE)
|
||||
session := podmanTest.Podman([]string{"run", "--name", "c_test", CIRROS_IMAGE, "true"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
session = podmanTest.Podman([]string{"commit", "-q", "c_test", "test"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
session = podmanTest.Podman([]string{"rm", "c_test"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
session = podmanTest.Podman([]string{"rmi", CIRROS_IMAGE})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
session = podmanTest.Podman([]string{"images", "-q"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
Expect(session.OutputToStringArray()).To(HaveLen(12))
|
||||
|
||||
session = podmanTest.Podman([]string{"images", "--sort", "created", "--format", "{{.Id}}", "--all"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
Expect(session.OutputToStringArray()).To(HaveLen(13),
|
||||
"Output from 'podman images -q -a'")
|
||||
untaggedImg := session.OutputToStringArray()[1]
|
||||
@@ -132,31 +132,31 @@ var _ = Describe("Podman rmi", func() {
|
||||
podmanTest.AddImageToRWStore(ALPINE)
|
||||
session := podmanTest.Podman([]string{"create", "--name", "c_test1", ALPINE, "true"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
session = podmanTest.Podman([]string{"commit", "-q", "c_test1", "test1"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
session = podmanTest.Podman([]string{"create", "--name", "c_test2", "test1", "true"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
session = podmanTest.Podman([]string{"commit", "-q", "c_test2", "test2"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
session = podmanTest.Podman([]string{"rm", "-a"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
session = podmanTest.Podman([]string{"rmi", "test2"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
session = podmanTest.Podman([]string{"images", "-q"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
Expect(session.OutputToStringArray()).To(HaveLen(len(CACHE_IMAGES) + 1))
|
||||
})
|
||||
|
||||
@@ -180,51 +180,51 @@ var _ = Describe("Podman rmi", func() {
|
||||
|
||||
session := podmanTest.Podman([]string{"images", "-q", "-a"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
numOfImages := len(session.OutputToStringArray())
|
||||
|
||||
session = podmanTest.Podman([]string{"rmi", "test2"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
session = podmanTest.Podman([]string{"images", "-q", "-a"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
Expect(numOfImages - len(session.OutputToStringArray())).To(Equal(2))
|
||||
|
||||
session = podmanTest.Podman([]string{"rmi", "test"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
session = podmanTest.Podman([]string{"images", "-q", "-a"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
Expect(session.OutputToStringArray()).To(HaveLen(len(CACHE_IMAGES) + 1))
|
||||
|
||||
podmanTest.BuildImage(dockerfile, "test3", "true")
|
||||
|
||||
session = podmanTest.Podman([]string{"rmi", CIRROS_IMAGE})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
session = podmanTest.Podman([]string{"rmi", "test3"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
session = podmanTest.Podman([]string{"images", "-q", "-a"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
Expect(session.OutputToString()).To(HaveLen(142))
|
||||
})
|
||||
|
||||
It("podman rmi -a with no images should be exit 0", func() {
|
||||
session := podmanTest.Podman([]string{"rmi", "-fa"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
session2 := podmanTest.Podman([]string{"rmi", "-fa"})
|
||||
session2.WaitWithDefaultTimeout()
|
||||
Expect(session2).Should(Exit(0))
|
||||
Expect(session2).Should(ExitCleanly())
|
||||
})
|
||||
|
||||
It("podman rmi -a with parent|child images", func() {
|
||||
@@ -240,11 +240,11 @@ RUN find $LOCAL
|
||||
podmanTest.BuildImage(dockerfile, "test", "true")
|
||||
session := podmanTest.Podman([]string{"rmi", "-a"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
images := podmanTest.Podman([]string{"images", "-aq"})
|
||||
images.WaitWithDefaultTimeout()
|
||||
Expect(images).Should(Exit(0))
|
||||
Expect(images).Should(ExitCleanly())
|
||||
Expect(images.OutputToStringArray()).To(HaveLen(len(CACHE_IMAGES)))
|
||||
})
|
||||
|
||||
@@ -291,7 +291,7 @@ RUN find $LOCAL
|
||||
imageName := fmt.Sprintf("rmtest:%d", i)
|
||||
session := podmanTest.Podman([]string{"rmi", "-f", imageName})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
}(i)
|
||||
}
|
||||
wg.Wait()
|
||||
@@ -301,41 +301,41 @@ RUN find $LOCAL
|
||||
podmanTest.AddImageToRWStore(ALPINE)
|
||||
session := podmanTest.Podman([]string{"create", "--name", "c_test1", ALPINE, "true"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
session = podmanTest.Podman([]string{"commit", "-q", "c_test1", "test1"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
session = podmanTest.Podman([]string{"create", "--name", "c_test2", "test1", "true"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
session = podmanTest.Podman([]string{"commit", "-q", "c_test2", "test2"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
imageID2 := session.OutputToString()
|
||||
|
||||
session = podmanTest.Podman([]string{"create", "--name", "c_test3", "test2", "true"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
session = podmanTest.Podman([]string{"commit", "-q", "c_test3", "test3"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
imageID3 := session.OutputToString()
|
||||
|
||||
session = podmanTest.Podman([]string{"untag", "test2"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
session = podmanTest.Podman([]string{"untag", "test1"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
session = podmanTest.Podman([]string{"rmi", "-f", "--no-prune", "test3"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
Expect(session.OutputToString()).To(ContainSubstring(imageID3))
|
||||
Expect(session.OutputToString()).NotTo(ContainSubstring(imageID2))
|
||||
})
|
||||
@@ -344,33 +344,33 @@ RUN find $LOCAL
|
||||
podmanTest.AddImageToRWStore(ALPINE)
|
||||
session := podmanTest.Podman([]string{"create", "--name", "c_test1", ALPINE, "true"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
session = podmanTest.Podman([]string{"commit", "-q", "c_test1", "test1"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
session = podmanTest.Podman([]string{"create", "--name", "c_test2", "test1", "true"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
session = podmanTest.Podman([]string{"commit", "-q", "c_test2", "test2"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
imageID2 := session.OutputToString()
|
||||
|
||||
session = podmanTest.Podman([]string{"create", "--name", "c_test3", "test2", "true"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
session = podmanTest.Podman([]string{"commit", "-q", "c_test3", "test3"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
imageID3 := session.OutputToString()
|
||||
|
||||
session = podmanTest.Podman([]string{"rmi", "-f", "--no-prune", "test3"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
Expect(session.OutputToString()).To(ContainSubstring(imageID3))
|
||||
Expect(session.OutputToString()).NotTo(ContainSubstring(imageID2))
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user