pickAndCheckError returns a function which takes a picker, invokes the Pick() method multiple times and ensures that the error returned by the picker matches the provided error.
(want error)
| 73 | // pickAndCheckError returns a function which takes a picker, invokes the Pick() method |
| 74 | // multiple times and ensures that the error returned by the picker matches the provided error. |
| 75 | func pickAndCheckError(want error) func(balancer.Picker) error { |
| 76 | const rpcCount = 5 |
| 77 | return func(p balancer.Picker) error { |
| 78 | for i := 0; i < rpcCount; i++ { |
| 79 | if _, err := p.Pick(balancer.PickInfo{}); err == nil || !strings.Contains(err.Error(), want.Error()) { |
| 80 | return fmt.Errorf("picker.Pick() returned error: %v, want: %v", err, want) |
| 81 | } |
| 82 | } |
| 83 | return nil |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | func (t *testConfigBalancerBuilder) Build(cc balancer.ClientConn, opts balancer.BuildOptions) balancer.Balancer { |
| 88 | rr := t.Builder.Build(cc, opts) |
no test coverage detected