diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-03-18 12:52:07 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-18 12:52:07 -0700 |
commit | 41019f747280ba2c47df2ce6f83ddebfc2000745 (patch) | |
tree | 03cdbe5b9f57315cc3052b59e081503beccdfdad | |
parent | 03160dcf489f20102feb0f35b6bdb94fbafbc443 (diff) | |
parent | 082d792693504848e186a29db717ce20c7ff7774 (diff) | |
download | podman-41019f747280ba2c47df2ce6f83ddebfc2000745.tar.gz podman-41019f747280ba2c47df2ce6f83ddebfc2000745.tar.bz2 podman-41019f747280ba2c47df2ce6f83ddebfc2000745.zip |
Merge pull request #2632 from debarshiray/wip/rishi/podman-rm-exit-with-125-for-bogus-and-running
Make 'podman rm' exit with 125 if it had a bogus & a running container
-rw-r--r-- | cmd/podman/rm.go | 5 | ||||
-rw-r--r-- | test/e2e/rm_test.go | 14 |
2 files changed, 19 insertions, 0 deletions
diff --git a/cmd/podman/rm.go b/cmd/podman/rm.go index 56aaae9eb..299420bb6 100644 --- a/cmd/podman/rm.go +++ b/cmd/podman/rm.go @@ -195,5 +195,10 @@ func rmCmd(c *cliconfig.RmValues) error { exitCode = 1 } } + + if failureCnt > 0 { + exitCode = 125 + } + return err } diff --git a/test/e2e/rm_test.go b/test/e2e/rm_test.go index 1f67780da..9bf742a63 100644 --- a/test/e2e/rm_test.go +++ b/test/e2e/rm_test.go @@ -139,9 +139,23 @@ var _ = Describe("Podman rm", func() { Expect(podmanTest.NumberOfContainers()).To(Equal(1)) }) + It("podman rm bogus container", func() { session := podmanTest.Podman([]string{"rm", "bogus"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(1)) }) + It("podman rm bogus container and a running container", func() { + session := podmanTest.RunTopContainer("test1") + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + session = podmanTest.Podman([]string{"rm", "bogus", "test1"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(125)) + + session = podmanTest.Podman([]string{"rm", "test1", "bogus"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(125)) + }) }) |