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

Method TestGRPCLBStatsUnarySuccess

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

Source from the content-addressed store, hash-verified

1449)
1450
1451func (s) TestGRPCLBStatsUnarySuccess(t *testing.T) {
1452 if err := runAndCheckStats(t, false, nil, func(cc *grpc.ClientConn) {
1453 testC := testgrpc.NewTestServiceClient(cc)
1454 ctx, cancel := context.WithTimeout(context.Background(), defaultFallbackTimeout)
1455 defer cancel()
1456 // The first non-failfast RPC succeeds, all connections are up.
1457 if _, err := testC.EmptyCall(ctx, &testpb.Empty{}, grpc.WaitForReady(true)); err != nil {
1458 t.Fatalf("%v.EmptyCall(_, _) = _, %v, want _, <nil>", testC, err)
1459 }
1460 for i := 0; i < countRPC-1; i++ {
1461 testC.EmptyCall(ctx, &testpb.Empty{})
1462 }
1463 }, &rpcStats{
1464 numCallsStarted: int64(countRPC),
1465 numCallsFinished: int64(countRPC),
1466 numCallsFinishedKnownReceived: int64(countRPC),
1467 }); err != nil {
1468 t.Fatal(err)
1469 }
1470}
1471
1472func (s) TestGRPCLBStatsUnaryDrop(t *testing.T) {
1473 if err := runAndCheckStats(t, true, 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