forked from mystiq/dex
Merge pull request #589 from ericchiang/dev-health-check-add-test
server: add a test for the health check handler
This commit is contained in:
commit
aa83e7e5ec
1 changed files with 18 additions and 0 deletions
|
@ -1 +1,19 @@
|
||||||
package server
|
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)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue