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

Function TestMultipleErrors

tempodb/pool/pool_test.go:130–158  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

128}
129
130func TestMultipleErrors(t *testing.T) {
131 prePoolOpts := goleak.IgnoreCurrent()
132
133 p := NewPool(&Config{
134 MaxWorkers: 10,
135 QueueDepth: 10,
136 })
137 opts := goleak.IgnoreCurrent()
138
139 ret := fmt.Errorf("blerg")
140 fn := func(_ context.Context, _ interface{}) (interface{}, error) {
141 return nil, ret
142 }
143 payloads := []interface{}{1, 2, 3, 4, 5}
144
145 var expErr []error
146 for range payloads {
147 expErr = append(expErr, ret)
148 }
149
150 msg, funcErrs, err := p.RunJobs(context.Background(), payloads, fn)
151 assert.Nil(t, msg)
152 assert.NoError(t, err)
153 assert.Equal(t, expErr, funcErrs)
154 goleak.VerifyNone(t, opts)
155
156 p.Shutdown()
157 goleak.VerifyNone(t, prePoolOpts)
158}
159
160func TestTooManyJobs(t *testing.T) {
161 prePoolOpts := goleak.IgnoreCurrent()

Callers

nothing calls this directly

Calls 4

RunJobsMethod · 0.95
ShutdownMethod · 0.95
NewPoolFunction · 0.70
EqualMethod · 0.45

Tested by

no test coverage detected