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

Function TestDoneChanClosesOnStop

modules/frontend/v1/request_batch_test.go:105–129  ·  view source on GitHub ↗
(_ *testing.T)

Source from the content-addressed store, hash-verified

103}
104
105func TestDoneChanClosesOnStop(_ *testing.T) {
106 rb := &requestBatch{}
107
108 const totalRequests = 3
109 req := httptest.NewRequest("GET", "http://example.com", nil)
110
111 for i := 0; i < totalRequests-1; i++ {
112 _ = rb.add(&request{
113 request: pipeline.NewHTTPRequest(req),
114 })
115 }
116
117 stop := make(chan struct{})
118 wg := &sync.WaitGroup{}
119 wg.Add(1)
120 go func() {
121 done := rb.doneChan(stop)
122 <-done
123 wg.Done()
124 }()
125
126 close(stop)
127 wg.Wait()
128 // this test won't return unless doneChan closes on stop
129}
130
131func TestErrorsPropagateUpstream(t *testing.T) {
132 rb := &requestBatch{}

Callers

nothing calls this directly

Calls 6

addMethod · 0.95
doneChanMethod · 0.95
NewHTTPRequestFunction · 0.92
AddMethod · 0.65
DoneMethod · 0.65
WaitMethod · 0.65

Tested by

no test coverage detected