Skip to content

Commit

Permalink
Merge pull request #2632 from debarshiray/wip/rishi/podman-rm-exit-wi…
Browse files Browse the repository at this point in the history
…th-125-for-bogus-and-running

Make 'podman rm' exit with 125 if it had a bogus & a running container
  • Loading branch information
openshift-merge-robot authored Mar 18, 2019
2 parents 03160dc + 082d792 commit 41019f7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmd/podman/rm.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,5 +195,10 @@ func rmCmd(c *cliconfig.RmValues) error {
exitCode = 1
}
}

if failureCnt > 0 {
exitCode = 125
}

return err
}
14 changes: 14 additions & 0 deletions test/e2e/rm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
})
})

0 comments on commit 41019f7

Please sign in to comment.