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

Function TestError

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

Source from the content-addressed store, hash-verified

98}
99
100func TestError(t *testing.T) {
101 prePoolOpts := goleak.IgnoreCurrent()
102
103 p := NewPool(&Config{
104 MaxWorkers: 1,
105 QueueDepth: 10,
106 })
107 opts := goleak.IgnoreCurrent()
108
109 ret := fmt.Errorf("blerg")
110 fn := func(_ context.Context, payload interface{}) (interface{}, error) {
111 i := payload.(int)
112
113 if i == 3 {
114 return nil, ret
115 }
116 return nil, nil
117 }
118 payloads := []interface{}{1, 2, 3, 4, 5}
119
120 msg, funcErrs, err := p.RunJobs(context.Background(), payloads, fn)
121 assert.Nil(t, msg)
122 assert.Nil(t, err)
123 assert.Equal(t, ret, multierr.Combine(funcErrs...))
124 goleak.VerifyNone(t, opts)
125
126 p.Shutdown()
127 goleak.VerifyNone(t, prePoolOpts)
128}
129
130func TestMultipleErrors(t *testing.T) {
131 prePoolOpts := goleak.IgnoreCurrent()

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected