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

Method TestGRPCLBStatsStreamingSuccess

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

Source from the content-addressed store, hash-verified

1514}
1515
1516func (s) TestGRPCLBStatsStreamingSuccess(t *testing.T) {
1517 if err := runAndCheckStats(t, false, nil, func(cc *grpc.ClientConn) {
1518 testC := testgrpc.NewTestServiceClient(cc)
1519 ctx, cancel := context.WithTimeout(context.Background(), defaultFallbackTimeout)
1520 defer cancel()
1521 // The first non-failfast RPC succeeds, all connections are up.
1522 stream, err := testC.FullDuplexCall(ctx, grpc.WaitForReady(true))
1523 if err != nil {
1524 t.Fatalf("%v.FullDuplexCall(_, _) = _, %v, want _, <nil>", testC, err)
1525 }
1526 for {
1527 if _, err = stream.Recv(); err == io.EOF {
1528 break
1529 }
1530 }
1531 for i := 0; i < countRPC-1; i++ {
1532 stream, err = testC.FullDuplexCall(ctx)
1533 if err == nil {
1534 // Wait for stream to end if err is nil.
1535 for {
1536 if _, err = stream.Recv(); err == io.EOF {
1537 break
1538 }
1539 }
1540 }
1541 }
1542 }, &rpcStats{
1543 numCallsStarted: int64(countRPC),
1544 numCallsFinished: int64(countRPC),
1545 numCallsFinishedKnownReceived: int64(countRPC),
1546 }); err != nil {
1547 t.Fatal(err)
1548 }
1549}
1550
1551func (s) TestGRPCLBStatsStreamingDrop(t *testing.T) {
1552 if err := runAndCheckStats(t, true, nil, func(cc *grpc.ClientConn) {

Callers

nothing calls this directly

Calls 6

FullDuplexCallMethod · 0.95
WaitForReadyFunction · 0.92
runAndCheckStatsFunction · 0.85
FatalfMethod · 0.65
RecvMethod · 0.65
FatalMethod · 0.65

Tested by

no test coverage detected