(t *testing.T)
| 1613 | } |
| 1614 | |
| 1615 | func (s) TestGRPCLBStatsQuashEmpty(t *testing.T) { |
| 1616 | ch := make(chan *lbpb.ClientStats) |
| 1617 | defer close(ch) |
| 1618 | if err := runAndCheckStats(t, false, ch, func(*grpc.ClientConn) { |
| 1619 | // Perform no RPCs; wait for load reports to start, which should be |
| 1620 | // zero, then expect no other load report within 5x the update |
| 1621 | // interval. |
| 1622 | select { |
| 1623 | case st := <-ch: |
| 1624 | if !isZeroStats(st) { |
| 1625 | t.Errorf("got stats %v; want all zero", st) |
| 1626 | } |
| 1627 | case <-time.After(5 * time.Second): |
| 1628 | t.Errorf("did not get initial stats report after 5 seconds") |
| 1629 | return |
| 1630 | } |
| 1631 | |
| 1632 | select { |
| 1633 | case st := <-ch: |
| 1634 | t.Errorf("got unexpected stats report: %v", st) |
| 1635 | case <-time.After(500 * time.Millisecond): |
| 1636 | // Success. |
| 1637 | } |
| 1638 | go func() { |
| 1639 | for range ch { // Drain statsChan until it is closed. |
| 1640 | } |
| 1641 | }() |
| 1642 | }, &rpcStats{ |
| 1643 | numCallsStarted: 0, |
| 1644 | numCallsFinished: 0, |
| 1645 | numCallsFinishedKnownReceived: 0, |
| 1646 | }); err != nil { |
| 1647 | t.Fatal(err) |
| 1648 | } |
| 1649 | } |
nothing calls this directly
no test coverage detected