MCPcopy
hub / github.com/grpc-ecosystem/grpc-gateway / TestWithHealthzEndpoint_serviceParam

Function TestWithHealthzEndpoint_serviceParam

runtime/mux_test.go:837–855  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

835}
836
837func TestWithHealthzEndpoint_serviceParam(t *testing.T) {
838 service := "test"
839
840 // trigger error to output service in body
841 dummyClient := dummyHealthCheckClient{status: grpc_health_v1.HealthCheckResponse_UNKNOWN, code: codes.Unknown}
842 mux := runtime.NewServeMux(runtime.WithHealthzEndpoint(&dummyClient))
843
844 r := httptest.NewRequest(http.MethodGet, "/healthz?service="+service, nil)
845 rr := httptest.NewRecorder()
846
847 mux.ServeHTTP(rr, r)
848
849 if !strings.Contains(rr.Body.String(), service) {
850 t.Errorf(
851 "service query parameter should be translated to HealthCheckRequest: expected %s to contain %s",
852 rr.Body.String(), service,
853 )
854 }
855}
856
857func TestWithHealthzEndpoint_header(t *testing.T) {
858 for _, tt := range healthCheckTests {

Callers

nothing calls this directly

Calls 4

ServeHTTPMethod · 0.95
NewServeMuxFunction · 0.92
WithHealthzEndpointFunction · 0.92
StringMethod · 0.45

Tested by

no test coverage detected