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

Function TestSafeBuilderPool

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

Source from the content-addressed store, hash-verified

43}
44
45func TestSafeBuilderPool(t *testing.T) {
46 pool := newSafeBuilderPool()
47 builder := pool.Get()
48 builder.Set("name", "value")
49 lbls := builder.Labels()
50
51 assert.Equal(t, labels.FromStrings("name", "value"), lbls)
52
53 // Putting the builder back into the pool should reset it.
54 pool.Put(builder)
55
56 reusedBuilder := pool.Get()
57 assert.Equal(t, builder, reusedBuilder)
58 assert.Equal(t, labels.EmptyLabels(), reusedBuilder.Labels())
59}
60
61type sanitizerFunc func(lbls labels.Labels) labels.Labels
62

Callers

nothing calls this directly

Calls 5

newSafeBuilderPoolFunction · 0.85
GetMethod · 0.65
SetMethod · 0.65
EqualMethod · 0.45
PutMethod · 0.45

Tested by

no test coverage detected