MCPcopy Index your code
hub / github.com/cortexlabs/cortex / generateHandler

Function generateHandler

pkg/probe/handler_test.go:32–43  ·  view source on GitHub ↗
(pb *probe.Probe)

Source from the content-addressed store, hash-verified

30)
31
32func generateHandler(pb *probe.Probe) http.HandlerFunc {
33 return func(w http.ResponseWriter, r *http.Request) {
34 if !pb.IsHealthy() {
35 w.WriteHeader(http.StatusInternalServerError)
36 _, _ = w.Write([]byte("unhealthy"))
37 return
38 }
39
40 w.WriteHeader(http.StatusOK)
41 _, _ = w.Write([]byte("healthy"))
42 }
43}
44
45func TestHandlerSuccessTCP(t *testing.T) {
46 t.Parallel()

Callers 2

TestHandlerSuccessTCPFunction · 0.85
TestHandlerSuccessHTTPFunction · 0.85

Calls 2

IsHealthyMethod · 0.80
WriteMethod · 0.80

Tested by

no test coverage detected