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

Function TestResults

tempodb/pool/pool_test.go:17–46  ·  tempodb/pool/pool_test.go::TestResults
(t *testing.T)

Source from the content-addressed store, hash-verified

15)
16
17func TestResults(t *testing.T) {
18 prePoolOpts := goleak.IgnoreCurrent()
19
20 p := NewPool(&Config{
21 MaxWorkers: 10,
22 QueueDepth: 10,
23 })
24 opts := goleak.IgnoreCurrent()
25
26 ret := []byte{0x01, 0x02}
27 fn := func(_ context.Context, payload interface{}) (interface{}, error) {
28 i := payload.(int)
29
30 if i == 3 {
31 return ret, nil
32 }
33 return nil, nil
34 }
35 payloads := []interface{}{1, 2, 3, 4, 5}
36
37 msg, funcErrs, err := p.RunJobs(context.Background(), payloads, fn)
38 assert.NoError(t, err)
39 assert.Nil(t, funcErrs)
40 require.Len(t, msg, 1)
41 assert.Equal(t, ret, msg[0])
42 goleak.VerifyNone(t, opts)
43
44 p.Shutdown()
45 goleak.VerifyNone(t, prePoolOpts)
46}
47
48func TestNoResults(t *testing.T) {
49 prePoolOpts := goleak.IgnoreCurrent()

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected