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

Function TestGenericCombinerHoldsErrors

modules/frontend/combiner/common_test.go:134–163  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

132}
133
134func TestGenericCombinerHoldsErrors(t *testing.T) {
135 // slam a combiner with successful responses and just one error. confirm that the error is returned
136 combiner := newTestCombiner()
137 wg := sync.WaitGroup{}
138
139 for j := 0; j < 10; j++ {
140 wg.Add(1)
141 go func() {
142 defer wg.Done()
143
144 for i := 0; i < 10000; i++ {
145 err := combiner.AddResponse(newTestResponse(t))
146 require.NoError(t, err)
147 }
148 }()
149 }
150
151 wg.Add(1)
152 go func() {
153 defer wg.Done()
154 time.Sleep(time.Millisecond)
155 err := combiner.AddResponse(newFailedTestResponse())
156 require.NoError(t, err)
157 }()
158
159 wg.Wait()
160 resp, err := combiner.HTTPFinal()
161 require.NoError(t, err)
162 require.Equal(t, http.StatusInternalServerError, resp.StatusCode)
163}
164
165func TestGenericCombinerDoesntRace(t *testing.T) {
166 combiner := newTestCombiner()

Callers

nothing calls this directly

Calls 10

newTestCombinerFunction · 0.85
newTestResponseFunction · 0.85
newFailedTestResponseFunction · 0.85
AddMethod · 0.65
DoneMethod · 0.65
AddResponseMethod · 0.65
SleepMethod · 0.65
WaitMethod · 0.65
HTTPFinalMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected