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

Function TestCombiner

tempodb/encoding/vparquet5/combiner_test.go:13–390  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

11)
12
13func TestCombiner(t *testing.T) {
14 methods := []func(a, b *Trace) (*Trace, int, bool){
15 func(a, b *Trace) (*Trace, int, bool) {
16 c := NewCombiner()
17 c.Consume(a)
18 c.Consume(b)
19 return c.Result()
20 },
21 func(a, b *Trace) (*Trace, int, bool) {
22 c := NewCombiner()
23 c.Consume(a)
24 c.ConsumeWithFinal(b, true)
25 return c.Result()
26 },
27 }
28
29 tests := []struct {
30 name string
31 traceA *Trace
32 traceB *Trace
33 expectedTotal int
34 expectedTrace *Trace
35 }{
36 {
37 name: "nil traceA",
38 traceA: nil,
39 traceB: &Trace{},
40 expectedTotal: -1,
41 },
42 {
43 name: "nil traceB",
44 traceA: &Trace{},
45 traceB: nil,
46 expectedTotal: -1,
47 },
48 {
49 name: "empty traces",
50 traceA: &Trace{},
51 traceB: &Trace{},
52 expectedTotal: 0,
53 },
54 {
55 name: "root meta from second overrides empty first",
56 traceA: &Trace{
57 TraceID: []byte{0x00, 0x01},
58 ServiceStats: []ServiceStats{},
59 },
60 traceB: &Trace{
61 TraceID: []byte{0x00, 0x01},
62 RootServiceName: "serviceNameB",
63 RootSpanName: "spanNameB",
64 StartTimeUnixNano: 10,
65 EndTimeUnixNano: 20,
66 DurationNano: 10,
67 ServiceStats: []ServiceStats{},
68 },
69 expectedTrace: &Trace{
70 TraceID: []byte{0x00, 0x01},

Callers

nothing calls this directly

Calls 7

ConsumeMethod · 0.95
ResultMethod · 0.95
ConsumeWithFinalMethod · 0.95
mFunction · 0.85
NewCombinerFunction · 0.70
RunMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected