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

Method TestGRPCLBStatsUnaryFailedToSend

balancer/grpclb/grpclb_test.go:1494–1514  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1492}
1493
1494func (s) TestGRPCLBStatsUnaryFailedToSend(t *testing.T) {
1495 if err := runAndCheckStats(t, false, nil, func(cc *grpc.ClientConn) {
1496 testC := testgrpc.NewTestServiceClient(cc)
1497 ctx, cancel := context.WithTimeout(context.Background(), defaultFallbackTimeout)
1498 defer cancel()
1499 // The first non-failfast RPC succeeds, all connections are up.
1500 if _, err := testC.EmptyCall(ctx, &testpb.Empty{}, grpc.WaitForReady(true)); err != nil {
1501 t.Fatalf("%v.EmptyCall(_, _) = _, %v, want _, <nil>", testC, err)
1502 }
1503 for i := 0; i < countRPC-1; i++ {
1504 cc.Invoke(ctx, failtosendURI, &testpb.Empty{}, nil)
1505 }
1506 }, &rpcStats{
1507 numCallsStarted: int64(countRPC),
1508 numCallsFinished: int64(countRPC),
1509 numCallsFinishedWithClientFailedToSend: int64(countRPC) - 1,
1510 numCallsFinishedKnownReceived: 1,
1511 }); err != nil {
1512 t.Fatal(err)
1513 }
1514}
1515
1516func (s) TestGRPCLBStatsStreamingSuccess(t *testing.T) {
1517 if err := runAndCheckStats(t, false, nil, func(cc *grpc.ClientConn) {

Callers

nothing calls this directly

Calls 6

EmptyCallMethod · 0.95
WaitForReadyFunction · 0.92
runAndCheckStatsFunction · 0.85
FatalfMethod · 0.65
InvokeMethod · 0.65
FatalMethod · 0.65

Tested by

no test coverage detected