requestWithContext simulates a request in a separate goroutine. The request will either fail immediately (as observable via expectFailure) or block until processSuccessfully is called.
(ctx context.Context)
| 369 | // request will either fail immediately (as observable via expectFailure) |
| 370 | // or block until processSuccessfully is called. |
| 371 | func (r *requestor) requestWithContext(ctx context.Context) { |
| 372 | go func() { |
| 373 | err := r.breaker.Maybe(ctx, func() { |
| 374 | r.InProgress.Inc() |
| 375 | <-r.barrierCh |
| 376 | }) |
| 377 | r.acceptedCh <- err == nil |
| 378 | }() |
| 379 | } |
| 380 | |
| 381 | // expectFailure waits for a request to finish and asserts it to be failed. |
| 382 | func (r *requestor) expectFailure(t *testing.T) { |
no test coverage detected