From 7b7d27f16cb579b6a46459b2073ce7815bee5449 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Tue, 23 Jun 2020 13:58:40 +0800 Subject: [PATCH] chore(server): add testing with healthz router. (#526) Signed-off-by: Bo-Yi Wu --- gorush/server_test.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/gorush/server_test.go b/gorush/server_test.go index e8b8b8e..f186d93 100644 --- a/gorush/server_test.go +++ b/gorush/server_test.go @@ -353,7 +353,7 @@ func TestMetricsHandler(t *testing.T) { }) } -func TestHeartbeatHandler(t *testing.T) { +func TestGETHeartbeatHandler(t *testing.T) { initTest() r := gofight.New() @@ -364,6 +364,17 @@ func TestHeartbeatHandler(t *testing.T) { }) } +func TestHEADHeartbeatHandler(t *testing.T) { + initTest() + + r := gofight.New() + + r.HEAD("/healthz"). + Run(routerEngine(), func(r gofight.HTTPResponse, rq gofight.HTTPRequest) { + assert.Equal(t, http.StatusOK, r.Code) + }) +} + func TestVersionHandler(t *testing.T) { SetVersion("3.0.0") initTest()