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

Function TestShutdown

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

Source from the content-addressed store, hash-verified

287}
288
289func TestShutdown(t *testing.T) {
290 prePoolOpts := goleak.IgnoreCurrent()
291 p := NewPool(&Config{
292 MaxWorkers: 1,
293 QueueDepth: 10,
294 })
295
296 ret := []byte{0x01, 0x03, 0x04}
297 fn := func(_ context.Context, payload interface{}) (interface{}, error) {
298 i := payload.(int)
299
300 if i == 3 {
301 return ret, nil
302 }
303 return nil, nil
304 }
305 payloads := []interface{}{1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5}
306 _, _, _ = p.RunJobs(context.Background(), payloads, fn)
307 p.Shutdown()
308 goleak.VerifyNone(t, prePoolOpts)
309
310 opts := goleak.IgnoreCurrent()
311 msg, _, err := p.RunJobs(context.Background(), payloads, fn)
312 assert.Nil(t, msg)
313 assert.Error(t, err)
314 goleak.VerifyNone(t, opts)
315}
316
317func TestDataEncodings(t *testing.T) {
318 prePoolOpts := goleak.IgnoreCurrent()

Callers

nothing calls this directly

Calls 4

RunJobsMethod · 0.95
ShutdownMethod · 0.95
NewPoolFunction · 0.70
ErrorMethod · 0.65

Tested by

no test coverage detected