mirror of
https://github.com/containers/podman.git
synced 2025-06-26 21:07:02 +08:00
Add comment for jsonMarshal command
* also, change makeHealthCheck to the standard test command structure Signed-off-by: Liang Chu-Xuan <karta0807913@gmail.com>
This commit is contained in:
@ -523,6 +523,7 @@ func probeToHealthConfig(probe *v1.Probe) (*manifest.Schema2HealthConfig, error)
|
|||||||
// configure healthcheck on the basis of Handler Actions.
|
// configure healthcheck on the basis of Handler Actions.
|
||||||
switch {
|
switch {
|
||||||
case probeHandler.Exec != nil:
|
case probeHandler.Exec != nil:
|
||||||
|
// `makeHealthCheck` function can accept a json array as the command.
|
||||||
cmd, err := json.Marshal(probeHandler.Exec.Command)
|
cmd, err := json.Marshal(probeHandler.Exec.Command)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -618,6 +619,8 @@ func makeHealthCheck(inCmd string, interval int32, retries int32, timeout int32,
|
|||||||
// ...otherwise pass it to "/bin/sh -c" inside the container
|
// ...otherwise pass it to "/bin/sh -c" inside the container
|
||||||
cmd = []string{define.HealthConfigTestCmdShell}
|
cmd = []string{define.HealthConfigTestCmdShell}
|
||||||
cmd = append(cmd, strings.Split(inCmd, " ")...)
|
cmd = append(cmd, strings.Split(inCmd, " ")...)
|
||||||
|
} else {
|
||||||
|
cmd = append([]string{define.HealthConfigTestCmd}, cmd...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
hc := manifest.Schema2HealthConfig{
|
hc := manifest.Schema2HealthConfig{
|
||||||
|
@ -1754,7 +1754,7 @@ var _ = Describe("Podman play kube", func() {
|
|||||||
inspect.WaitWithDefaultTimeout()
|
inspect.WaitWithDefaultTimeout()
|
||||||
healthcheckcmd := inspect.OutputToString()
|
healthcheckcmd := inspect.OutputToString()
|
||||||
// check if CMD-SHELL based equivalent health check is added to container
|
// check if CMD-SHELL based equivalent health check is added to container
|
||||||
Expect(healthcheckcmd).To(ContainSubstring("[echo hello]"))
|
Expect(healthcheckcmd).To(ContainSubstring("[CMD echo hello]"))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman play kube liveness probe should fail", func() {
|
It("podman play kube liveness probe should fail", func() {
|
||||||
|
Reference in New Issue
Block a user