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

Method TestGRPCLBStatsUnaryDrop

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

Source from the content-addressed store, hash-verified

1470}
1471
1472func (s) TestGRPCLBStatsUnaryDrop(t *testing.T) {
1473 if err := runAndCheckStats(t, true, nil, func(cc *grpc.ClientConn) {
1474 testC := testgrpc.NewTestServiceClient(cc)
1475 ctx, cancel := context.WithTimeout(context.Background(), defaultFallbackTimeout)
1476 defer cancel()
1477 // The first non-failfast RPC succeeds, all connections are up.
1478 if _, err := testC.EmptyCall(ctx, &testpb.Empty{}, grpc.WaitForReady(true)); err != nil {
1479 t.Fatalf("%v.EmptyCall(_, _) = _, %v, want _, <nil>", testC, err)
1480 }
1481 for i := 0; i < countRPC-1; i++ {
1482 testC.EmptyCall(ctx, &testpb.Empty{})
1483 }
1484 }, &rpcStats{
1485 numCallsStarted: int64(countRPC),
1486 numCallsFinished: int64(countRPC),
1487 numCallsFinishedKnownReceived: int64(countRPC) / 2,
1488 numCallsDropped: map[string]int64{lbToken: int64(countRPC) / 2},
1489 }); err != nil {
1490 t.Fatal(err)
1491 }
1492}
1493
1494func (s) TestGRPCLBStatsUnaryFailedToSend(t *testing.T) {
1495 if err := runAndCheckStats(t, false, nil, func(cc *grpc.ClientConn) {

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected