From 9243a092cfdf4a5d9af77ac5c318597f4c5d4bb3 Mon Sep 17 00:00:00 2001 From: Eric Chiang Date: Wed, 5 Oct 2016 08:01:35 -0700 Subject: [PATCH] server: add a test for the health check handler --- server/handlers_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/server/handlers_test.go b/server/handlers_test.go index abb4e431..ce058022 100644 --- a/server/handlers_test.go +++ b/server/handlers_test.go @@ -1 +1,19 @@ package server + +import ( + "net/http" + "net/http/httptest" + "testing" +) + +func TestHandleHealth(t *testing.T) { + httpServer, server := newTestServer(t, nil) + defer httpServer.Close() + + rr := httptest.NewRecorder() + server.handleHealth(rr, httptest.NewRequest("GET", "/healthz", nil)) + if rr.Code != http.StatusOK { + t.Errorf("expected 200 got %d", rr.Code) + } + +}