MCPcopy
hub / github.com/grafana/tempo / addResponses

Function addResponses

modules/frontend/pipeline/responses_test.go:196–213  ·  view source on GitHub ↗
(r *asyncResponse)

Source from the content-addressed store, hash-verified

194}
195
196func addResponses(r *asyncResponse) int {
197 responsesToAdd := rand.Intn(5)
198 childResponse := newAsyncResponse()
199 defer childResponse.SendComplete()
200
201 ctx := context.Background()
202 r.Send(ctx, childResponse)
203 for i := 0; i < responsesToAdd; i++ {
204 childResponse.Send(ctx, NewHTTPToAsyncResponse(&http.Response{}))
205 }
206
207 recurse := rand.Intn(2)%2 == 0
208 if recurse {
209 return responsesToAdd + addResponses(childResponse)
210 }
211
212 return responsesToAdd
213}
214
215func TestAsyncResponsesDoesNotLeak(t *testing.T) {
216 tcs := []struct {

Callers 1

TestAsyncResponseFansInFunction · 0.85

Calls 4

newAsyncResponseFunction · 0.85
NewHTTPToAsyncResponseFunction · 0.85
SendCompleteMethod · 0.80
SendMethod · 0.65

Tested by

no test coverage detected