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

Function TestCombiner

tempodb/encoding/vparquet3/combiner_test.go:13–233  ·  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 }
22
23 tests := []struct {
24 traceA *Trace
25 traceB *Trace
26 expectedTotal int
27 expectedTrace *Trace
28 }{
29 {
30 traceA: nil,
31 traceB: &Trace{},
32 expectedTotal: -1,
33 },
34 {
35 traceA: &Trace{},
36 traceB: nil,
37 expectedTotal: -1,
38 },
39 {
40 traceA: &Trace{},
41 traceB: &Trace{},
42 expectedTotal: 0,
43 },
44 // root meta from second overrides empty first
45 {
46 traceA: &Trace{
47 TraceID: []byte{0x00, 0x01},
48 },
49 traceB: &Trace{
50 TraceID: []byte{0x00, 0x01},
51 RootServiceName: "serviceNameB",
52 RootSpanName: "spanNameB",
53 StartTimeUnixNano: 10,
54 EndTimeUnixNano: 20,
55 DurationNano: 10,
56 },
57 expectedTrace: &Trace{
58 TraceID: []byte{0x00, 0x01},
59 RootServiceName: "serviceNameB",
60 RootSpanName: "spanNameB",
61 StartTimeUnixNano: 10,
62 EndTimeUnixNano: 20,
63 DurationNano: 10,
64 },
65 },
66 // if both set first root name wins
67 {
68 traceA: &Trace{
69 TraceID: []byte{0x00, 0x01},
70 RootServiceName: "serviceNameA",

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected