mirror of
https://github.com/containers/podman.git
synced 2025-06-29 06:57:13 +08:00
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
This commit is contained in:
@ -195,5 +195,10 @@ func rmCmd(c *cliconfig.RmValues) error {
|
|||||||
exitCode = 1
|
exitCode = 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if failureCnt > 0 {
|
||||||
|
exitCode = 125
|
||||||
|
}
|
||||||
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -139,9 +139,23 @@ var _ = Describe("Podman rm", func() {
|
|||||||
Expect(podmanTest.NumberOfContainers()).To(Equal(1))
|
Expect(podmanTest.NumberOfContainers()).To(Equal(1))
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman rm bogus container", func() {
|
It("podman rm bogus container", func() {
|
||||||
session := podmanTest.Podman([]string{"rm", "bogus"})
|
session := podmanTest.Podman([]string{"rm", "bogus"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session.ExitCode()).To(Equal(1))
|
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))
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user