MCPcopy
hub / github.com/grpc/grpc-go / TestHealthCheckFailure

Method TestHealthCheckFailure

test/healthcheck_test.go:942–961  ·  view source on GitHub ↗

TestHealthCheckFailure invokes the unary Check() RPC on the health server with an expired context and expects the RPC to fail.

(t *testing.T)

Source from the content-addressed store, hash-verified

940// TestHealthCheckFailure invokes the unary Check() RPC on the health server
941// with an expired context and expects the RPC to fail.
942func (s) TestHealthCheckFailure(t *testing.T) {
943 e := env{
944 name: "tcp-tls",
945 network: "tcp",
946 security: "tls",
947 balancer: roundrobin.Name,
948 }
949 te := newTest(t, e)
950 te.declareLogNoise(
951 "Failed to dial ",
952 "grpc: the client connection is closing; please retry",
953 )
954 te.enableHealthServer = true
955 te.startServer(&testServer{security: e.security})
956 te.setHealthServingStatus(defaultHealthService, healthpb.HealthCheckResponse_SERVING)
957 defer te.tearDown()
958
959 verifyHealthCheckErrCode(t, 0*time.Second, te.clientConn(), defaultHealthService, codes.DeadlineExceeded)
960 awaitNewConnLogOutput()
961}
962
963// TestHealthCheckOff makes a unary Check() RPC on the health server where the
964// health status of the defaultHealthService is not set, and therefore expects

Callers

nothing calls this directly

Calls 8

verifyHealthCheckErrCodeFunction · 0.85
awaitNewConnLogOutputFunction · 0.85
declareLogNoiseMethod · 0.80
newTestFunction · 0.70
startServerMethod · 0.45
tearDownMethod · 0.45
clientConnMethod · 0.45

Tested by

no test coverage detected