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

Function TestCombinerChecksMaxBytes

pkg/model/trace/combine_test.go:67–86  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

65}
66
67func TestCombinerChecksMaxBytes(t *testing.T) {
68 // Ensure that the combiner checks max bytes when consuming a trace.
69 for _, maxBytes := range []int{0, 100, 1000, 10000} {
70 c := NewCombiner(maxBytes, false)
71 curSize := 0
72
73 // attempt up to 20 traces to exceed max bytes
74 for i := 0; i < 20; i++ {
75 tr := test.MakeTraceWithSpanCount(1, 1, []byte{0x01})
76 curSize += tr.Size()
77
78 _, err := c.Consume(tr)
79 if curSize > maxBytes && maxBytes != 0 {
80 require.Error(t, err)
81 continue
82 }
83 require.NoError(t, err)
84 }
85 }
86}
87
88func TestCombinerReturnsAPartialTrace(t *testing.T) {
89 // Ensure that the combiner checks max bytes when consuming a trace.

Callers

nothing calls this directly

Calls 5

ConsumeMethod · 0.95
MakeTraceWithSpanCountFunction · 0.92
NewCombinerFunction · 0.70
SizeMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected