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

Function TestErrorsPropagateUpstream

modules/frontend/v1/request_batch_test.go:131–156  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

129}
130
131func 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
158func TestResponsesPropagateUpstream(t *testing.T) {
159 rb := &requestBatch{}

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected