mirror of https://github.com/k3s-io/k3s
Add a negative test for HTTP health checks
parent
d04fce045e
commit
5be9ff70af
|
@ -520,6 +520,39 @@ var _ = Describe("Pods", func() {
|
|||
}, true)
|
||||
})
|
||||
|
||||
It("should *not* be restarted with a /healthz http liveness probe", func() {
|
||||
runLivenessTest(framework.Client, framework.Namespace.Name, &api.Pod{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
Name: "liveness-http",
|
||||
Labels: map[string]string{"test": "liveness"},
|
||||
},
|
||||
Spec: api.PodSpec{
|
||||
Containers: []api.Container{
|
||||
{
|
||||
Name: "liveness",
|
||||
Image: "gcr.io/google_containers/nettest:1.6",
|
||||
// These args are garbage but the image will exit if they're not there
|
||||
// we just care about /read serving a 200, which it always does.
|
||||
Args: []string{
|
||||
"-service=liveness-http",
|
||||
"-peers=1",
|
||||
"-namespace=" + framework.Namespace.Name},
|
||||
Ports: []api.ContainerPort{{ContainerPort: 8080}},
|
||||
LivenessProbe: &api.Probe{
|
||||
Handler: api.Handler{
|
||||
HTTPGet: &api.HTTPGetAction{
|
||||
Path: "/read",
|
||||
Port: util.NewIntOrStringFromInt(8080),
|
||||
},
|
||||
},
|
||||
InitialDelaySeconds: 15,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}, false)
|
||||
})
|
||||
|
||||
// The following tests for remote command execution and port forwarding are
|
||||
// commented out because the GCE environment does not currently have nsenter
|
||||
// in the kubelet's PATH, nor does it have socat installed. Once we figure
|
||||
|
|
Loading…
Reference in New Issue