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

Function TestLabelBuilder

modules/generator/registry/builder_test.go:10–23  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8)
9
10func TestLabelBuilder(t *testing.T) {
11 builder := NewLabelBuilder(0, 0, newTestDrainSanitizer(SpanNameSanitizationDisabled), newTestLabelLimiter())
12 builder.Add("name", "value")
13 lbls, ok := builder.CloseAndBuildLabels()
14
15 assert.True(t, ok)
16 assert.Equal(t, labels.FromStrings("name", "value"), lbls)
17
18 // Using the builder after calling Labels() will panic to prevent memory
19 // corruption.
20 assert.Panics(t, func() {
21 builder.Add("test", "test")
22 })
23}
24
25func TestLabelBuilder_MaxLabelNameLength(t *testing.T) {
26 builder := NewLabelBuilder(10, 10, newTestDrainSanitizer(SpanNameSanitizationDisabled), newTestLabelLimiter())

Callers

nothing calls this directly

Calls 6

AddMethod · 0.95
CloseAndBuildLabelsMethod · 0.95
NewLabelBuilderFunction · 0.85
newTestDrainSanitizerFunction · 0.85
newTestLabelLimiterFunction · 0.85
EqualMethod · 0.45

Tested by

no test coverage detected