mirror of
https://github.com/containers/podman.git
synced 2025-12-01 18:49:18 +08:00
Add container error message to ContainerState
This change aims to store an error message to the ContainerState struct with the last known error from the Start, StartAndAttach, and Stop OCI Runtime functions. The goal was to act in accordance with Docker's behavior. Fixes: #13729 Signed-off-by: Jake Correnti <jakecorrenti+github@proton.me>
This commit is contained in:
@@ -557,4 +557,24 @@ var _ = Describe("Podman inspect", func() {
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
})
|
||||
|
||||
It("podman inspect container with bad create args", func() {
|
||||
session := podmanTest.Podman([]string{"container", "create", ALPINE, "efcho", "Hello World"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
cid := session.OutputToString()
|
||||
session = podmanTest.Podman([]string{"container", "inspect", cid, "-f", "{{ .State.Error }}"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session.OutputToString()).To(HaveLen(0))
|
||||
|
||||
session = podmanTest.Podman([]string{"start", cid})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(125))
|
||||
session = podmanTest.Podman([]string{"container", "inspect", cid, "-f", "'{{ .State.Error }}"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session.OutputToString()).To(Not(HaveLen(0)))
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user