mirror of
https://github.com/containers/podman.git
synced 2025-08-05 19:02:37 +08:00
added healthcheck to ps command
Signed-off-by: Sankalp Rangare <sankalprangare786@gmail.com>
This commit is contained in:
@ -375,6 +375,10 @@ func (l psReporter) State() string {
|
||||
|
||||
// Status is a synonym for State()
|
||||
func (l psReporter) Status() string {
|
||||
hc := l.ListContainer.Status
|
||||
if hc != "" {
|
||||
return l.State() + " (" + hc + ")"
|
||||
}
|
||||
return l.State()
|
||||
}
|
||||
|
||||
|
@ -241,6 +241,13 @@ func ListContainerBatch(rt *libpod.Runtime, ctr *libpod.Container, opts entities
|
||||
UTS: uts,
|
||||
}
|
||||
}
|
||||
|
||||
if hc, err := ctr.HealthCheckStatus(); err == nil {
|
||||
ps.Status = hc
|
||||
} else {
|
||||
logrus.Debug(err)
|
||||
}
|
||||
|
||||
return ps, nil
|
||||
}
|
||||
|
||||
|
@ -80,6 +80,11 @@ var _ = Describe("Podman healthcheck run", func() {
|
||||
time.Sleep(1 * time.Second)
|
||||
}
|
||||
Expect(exitCode).To(Equal(0))
|
||||
|
||||
ps := podmanTest.Podman([]string{"ps"})
|
||||
ps.WaitWithDefaultTimeout()
|
||||
Expect(ps).Should(Exit(0))
|
||||
Expect(ps.OutputToString()).To(ContainSubstring("(healthy)"))
|
||||
})
|
||||
|
||||
It("podman healthcheck that should fail", func() {
|
||||
|
Reference in New Issue
Block a user