(t *testing.T)
| 129 | } |
| 130 | |
| 131 | func TestErrorsPropagateUpstream(t *testing.T) { |
| 132 | rb := &requestBatch{} |
| 133 | |
| 134 | const totalRequests = 3 |
| 135 | wg := &sync.WaitGroup{} |
| 136 | |
| 137 | for i := 0; i < totalRequests-1; i++ { |
| 138 | errChan := make(chan error) |
| 139 | |
| 140 | wg.Add(1) |
| 141 | go func() { |
| 142 | err := <-errChan |
| 143 | require.ErrorContains(t, err, "foo") |
| 144 | wg.Done() |
| 145 | }() |
| 146 | req := httptest.NewRequest("GET", "http://example.com", nil) |
| 147 | _ = rb.add(&request{ |
| 148 | request: pipeline.NewHTTPRequest(req), |
| 149 | err: errChan, |
| 150 | }) |
| 151 | } |
| 152 | |
| 153 | rb.reportErrorToPipeline(errors.New("foo")) |
| 154 | wg.Wait() |
| 155 | // this test won't return unless all errChan's receive an error |
| 156 | } |
| 157 | |
| 158 | func TestResponsesPropagateUpstream(t *testing.T) { |
| 159 | rb := &requestBatch{} |
nothing calls this directly
no test coverage detected