From 5be9ff70af910a95e7c9fca06bd8d0f87cf1b2f0 Mon Sep 17 00:00:00 2001 From: Brendan Burns Date: Thu, 6 Aug 2015 20:59:37 -0700 Subject: [PATCH] Add a negative test for HTTP health checks --- test/e2e/pods.go | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/test/e2e/pods.go b/test/e2e/pods.go index 403030cade1..bf28677edb8 100644 --- a/test/e2e/pods.go +++ b/test/e2e/pods.go @@ -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