channelzTraceEventFound looks up the top-channels in channelz (expects a single one), and checks if there is a trace event on the channel matching the provided description string.
(ctx context.Context, wantDesc string)
| 67 | // single one), and checks if there is a trace event on the channel matching the |
| 68 | // provided description string. |
| 69 | func channelzTraceEventFound(ctx context.Context, wantDesc string) error { |
| 70 | for ctx.Err() == nil { |
| 71 | tcs, _ := channelz.GetTopChannels(0, 0) |
| 72 | if l := len(tcs); l != 1 { |
| 73 | return fmt.Errorf("when looking for channelz trace event with description %q, found %d top-level channels, want 1", wantDesc, l) |
| 74 | } |
| 75 | trace := tcs[0].Trace() |
| 76 | if trace == nil { |
| 77 | return fmt.Errorf("when looking for channelz trace event with description %q, no trace events found for top-level channel", wantDesc) |
| 78 | } |
| 79 | |
| 80 | for _, e := range trace.Events { |
| 81 | if strings.Contains(e.Desc, wantDesc) { |
| 82 | return nil |
| 83 | } |
| 84 | } |
| 85 | } |
| 86 | return fmt.Errorf("when looking for channelz trace event with description %q, %w", wantDesc, ctx.Err()) |
| 87 | } |
| 88 | |
| 89 | // Registers a wrapped round_robin LB policy for the duration of this test that |
| 90 | // retains all the functionality of the round_robin LB policy and makes the |
no test coverage detected